[Bioperl-l] PopGen Question
Jason Stajich
jason.stajich at gmail.com
Fri Mar 22 02:19:23 EDT 2013
Once you convert it into the population object ($pop1) you can iterate through the markers and request the allele frequency from each of these.
http://doc.bioperl.org/releases/bioperl-current/bioperl-live/Bio/PopGen/Population.html
http://doc.bioperl.org/releases/bioperl-current/bioperl-live/Bio/PopGen/MarkerI.html
for my $name ( $population->get_marker_names ) {
my $marker = $population->get_Marker($name);
print "marker $marker\n";
my %af = $marker->get_Allele_Frequencies;
foreach my $allele ( keys %af ) {
print "$allele $af{$allele}\n";
}
}
unfortunately the wiki code seems to be messed up for autolinking out to the pdoc documentation so some of the links on the bioperl website don't get properly made. something to be fixed I hope.
Jason
On Mar 15, 2013, at 9:21 AM, Michael Hague <mhague at mail.sfsu.edu> wrote:
> Hello,
> I'm trying to calculate some diversity statistics for an aligned dataset in BioPerl. My aligned dataset is a fasta file. I've been able to import the file and calculate Tajima's D and theta using the following script:
>
>
> use Bio::AlignIO;
> use Bio::PopGen::Utilities;
> use Bio::PopGen::Statistics;
> use Bio::PopGen::Population;
>
> my $io1 = Bio::AlignIO->new(-file => 'Callisaurus_cytb_final.fas',
> -format => 'fasta');
> my $aln1 = $io1->next_aln;
>
>
> my $pop1 = Bio::PopGen::Utilities->aln_to_population(-alignment => $aln1,
> -include_monomorphic => 1);
>
> my $stats1 = Bio::PopGen::Statistics->new();
> my $D1 = $stats1->tajima_D($pop1);
> my $theta1 = $stats1->theta($pop1);
> my $segsites1 = $stats1->segregating_sites_count($pop1);
>
> print "\nPopulation #1:\n";
> print "Number of segregating sites = $segsites1\n";
> print "Tajima\'s D = $D1\n";
> print "Watterson\'s theta = $theta1\n\n";
>
> However, I would like to also calculate haplotype diversity. To the best of my knowledge, I haven't found a BioPerl module that explicitly calculate haplotype diversity. Is there a relatively simple way to do this in BioPerl? I haven't even found a way to count allele frequencies from my alignment file. It that possible in BioPerl?
>
> Thanks so much for the help,
> Mike
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l
Jason Stajich
jason.stajich at gmail.com
jason at bioperl.org
More information about the Bioperl-l
mailing list