Bio::EnsEMBL::Variation
IndividualGenotype
Toolbar
Summary
Bio::EnsEMBL::Variation::IndividualGenotype- Module representing the genotype
of a single individual at a single position
Package variables
No package variables defined.
Included modules
Inherit
Synopsis
print $genotype->variation()->name(), "\n";
print $genotype->allele1(), '/', $genotype->allele2(), "\n";
print $genotype->individual()->name(), "\n";
Description
This is a class representing the genotype of a single diploid individual at
a specific position
Methods
Methods description
Arg [1] : (optional) Bio::EnsEMBL::Variation::Individual $ind Example : $ind = $ind_genotype->individual(); Description: Getter/Setter for the individual associated with this genotype Returntype : Bio::EnsEMBL::Variation::Individual Exceptions : throw on bad argument Caller : general Status : At Risk |
Arg [-adaptor] : Bio::EnsEMBL::Variation::DBSQL::IndividualAdaptor Arg [-START] : see superclass constructor Arg [-END] : see superclass constructor Arg [-STRAND] : see superclass constructor Arg [-SLICE] : see superclass constructor Arg [-allele1] : string - One of the two alleles defining this genotype Arg [-allele2] : string - One of the two alleles defining this genotype Arg [-variation] : Bio::EnsEMBL::Variation::Variation - The variation associated with this genotype Arg [-individual] : Bio::EnsEMBL::Individual - The individual this genotype is for. Example : $ind_genotype = Bio:EnsEMBL::Variation::IndividualGenotype->new (-start => 100, -end => 100, -strand => 1, -slice => $slice, -allele1 => 'A', -allele2 => 'T', -variation => $variation, -individual => $ind); Description: Constructor. Instantiates an IndividualGenotype object. Returntype : Bio::EnsEMBL::Variation::IndividualGenotype Exceptions : throw on bad argument Caller : general Status : At Risk |
Arg [1] : (optional) Bio::EnsEMBL::Variation::Variation $var Example : $var = $genotype->variation(); Description: Getter/Setter for the Variation as Returntype : Bio::EnsEMBL::Variation::Variation Exceptions : throw on bad argument Caller : general Status : At Risk |
Methods code
sub individual
{ my $self = shift;
if(@_) {
my $ind = shift;
if(defined($ind) &&
(!ref($ind) || !$ind->isa('Bio::EnsEMBL::Variation::Individual'))) {
throw('Bio::EnsEMBL::Variation::Individual argument expected');
}
return $self->{'individual'} = $ind;
}
return $self->{'individual'}; } |
sub new
{ my $caller = shift;
my $class = ref($caller) || $caller;
my $self = $class->SUPER::new(@_);
my ($adaptor, $allele1, $allele2, $var, $ind) =
rearrange([qw(adaptor allele1 allele2 variation individual)],@_);
if(defined($var) &&
(!ref($var) || !$var->isa('Bio::EnsEMBL::Variation::Variation'))) {
throw("Bio::EnsEMBL::Variation::Variation argument expected");
}
if(defined($ind) &&
(!ref($ind) || !$ind->isa('Bio::EnsEMBL::Variation::Individual'))) {
throw("Bio::EnsEMBL::Variation::Individual argument expected");
}
$self->{'adaptor'} = $adaptor;
$self->{'allele1'} = $allele1;
$self->{'allele2'} = $allele2;
$self->{'individual'} = $ind;
$self->{'variation'} = $var;
return $self; } |
sub new_fast
{ my $class = shift;
my $hashref = shift;
return bless $hashref, $class; } |
sub variation
{ my $self = shift;
if(@_) {
my $v = shift;
if(defined($v) &&
(!ref($v) || !$v->isa('Bio::EnsEMBL::Variation::Variation'))) {
throw('Bio::EnsEMBL::Variation::Variation argument expected.');
}
$self->{'variation'} = $v;
}
else{
if(!defined($self->{'variation'}) && $self->{'adaptor'}) {
my $vfa = $self->{'adaptor'}->db()->get_VariationFeatureAdaptor();
%{$vfa->{'_slice_feature_cache'}} = (); my $vf = shift @{$vfa->fetch_all_by_Slice($self->feature_Slice())};
$self->{'variation'} = $vf->variation;
}
}
return $self->{'variation'};
}
1; } |
General documentation