1
# $Id: PopulationI.pm,v 1.6 2003/07/29 02:53:06 jason Exp $
3
# BioPerl module for Bio::PopGen::PopulationI
5
# Cared for by Jason Stajich <jason@bioperl.org>
7
# Copyright Jason Stajich
9
# You may distribute this module under the same terms as perl itself
11
# POD documentation - main docs before the code
15
Bio::PopGen::PopulationI - Interface for Populations
19
# Get Bio::PopGen::PopulationI object somehow, like
20
# from Bio::Population::Population
22
print "name is ", $population->name(), "\n";
23
print "source is ", $population->source(), "\n";
24
print "description is ", $population->description(), "\n";
26
print "For marker $markername:\n";
27
foreach my $genotype ( $population->get_Genotypes(-marker => $markername) ) {
28
print "Individual ", $genotype->individual_id, " genotype alleles are ",
29
join(',', $genotype->get_Alleles()), "\n";
31
# get a marker with allele frequencies calculated from the population
32
my $marker = $population->get_Marker($markername);
33
my %af = $marker->get_Allele_Frequencies;
34
foreach my $allele ( keys %af ) {
35
print "$allele $af{$allele}\n";
40
This interface describes the basics of a population. One can use this
41
object to get the genotypes of specific individuals, only those
42
individuals which have a certain marker, or create a marker with
43
allele frequency information.
49
User feedback is an integral part of the evolution of this and other
50
Bioperl modules. Send your comments and suggestions preferably to the
51
Bioperl mailing list. Your participation is much appreciated.
53
bioperl-l@bioperl.org - General discussion
54
http://bioperl.org/MailList.shtml - About the mailing lists
58
Report bugs to the Bioperl bug tracking system to help us keep track
59
of the bugs and their resolution. Bug reports can be submitted via
62
http://bugzilla.bioperl.org/
64
=head1 AUTHOR - Jason Stajich
66
Email jason-at-bioperl.org
70
Matthew Hahn, matthew.hahn-at-duke.edu
74
The rest of the documentation details each of the object methods.
75
Internal methods are usually preceded with a _
80
# Let the code begin...
83
package Bio::PopGen::PopulationI;
89
@ISA = qw( Bio::Root::RootI );
94
Usage : my $name = $pop->name
95
Function: Get the population name
96
Returns : string representing population name
97
Args : [optional] string representing population name
103
my ($self,@args) = @_;
104
$self->throw_not_implemented();
112
Usage : my $description = $pop->description
113
Function: Get the population description
114
Returns : string representing population description
115
Args : [optional] string representing population description
121
my ($self,@args) = @_;
122
$self->throw_not_implemented();
128
Usage : my $source = $pop->source
129
Function: Get the population source
130
Returns : string representing population source
131
Args : [optional] string representing population source
137
my ($self,@args) = @_;
138
$self->throw_not_implemented();
141
=head2 get_Individuals
143
Title : get_Individuals
144
Usage : my @inds = $pop->get_Individuals();
145
Function: Return the individuals, alternatively restrict by a criteria
146
Returns : Array of L<Bio::PopGen::IndividualI> objects
147
Args : none if want all the individuals OR,
148
-unique_id => To get an individual with a specific id
149
-marker => To only get individuals which have a genotype specific
150
for a specific marker name
156
shift->throw_not_implemented();
161
Title : get_Genotypes
162
Usage : my @genotypes = $pop->get_Genotypes(-marker => $name)
163
Function: Get the genotypes for all the individuals for a specific
165
Returns : Array of L<Bio::PopGen::GenotypeI> objects
166
Args : -marker => name of the marker
172
shift->throw_not_implemented;
178
Usage : my $marker = $population->get_Marker($name)
179
Function: Get a Bio::PopGen::Marker object based on this population
180
Returns : L<Bio::PopGen::MarkerI> object
181
Args : name of the marker
187
shift->throw_not_implemented();
190
=head2 get_marker_names
192
Title : get_marker_names
193
Usage : my @names = $pop->get_marker_names;
194
Function: Get the names of the markers
195
Returns : Array of strings
201
sub get_marker_names{
203
$self->throw_not_implemented();
209
Usage : my @markers = $pop->get_Markers();
210
Function: Will retrieve a list of instantiated MarkerI objects
211
for a population. This is a convience method combining
212
get_marker_names with get_Marker
213
Returns : List of array of Bio::PopGen::MarkerI objects
221
return map { $self->get_Marker($_) } $self->get_marker_names();
225
=head2 number_individuals
227
Title : number_individuals
228
Usage : my $count = $pop->number_individuals;
229
Function: Get the count of the number of individuals
230
Returns : integer >= 0
231
Args : [optional] marker name, will return a count of the number
232
of individuals which have this marker
237
sub get_number_individuals{
239
$self->throw_not_implemented();