Öznur Tastan wrote:
> Well actually storing the examples doesn't need the information for the > alignment but > if you are interested. > Pairwise sequence alignment is a widely used terms to visualize the > similarity of protein or DNA > sequences. So the characters denotes the aminoacids(or nucleotides in DNAs) > and the conservation substitutions or deletions of give clues about > biological meanings actualy predict the evolution at that site of the > protein. > Substitution scoring matrices which are mostly based on frequency analysis > are used to align the alignments. These are matrices that tell how similiar > one aminoacid to another so to say how it is likely to be replaced by the > other aminoacid. so Aligning L with L will have positive score that you can > get from the scoring matrice entry yet the gaps will be penalized although > mismatches will be penalized. > The alignment is obtained by using a dynamic programing appraach, > Needleman-Wunch algorithm. > The score is the sum of the score of aligning each character. > > > > > I await the conclusion and enlightment as this thread has proven > > interesting. :) > > > > Thx/Sx Okay. This is getting a bit more clear. Can you always count on being able to express the score as an integer? If so, this can be pretty straightforward, but there will be a Perl learning curve. It sounds to me like you really need a class for these alignments. The meaning of their internal data is very specific to this context. You could use a hash for any particular alignment, of course, but then you are re-doing the work with each one. You class could start out as simple as the structs you were seeking earlier. Perlis very liberal [too liberal IMHO] about access to data members of its objects. So your package could start out as simple as: package SequenceAlignment; use strict; use warnings; use Exporter; my @ISA = Exporter; sub new { my $class = shift; my ($sequence1, $sequence2, $alignment_score) = @_; my $self = { 'base sequence' => $sequence1, comparison sequence' => $sequence2, 'alignment score' => $alignment_score } bless $self, $class; return $self; } Even without any methods defined, this at least gives you a framework for storing the alignments. Since you obviously have some fairly specific operations relating to them, you will want to create some methods to manipulate the data in context, though. One great advantage to this approach is that you can pass the reference returned by the constructor above in a very lightweight manner. When you need information from the reference itself, you can access the information through this reference: my $alignment = SequenceAlignment->new ('AGGGTCATCCTTA', CCTTAGTTAA___', 2); # Sorry if the data above fails any sanity tests Quick and dirty access: my $base_sequence = $alignment->{'base sequence'} Object-oriented access; my $base_sequence = $alignment->get_base_sequence(); With the second access style shown above, you have the advantage that you can define the get_base_sequence() method so as to take into account any factors relevant to handling this particular form of data. Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>