Bio::PopGen Marker
SummaryIncluded librariesPackage variablesSynopsisDescriptionGeneral documentationMethods
Summary
Bio::PopGen::Marker - A genetic marker which one uses to generate genotypes
Package variables
No package variables defined.
Included modules
Bio::PopGen::MarkerI
Bio::Root::Root
Inherit
Bio::PopGen::MarkerI Bio::Root::Root
Synopsis
  my $name = $marker->name();            # marker name
  my $description = $marker->description(); # description
  my $type = $marker->type();            # coded type of the marker
  my $unique_id = $marker->unique_id;    # optional unique ID
  my @alleles = $marker->get_Alleles();  # the known alleles
  my %allele_freqs = $marker->get_Allele_Frequencies(); # keys are marker names
                                         # vals are frequencies
                                         # may change to handle multiple populations
Description
This object will not contain genotype information pertaining to an
individual, but rather population level statistics and descriptive
information about a marker.
Methods
newDescriptionCode
nameDescriptionCode
descriptionDescriptionCode
typeDescriptionCode
unique_idDescriptionCode
get_AllelesDescriptionCode
get_Allele_FrequenciesDescriptionCode
add_Allele_FrequencyDescriptionCode
reset_allelesDescriptionCode
Methods description
newcode    nextTop
 Title   : new
 Usage   : my $obj = new Bio::PopGen::Marker();
 Function: Builds a new Bio::PopGen::Marker object 
 Returns : an instance of Bio::PopGen::Marker
 Args    : -name          => [string] marker name
           -description   => [string] marker description
           -type          => [string] marker type
           -unique_id     => [string/int] unique id
           -allele_freq   => [hash ref] allele frequencies
namecodeprevnextTop
 Title   : name
 Usage   : my $name = $marker->name();
 Function: Get the name of the marker
 Returns : string representing the name of the marker
 Args    : [optional] name
descriptioncodeprevnextTop
 Title   : description
 Usage   : my $desc = $marker->description
 Function: Get the marker description free text
 Returns : string
 Args    : [optional] string
typecodeprevnextTop
 Title   : type
 Usage   : my $type = $marker->type;
 Function: Get coded string for marker type
 Returns : string
 Args    : [optional] string
unique_idcodeprevnextTop
 Title   : unique_id
 Usage   : my $id = $marker->unique_id;
 Function: Get the unique marker ID
 Returns : unique ID string
 Args    : [optional ] string
get_AllelescodeprevnextTop
 Title   : get_Alleles
 Usage   : my @alleles = $marker->get_Alleles();
 Function: Get the available marker alleles
 Returns : Array of strings
 Args    : none
get_Allele_FrequenciescodeprevnextTop
 Title   : get_Allele_Frequencies
 Usage   : my %allele_freqs = $marker->get_Allele_Frequencies;
 Function: Get the alleles and their frequency (set relative to
           a given population - you may want to create different
           markers with the same name for different populations
           with this current implementation
 Returns : Associative array where keys are the names of the alleles
 Args    : none
add_Allele_FrequencycodeprevnextTop
 Title   : add_Allele_Frequency
 Usage   : $marker->add_Allele_Frequency($allele,$freq)
 Function: Adds an allele frequency
 Returns : None
 Args    : $allele - allele name
           $freq   - frequency value
reset_allelescodeprevnextTop
 Title   : reset_alleles
 Usage   : $marker->reset_alleles();
 Function: Reset the alleles for a marker
 Returns : None
 Args    : None
Methods code
newdescriptionprevnextTop
sub new {
  my($class,@args) = @_;

  my $self = $class->SUPER::new(@args);
  my ($name,$desc,$type,$uid,$af) = $self->_rearrange([qw(NAME
							  DESCRIPTION
							  TYPE
							  UNIQUE_ID
							  ALLELE_FREQ)],@args);
  $self->{'_allele_freqs'} = {};
  if( ! defined $uid ) {
      $uid = $UniqueCounter++;
  }
  if( defined $name) {
      $self->name($name);
  } else { 
      $self->throw("Must have provided a name when initializing a Marker");
  }
  defined $desc && $self->description($desc);
  defined $type && $self->type($type);
  $self->unique_id($uid);
  if( defined $af) {
      if( ref($af) !~ /HASH/i ) {
	  $self->warn("Must provide valid Hash reference for allele_freq method");
      } else { 
	  foreach my $allele ( keys %$af ) {
	      $self->add_Allele_Frequency($allele, $af->{$allele});
	  }
      }
  }
  return $self;
}
namedescriptionprevnextTop
sub name {
    my $self = shift;

    return $self->{'_name'} = shift if @_;
    return $self->{'_name'};
}
descriptiondescriptionprevnextTop
sub description {
    my $self = shift;

    return $self->{'_description'} = shift if @_;
    return $self->{'_description'};
}
typedescriptionprevnextTop
sub type {
    my $self = shift;

    return $self->{'_type'} = shift if @_;
    return $self->{'_type'};
}
unique_iddescriptionprevnextTop
sub unique_id {
    my $self = shift;

    return $self->{'_uniqueid'} = shift if @_;
    return $self->{'_uniqueid'};
}
get_AllelesdescriptionprevnextTop
sub get_Alleles {
    my $self = shift;
    my (@numeric,@alpha);
    
    for ( keys %{$self->{'_allele_freqs'}} ) {
	if( /[^\d\.\-e]/ ) { push @alpha, $_ }
	else { push @numeric, $_ }
    }
    @numeric = sort { $b <=> $a } @numeric;
    @alpha   = sort { $b cmp $a } @alpha;
    return @numeric,@alpha;
}
get_Allele_FrequenciesdescriptionprevnextTop
sub get_Allele_Frequencies {
   return %{$_[0]->{'_allele_freqs'}};
}
add_Allele_FrequencydescriptionprevnextTop
sub add_Allele_Frequency {
   my ($self,$allele,$freq) = @_;
   $self->{'_allele_freqs'}->{$allele} = $freq;
}
reset_allelesdescriptionprevnextTop
sub reset_alleles {
   my ($self) = @_;
   $self->{'_allele_freqs'} = {};
}
General documentation
FEEDBACKTop
Mailing ListsTop
User feedback is an integral part of the evolution of this and other
Bioperl modules. Send your comments and suggestions preferably to
the Bioperl mailing list. Your participation is much appreciated.
  bioperl-l@bioperl.org              - General discussion
  http://bioperl.org/MailList.shtml  - About the mailing lists
Reporting BugsTop
Report bugs to the Bioperl bug tracking system to help us keep track
of the bugs and their resolution. Bug reports can be submitted via
the web:
  http://bugzilla.bioperl.org/
AUTHOR - Jason StajichTop
Email jason-at-bioperl.org
CONTRIBUTORSTop
Matthew Hahn, matthew.hahn-at-duke.edu
APPENDIXTop
The rest of the documentation details each of the object methods.
Internal methods are usually preceded with a _