Commit 9fc4726b authored by Alessandro Vullo's avatar Alessandro Vullo
Browse files

Removed methods get_all_(Genes|Transcripts|Exons|Attributes) which weren't...

Removed methods get_all_(Genes|Transcripts|Exons|Attributes) which weren't doing the correct thing in case of slices and features spanning the origin of replication
parent 3693a3cb
......@@ -798,69 +798,6 @@ sub expand {
} ## end sub expand
=head2 get_all_Attributes
Arg [1] : optional string $attrib_code
The code of the attribute type to retrieve values for.
Example : ($htg_phase) = @{$slice->get_all_Attributes('htg_phase')};
@slice_attributes = @{$slice->get_all_Attributes()};
Description: Gets a list of Attributes of this slice''s seq_region.
Optionally just get Attrubutes for given code.
Returntype : listref Bio::EnsEMBL::Attribute
Exceptions : warning if slice does not have attached adaptor
Caller : general
Status : Stable
=cut
sub get_all_Attributes {
my $self = shift;
my $attrib_code = shift;
my $result;
my @results;
if ( !$self->adaptor() ) {
warning('Cannot get attributes without an adaptor.');
return [];
}
my $attribute_adaptor = $self->adaptor->db->get_AttributeAdaptor();
## circular BOF
my ($sl1, $sl2) = $self->_split;
my $pta_ref = [];
if ( defined $attrib_code ) {
my @res1 =
grep { uc( $_->code() ) eq uc($attrib_code) }
@{ $attribute_adaptor->fetch_all_by_Slice($sl1) };
my @res2 =
grep { uc( $_->code() ) eq uc($attrib_code) }
@{ $attribute_adaptor->fetch_all_by_Slice($sl2) };
my @res;
push @res, @res1, @res2;
$result = \@res;
} else {
my @res1 = @{ $attribute_adaptor->fetch_all_by_Slice($sl1) };
my @res2 = @{ $attribute_adaptor->fetch_all_by_Slice($sl2) };
my @res;
push @res, @res1, @res2;
$result = \@res;
}
## circular EOF
# if( defined $attrib_code ) {
# @results = grep { uc($_->code()) eq uc($attrib_code) }
# @{$attribute_adaptor->fetch_all_by_Slice( $self )};
# $result = \@results;
# } else {
# $result = $attribute_adaptor->fetch_all_by_Slice( $self );
# }
return $result;
} ## end sub get_all_Attributes
=head2 get_all_PredictionTranscripts
......@@ -1140,174 +1077,6 @@ sub get_all_genotyped_VariationFeatures {
}
=head2 get_all_Genes
Arg [1] : (optional) string $logic_name
The name of the analysis used to generate the genes to retrieve
Arg [2] : (optional) string $dbtype
The dbtype of genes to obtain. This assumes that the db has
been added to the DBAdaptor under this name (using the
DBConnection::add_db_adaptor method).
Arg [3] : (optional) boolean $load_transcripts
If set to true, transcripts will be loaded immediately rather
than being lazy-loaded on request. This will result in a
significant speed up if the Transcripts and Exons are going to
be used (but a slow down if they are not).
Arg [4] : (optional) string $source
The source of the genes to retrieve.
Arg [5] : (optional) string $biotype
The biotype of the genes to retrieve.
Example : @genes = @{$slice->get_all_Genes};
Description: Retrieves all genes that overlap this slice.
Returntype : listref of Bio::EnsEMBL::Genes
Exceptions : none
Caller : none
Status : Stable
=cut
sub get_all_Genes {
my ( $self, $logic_name, $dbtype, $load_transcripts, $source,
$biotype )
= @_;
if ( !$self->adaptor() ) {
warning('Cannot get Genes without attached adaptor');
return [];
}
my $ga;
if ($dbtype) {
my $db = $reg->get_db( $self->adaptor()->db(), $dbtype );
if ( defined($db) ) {
$ga = $reg->get_adaptor( $db->species(), $db->group(), "Gene" );
} else {
$ga = $reg->get_adaptor( $self->adaptor()->db()->species(),
$dbtype, "Gene" );
}
if ( !defined $ga ) {
warning("$dbtype genes not available");
return [];
}
} else {
$ga = $self->adaptor->db->get_GeneAdaptor();
}
## circular BOF
my ($sl1, $sl2) = $self->_split;
my ( @arr, @arr1, @arr2 );
@arr1 = @{
$ga->fetch_all_by_Slice( $sl1, $logic_name, $load_transcripts,
$source, $biotype ) };
@arr2 = @{
$ga->fetch_all_by_Slice( $sl2, $logic_name, $load_transcripts,
$source, $biotype ) };
push @arr, @arr1, @arr2;
return \@arr;
## circular EOF
} ## end sub get_all_Genes
=head2 get_all_Transcripts
Arg [1] : (optional) boolean $load_exons
If set to true exons will not be lazy-loaded but will instead
be loaded right away. This is faster if the exons are
actually going to be used right away.
Arg [2] : (optional) string $logic_name
the logic name of the type of features to obtain
Arg [3] : (optional) string $db_type
Example : @transcripts = @{$slice->get_all_Transcripts)_};
Description: Gets all transcripts which overlap this slice. If you want to
specify a particular analysis or type, then you are better off
using get_all_Genes or get_all_Genes_by_type and iterating
through the transcripts of each gene.
Returntype : reference to a list of Bio::EnsEMBL::Transcripts
Exceptions : none
Caller : general
Status : Stable
=cut
sub get_all_Transcripts {
my $self = shift;
my $load_exons = shift;
my $logic_name = shift;
my $dbtype = shift;
if ( !$self->adaptor() ) {
warning('Cannot get Transcripts without attached adaptor');
return [];
}
my $ta;
if ($dbtype) {
my $db = $reg->get_db( $self->adaptor()->db(), $dbtype );
if ( defined($db) ) {
$ta =
$reg->get_adaptor( $db->species(), $db->group(), "Transcript" );
} else {
$ta = $reg->get_adaptor( $self->adaptor()->db()->species(),
$dbtype, "Transcript" );
}
if ( !defined $ta ) {
warning("$dbtype genes not available");
return [];
}
} else {
$ta = $self->adaptor->db->get_TranscriptAdaptor();
}
## circular BOF
my ($sl1, $sl2) = $self->_split;
my ( @arr, @arr1, @arr2 );
@arr1 =
@{ $ta->fetch_all_by_Slice( $sl1, $load_exons, $logic_name ) };
@arr2 =
@{ $ta->fetch_all_by_Slice( $sl2, $load_exons, $logic_name ) };
push @arr, @arr1, @arr2;
return \@arr;
## circular EOF
} ## end sub get_all_Transcripts
=head2 get_all_Exons
Arg [1] : none
Example : @exons = @{$slice->get_all_Exons};
Description: Gets all exons which overlap this slice. Note that these exons
will not be associated with any transcripts, so this may not
be terribly useful.
Returntype : reference to a list of Bio::EnsEMBL::Exons
Exceptions : none
Caller : general
Status : Stable
=cut
sub get_all_Exons {
my $self = shift;
if ( !$self->adaptor() ) {
warning('Cannot get Exons without attached adaptor');
return [];
}
## circular BOF
my ($sl1, $sl2) = $self->_split;
my ( @arr, @arr1, @arr2 );
@arr1 =
@{ $sl1->adaptor->db->get_ExonAdaptor->fetch_all_by_Slice($sl1) };
@arr2 =
@{ $sl2->adaptor->db->get_ExonAdaptor->fetch_all_by_Slice($sl2) };
push @arr, @arr1, @arr2;
return \@arr;
## circular EOF
#rturn $self->adaptor->db->get_ExonAdaptor->fetch_all_by_Slice($self);
} ## end sub get_all_Exons
=head2 get_all_QtlFeatures
Args : none
......
......@@ -68,12 +68,6 @@ sub print_feature {
my @startcs = $self->_make_start_codon_features($transcript);
my @endcs = $self->_make_stop_codon_features($transcript);
my ($hasstart, $hasend) = $self->_check_start_and_stop($transcript);
#
# production does not use this option
#
# if (!$include_codons) {
# $hasstart = $hasend = 0;
# }
# TODO: ask Andy if this is safe
my $dbname = $transcript->adaptor()->dbc()->dbname();
......@@ -392,8 +386,7 @@ sub _check_start_and_stop {
return (0,0) unless defined $trans->translation;
my $tln = $trans->translation;
my $cds_seq = uc($trans->translateable_seq);
my $cds_seq = uc($trans->translateable_seq);
my $startseq = substr($cds_seq, 0, 3);
my $endseq = substr($cds_seq, -3);
......@@ -401,7 +394,7 @@ sub _check_start_and_stop {
my $has_start = 1;
my $has_end = 1;
# reimplemented because verterbrate specific
# reimplemented since there are alternatively valid codon tables
$has_start = 0 if ($startseq ne "ATG");
$has_end = 0 if ($endseq ne "TAG" && $endseq ne "TGA" && $endseq ne "TAA");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment