Skip to content

Commit

Permalink
Fixed codons ambiguity
Browse files Browse the repository at this point in the history
  • Loading branch information
fgvieira committed Oct 25, 2011
1 parent 8cca79d commit 9206fcf
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Bio/PopGen/Utilities.pm
Expand Up @@ -195,8 +195,8 @@ sub aln_to_population{
# slicing vertically
for my $seq ( @seqs ) {
my $site = uc(substr($seq,$i,1));
$set{$site}++;
push @genotypes, $ambig_code{$site};
$set{$site}++;
}
if( keys %set > 1 || $includefixed ) {
my $genoct = scalar @genotypes;
Expand All @@ -217,7 +217,7 @@ sub aln_to_population{
}
my $codonct = 0;
for( my $i = $phase; $i < $alength; $i += CodonLen ) {
my (@genotypes,%set,$genoct);
my (@unambig_site,@genotypes,%set,$genoct);

for my $seq ( @seqs ) {
my $site = uc(substr($seq,$i,CodonLen));
Expand All @@ -227,8 +227,13 @@ sub aln_to_population{
next;
}
# do we check for gaps/indels here?
$set{$site}++;
push @genotypes, $ambig_code{$site};
for (my $pos=1; $pos<=CodonLen; $pos++)
{
$unambig_site[0] .= $ambig_code{substr($site, $pos, 1)}[0];
$unambig_site[1] .= $ambig_code{substr($site, $pos, 1)}[1];
}
push @genotypes, \@unambig_site;
$set{$site}++;
}
$genoct = scalar @genotypes;

Expand Down

0 comments on commit 9206fcf

Please sign in to comment.