<div dir="ltr"><div>Thanks Chris,<br></div>the module you mentioned can only calculate score for nucleic acids, and I am in fact working with aminoacids alignment. However, I've written the sub for my needs (it's below, in case someone else needs it).<br><br>sub score_aln<br> {<br> #Takes two alignment lines AS STRINGS; <br> #Assumes $matrix (Bio::Matrix::Generic), $open_penalty and $extend_penalty to be declared as global variables<br><br> die "Different lengths of sequences:\n$_[0]\n$_[1]\n" if length$_[0]!=length$_[1];<br> my @line1=split(//,$_[0]);<br> my @line2=split(//,$_[0]);<br> my $score=0;<br> my $extend=0;<br> #Below we count score for each pair (two AA, new gap or gap extension)<br> CHAR:for (my $j=0;$j<scalar(@line1);$j++)<br> {<br> if (($line1[$j] eq '-')or($line2[$j] eq '-'))<br> {<br> next CHAR if ($line1[$j] eq $line2[$j]);<br> #Skip positions with both sequences containing gaps (in case we haven't filtered them before)<br> if ($extend==0)<br> {<br> $score-=$open_penalty;<br> $extend=1;<br> }<br> else {$score-=$extend_penalty;}<br> }<br> else<br> {<br> $score+=$matrix->get_entry($line1[$j],$line2[$j]);<br> $extend=0;<br> }<br> }<br> return $score;<br> }<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">2014-10-01 1:54 GMT+09:00 Fields, Christopher J <span dir="ltr"><<a href="mailto:cjfields@illinois.edu" target="_blank">cjfields@illinois.edu</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><div><div class="h5">
<div>On Sep 30, 2014, at 1:20 AM, Alexey Morozov <<a href="mailto:alexeymorozov1991@gmail.com" target="_blank">alexeymorozov1991@gmail.com</a>> wrote:</div>
<div><br>
<blockquote type="cite">
<div dir="ltr">
<div>Dear colleagues,<br>
</div>
Is there a method in bioperl that will calculate pairwise alignment scores for any given pair of genes in MSA (according to a given matrix and gap opening/extension cost)? It seems that Bio::SimpleAlign methods only work with score if it has been described
in MSA file and can only hold a general multiple sequence alignment score.<br clear="all">
<div><br>
-- <br>
<font face="arial,helvetica,sans-serif">Alexey Morozov,<br>
LIN SB RAS, bioinformatics group.<br>
Irkutsk, Russia.<br>
</font></div>
</div>
</blockquote>
<br>
</div>
</div></div><div>
<div>Bio::Align::PairwiseStatistics appears to deal with this, see if it fits your needs. You may need to extract the pairwise alignment of the two genes if they are in a multiple sequence alignment.</div>
<div><br>
</div>
<div>chris</div>
</div>
<div><br>
</div>
</div>
</blockquote></div><br><br clear="all"><br>-- <br><font face="arial,helvetica,sans-serif">Alexey Morozov,<br>LIN SB RAS, bioinformatics group.<br>Irkutsk, Russia.<br></font>
</div>