Bio::EnsEMBL::Compara::Production
DnaFragChunkSet
Toolbar
Summary
Bio::EnsEMBL::Compara::Production::DnaFragChunkSet
Package variables
No package variables defined.
Included modules
Time::HiRes qw ( time gettimeofday tv_interval )
Synopsis
Description
An object to hold a set or group of DnaFragChunk objects. Used in production to reduce
overhead of feeding sequences into alignment programs like blastz and exonerate.
Methods
Methods description
Title : adaptor Usage : Function: getter/setter of the adaptor for this object Example : Returns : Args : |
Arg [1] : $chunk_id Example : Description: Returntype : Exceptions : Caller : |
Example : $count = $chunkSet->count; Description: returns count of DnaFragChunks in this set Returntype : int Exceptions : Caller : |
Arg [1] : int $dbID (optional) Example : Description: Returntype : Exceptions : Caller : |
Arg [1] : string $description (optional) Example : Description: Returntype : string Exceptions : Caller : |
Example : @chunk_ids = @{$chunkSet->dnafrag_chunk_ids}; Description: Returntype : reference to array of dnafrag_chunk_id Exceptions : Caller : |
Arg [1] : string $dump_loc (optional) Example : Description: Returntype : string Exceptions : Caller : |
Example : @chunks = @{$chunkSet->get_all_DnaFragChunks}; Description: returns array reference to all the DnaFragChunk objects in this set will lazy load the set if it was not previously loaded Returntype : reference to array of Bio::EnsEMBL::Compara::Production::DnaFragChunk objects Exceptions : Caller : |
Example : $size = $chunkSet->total_basepairs; Description: returns summed length of all DnaFragChunks in this set Returntype : int Exceptions : Caller : |
Methods code
sub adaptor
{ my $self = shift;
$self->{'_adaptor'} = shift if(@_);
return $self->{'_adaptor'}; } |
sub add_DnaFragChunk
{ my ($self, $chunk) = @_;
unless(defined($chunk) and
$chunk->isa('Bio::EnsEMBL::Compara::Production::DnaFragChunk'))
{
$self->throw(
"chunk arg must be a [Bio::EnsEMBL::Compara::Production::DnaFragChunk] ".
"not a [$chunk]");
}
my $count = $self->add_dnafrag_chunk_id($chunk->dbID);
$self->{'_cached_chunk_list'} = []
unless(defined($self->{'_cached_chunk_list'}));
push @{$self->{'_cached_chunk_list'}}, $chunk;
return $count; } |
sub add_dnafrag_chunk_id
{ my $self = shift;
my $count=0;
if(@_) {
my $chunk_id = shift;
$count = push @{$self->{'_dnafrag_chunk_id_list'}}, $chunk_id;
$self->{'_total_basepairs'}=0; if(defined($self->adaptor)) {
$self->adaptor->store_link($self->dbID, $chunk_id);
}
}
return $count } |
sub count
{ my $self = shift;
return scalar(@{$self->dnafrag_chunk_ids()}); } |
sub dbID
{ my $self = shift;
$self->{'_dbID'} = shift if(@_);
return $self->{'_dbID'}; } |
sub description
{ my $self = shift;
$self->{'_description'} = shift if(@_);
return $self->{'_description'}; } |
sub dnafrag_chunk_ids
{ my $self = shift;
return $self->{'_dnafrag_chunk_id_list'}; } |
sub dump_loc
{ my $self = shift;
$self->{'_dump_loc'} = shift if(@_);
return $self->{'_dump_loc'}; } |
sub get_all_DnaFragChunks
{ my $self = shift;
if(!defined($self->{'_cached_chunk_list'}) and
$self->count > 0 and defined($self->adaptor))
{
$self->{'_cached_chunk_list'} =
$self->adaptor->_fetch_all_DnaFragChunk_by_ids($self->dnafrag_chunk_ids);
$self->{'_total_basepairs'}=0; }
return $self->{'_cached_chunk_list'}; } |
sub new
{ my ($class, @args) = @_;
my $self = {};
bless $self,$class;
$self->{'_dnafrag_chunk_id_list'} = [];
$self->{'_cached_chunk_list'} = undef;
$self->{'_total_basepairs'} = 0;
if (scalar @args) {
my ($dbid, $description, $adaptor) = rearrange([qw(DBID NAME ADAPTOR)], @args);
$self->dbID($dbid) if($dbid);
$self->description($description) if($description);
$self->adaptor($adaptor) if($adaptor);
}
return $self; } |
sub total_basepairs
{ my $self = shift;
unless($self->{'_total_basepairs'}) {
$self->{'_total_basepairs'} =0;
if($self->get_all_DnaFragChunks) {
foreach my $chunk (@{$self->get_all_DnaFragChunks}) {
$self->{'_total_basepairs'} += $chunk->length;
}
}
}
return $self->{'_total_basepairs'};
}
1; } |
General documentation
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _