Skip to content

Commit

Permalink
pairwise_dnds: fix too low values of dn/ds due to zero values (issue #24
Browse files Browse the repository at this point in the history
)

When the sequences were the same, both dN and dS would be zero and dn/ds
ratio would be 99.  The 99 value would shift the mean dn/ds value which
would become too high.
  • Loading branch information
carandraug committed Dec 13, 2015
1 parent 907ac2f commit 2576eae
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions scripts/pairwise_dnds.pl
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,16 @@ sub get_dNdS_stats
{
for my $j (($i +1) .. ($n_seqs -1))
{
push @{$stats->{'dN'}}, $MLmatrix->[$i]->[$j]->{'dN'};
push @{$stats->{'dS'}}, $MLmatrix->[$i]->[$j]->{'dS'};
my $dn = $MLmatrix->[$i]->[$j]->{'dN'};
my $ds = $MLmatrix->[$i]->[$j]->{'dS'};

## Some sequences are exactly the same and will have a dN and
## dS of zero, which then takes a dn/ds of 99. This is all
## non-sense so we just skip those cases. See issue #23
next if $dn == 0 && $ds == 0;

push @{$stats->{'dN'}}, $dn;
push @{$stats->{'dS'}}, $ds;
push @{$stats->{'omega'}}, $MLmatrix->[$i]->[$j]->{'omega'};
# say join("\t", $otus[$i]->display_id,
# $otus[$j]->display_id,
Expand Down

0 comments on commit 2576eae

Please sign in to comment.