Commit a7f99bd9 authored by Marek Szuba's avatar Marek Szuba
Browse files

Transcript: get_all_RNAProducts() now uses type codes instead of IDs

parent 5b7fb4a1
......@@ -3005,13 +3005,11 @@ sub get_all_DAS_Features {
=head2 get_all_RNAProducts
Arg [1] : optional int $type_id
The numerical ID of the rnaproduct type to retrieve values for.
FIXME: this should definitely take string codes instead.
Example : @transc_mirnas = @{$transcript->get_all_RNAProducts(1)};
Arg [1] : optional string $type_code type of rnaproducts to retrieve
Example : @transc_mirnas = @{$transcript->get_all_RNAProducts('miRNA')};
@transc_rnaproducts = @{$transcript->get_all_RNAProducts()};
Description: Gets a list of RNAProducts of this transcript.
Optionally just get RNAProducts for given type ID.
Optionally just get RNAProducts for given type code.
Returntype : listref Bio::EnsEMBL::RNAProduct
Exceptions : none
Caller : general
......@@ -3020,7 +3018,7 @@ sub get_all_DAS_Features {
=cut
sub get_all_RNAProducts {
my ($self, $type_id) = @_;
my ($self, $type_code) = @_;
if (!exists $self->{'rnaproducts'}) {
if (!$self->adaptor()) {
......@@ -3031,8 +3029,8 @@ sub get_all_RNAProducts {
$self->{'rnaproducts'} = $rnaproduct_adaptor->fetch_all_by_Transcript($self);
}
if (defined $type_id) {
my @results = grep { $_->type_id() == $type_id } @{$self->{'rnaproducts'}};
if (defined $type_code) {
my @results = grep { $_->type_code() eq $type_code } @{$self->{'rnaproducts'}};
return \@results;
} else {
return $self->{'rnaproducts'};
......
......@@ -1032,8 +1032,8 @@ for (my $i = 0; $i < scalar(@absolute_coords); $i++) {
{
$tr = $ta->fetch_by_stable_id('ENST00000278995');
my $rps_all = $tr->get_all_RNAProducts();
my $rps_micro = $tr->get_all_RNAProducts(2);
my $rps_circ = $tr->get_all_RNAProducts(3);
my $rps_micro = $tr->get_all_RNAProducts('miRNA');
my $rps_circ = $tr->get_all_RNAProducts('circRNA');
cmp_ok(scalar @{$rps_all}, '>', 0, 'Have RNA products');
is_deeply($rps_all, $rps_micro, 'All RNA products are microRNAs');
......
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