[Bioperl-l] PopGen
Richard Harrison
richard.harrison at edinburgh.ac.uk
Mon Jun 29 22:43:54 UTC 2009
Dear all,
I am having trouble with the PopGen modules and I was wondering if
anyone had any ideas.
I am working with polymorphism data. I am trying to identify the
derived vs ancestral allele between two species. I have been modifying
the modules a bit to include different site models etc. Here is where
I fall over:
Within aln_to_population I can create a modified Genotype object to
include details of the ancestral allele (see at end of this post).
However, the problem that I have hit upon is that aln_to_population
returns a population object, filled with IndividualI objects. In
other words, it takes my array of GenotypeI objects and converts them
into IndividualI objects, wrapped in a single Population object. This
means that the information in the GenotypeI object about the ancestral/
derived states is lost. How can I overcome this?
Thanks,
Richard
###excerpt from aln_to_population
$inds[$i]->add_Genotype(Bio::PopGen::Genotype->new
(-marker_name => $nm,
-individual_id=> $inds[$i]->unique_id,
-alleles => [$genotypes[$i]],
-outgroup => $outgroup[0]));
###excerpt from Genotypes.pm
sub new {
my($class, at args) = @_;
my $self = $class->SUPER::new(@args);
my ($name,$desc,$type,$uid,$af,$og) = $self->_rearrange([qw(NAME
DESCRIPTION
TYPE
UNIQUE_ID
ALLELE_FREQ
OUTGROUP)], at args);
$self->{'_allele_freqs'} = {};
$self->{'_outgroup_name'} = {};
if( ! defined $uid ) {
$uid = $UniqueCounter++;
}
if( defined $name) {
$self->name($name);
} else {
$self->throw("Must provide a name when initializing a Marker");
}
defined $desc && $self->description($desc);
defined $type && $self->type($type);
$self->outgroup_name($og);
$self->unique_id($uid);
return $self;
}
=head2 og
Title : name
Usage : my $name = $marker->og();
Function: Get the name of the outgroup
Returns : string representing the name of the marker
Args : [optional] name
=cut
sub outgroup_name{
my $self = shift;
return $self->{'_outgroup_name'} = shift if @_;
return $self->{'_outgroup_name'};
}
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
More information about the Bioperl-l
mailing list