Bio::EnsEMBL::ExternalData::Haplotype
Haplotype
Toolbar
Summary
HaplotypeAdaptor - DESCRIPTION of Object
This object represents a database of haplotypes.
Package variables
No package variables defined.
Included modules
Inherit
Synopsis
use Bio::EnsEMBL::DBSQL::DBAdaptor;
use Bio::EnsEMBL::ExternalData::Haplotype::HaplotypeAdaptor;
use Bio::EnsEMBL::ExternalData::Haplotype::Haplotype;
$hapdb = Bio::EnsEMBL::DBSQL::DBAdaptor->new(
-user => 'ensro',
-dbname => 'haplotype_5_28',
-host => 'ecs3d',
-driver => 'mysql',
);
my $hap_adtor = Bio::EnsEMBL::ExternalData::Haplotype::HaplotypeAdaptor->new($hapdb);
$hap = $hap_adtor->get_Haplotype_by_id('B10045'); # Haplotype id
### You can add the HaplotypeAdaptor as an 'external adaptor' to the 'main'
### Ensembl database object, then use it as:
$ensdb = Bio::EnsEMBL::DBSQL::DBAdaptor->new( ... );
$ensdb->add_ExternalAdaptor('haplotype', $hap_adtor);
# then later on, elsewhere:
$hap_adtor = $ensdb->get_ExternalAdaptor('haplotype');
# also available:
$ensdb->list_ExternalAdaptors();
$ensdb->remove_ExternalAdaptor('haplotype');
Description
This module is an entry point into a database of haplotypes,
The objects can only be read from the database, not written. (They are
loaded ussing a separate perl script).
For more info, see Haplotype.pm
Methods
Methods description
Title : _adaptor Usage : $adaptor = $hap->adaptor Function: find this objects\'s adaptor object (set by HaplotypeAdaptor) Example : Returns : Args : |
Title : chr_name Usage : Function: get/set the chr_name of the Haplotype Example : Returns : Args : |
Title : contig_id Usage : Function: get/set the contig id of the Haplotype Example : Returns : Args : |
Title : end Usage : Function: get/set the global (chromosomal) end of the Haplotype Example : Returns : Args : |
Title : id Usage : Function: get/set the display id of the Haplotype Example : Returns : Args : |
Title : local_end Usage : Function: get/set the local (contig) end of the Haplotype Example : Returns : Args : |
Title : local_start Usage : Function: get/set the local (contig) start of the Haplotype Example : Returns : Args : |
Title : new Usage : not intended for general use. Function: Example : Returns : a haplotype - caller has to fill using methods Args : |
Title : pattern Usage : Function: get/set the sorted list of patterns for this Haplotype consensus Example : Returns : Args :ref to a list of pattern objects (they will be sorted on order of size) |
Title : samples_count Usage : Function: store number of classified samples Example : Returns : Args : |
Title : snp_info Usage : Function: get snp_info for names SNP of the Haplotype Example : Returns : ref to hash of snp info Args : read only |
Title : snp_req Usage : Function: get/set the number of SNPs required to unambiguously this Haplotype pattern Example : Returns : Args : |
Title : snps Usage : Function: get/set the IDs of SNPs in this Haplotype pattern Example : Returns : ref to list of SNP IDs Args : ref to list of SNP IDs |
Title : start Usage : Function: get/set the global (chromosomal) start of the Haplotype Example : Returns : Args : |
Title : total_samples Usage : Function: store total_samples Example : Returns : Args : |
Title : unclassified_samples_count Usage : Function: store number of unclassified samples Example : Returns : Args : ref to a hash of sample=>patterns |
Methods code
sub adaptor
{
my ($self)= shift;
return $self->{'_adaptor'}; } |
sub chr_name
{ my ($self,$value) = @_;
if( defined $value) {
$self->{'chr_name'} = $value;
}
return $self->{'chr_name'}; } |
sub contig_id
{ my ($self,$value) = @_;
if( defined $value) {
$self->{'contig_id'} = $value;
}
return $self->{'contig_id'}; } |
sub end
{ my ($self,$value) = @_;
if( defined $value) {
$self->{'end'} = $value;
}
return $self->{'end'}; } |
sub fetchSNPs
{ my ($self) = @_;
return $self->adaptor->fetchSNPs( $self->id );
}
1; } |
sub id
{ my ($self,$value) = @_;
if( defined $value) {
$self->{'id'} = $value;
}
return $self->{'id'}; } |
sub local_end
{ my ($self,$value) = @_;
if( defined $value) {
$self->{'local_end'} = $value;
}
unless ($self->{'local_end'}){
my $id = $self->id();
my $q = qq(
select last_reference_position from block
where block_id = "$id"
);
my $sth = $self->adaptor->prepare($q);
$sth->execute();
($self->{'local_end'}) = $sth->fetchrow_array()
}
return $self->{'local_end'}; } |
sub local_start
{ my ($self,$value) = @_;
if( defined $value) {
$self->{'local_start'} = $value;
}
unless ($self->{'local_start'}){
my $id = $self->id();
my $q = qq(
select first_reference_position from block
where block_id = "$id"
);
my $sth = $self->adaptor->prepare($q);
$sth->execute();
($self->{'local_start'}) = $sth->fetchrow_array()
}
return $self->{'local_start'}; } |
sub new
{
my ($class, $adaptor) = @_;
my $self = {'_adaptor' => $adaptor};
bless $self,$class;
$self; } |
sub patterns
{
my ($self,$value) = @_;
if( defined $value) {
$self->{'patterns'} = $value;
}
my @pats = reverse sort { $a->count <=> $b->count } @{$self->{'patterns'}};
return(\@pats); } |
sub samples_count
{ my ($self,$value) = @_;
if( defined $value) {
$self->{'samples_count'} = $value;
}
return $self->{'samples_count'} ||= 0; } |
sub snp_info
{ my ($self,$value) = @_;
unless ($self->{'snp_info'}->{$value}){
my $q = qq(
select
position,ref_base,alt_base,ref_calls,mut_calls
from
polymorphism
where
polymorphism_id = "$value"
);
my $sth = $self->adaptor->prepare($q);
$sth->execute();
$self->{'snp_info'}->{$value} = $sth->fetchrow_hashref()
}
return $self->{'snp_info'}->{$value}; } |
sub snp_req
{ my ($self,$value) = @_;
if( defined $value) {
$self->{'snp_req'} = $value;
}
return $self->{'snp_req'}; } |
sub snps
{ my ($self,$value) = @_;
if( defined $value) {
$self->{'snps'} = $value;
}
return $self->{'snps'}; } |
sub start
{ my ($self,$value) = @_;
if( defined $value) {
$self->{'start'} = $value;
}
return $self->{'start'}; } |
sub total_samples
{ my ($self,$value) = @_;
if( defined $value) {
$self->{'total_samples'} = $value;
}
return $self->{'total_samples'} ||= 0; } |
sub unclassified_samples_count
{ my ($self,$value) = @_;
if( defined $value) {
$self->{'unclassified_samples_count'} = $value;
}
return $self->{'unclassified_samples_count'} ||= 0; } |
General documentation
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _