Skip to content
Snippets Groups Projects
Commit 6e8184f5 authored by Marek Szuba's avatar Marek Szuba
Browse files

RNAProductAdaptor: use rnaproduct_type_id to determine class of returned object(s)

At the moment we support microRNA (Bio::EnsEMBL::MicroRNA) and generic
RNA product (Bio::EnsEMBL::RNAProduct). Any other type value will
trigger an exception.
parent b197b00b
No related branches found
No related tags found
2 merge requests!371Add support for mature RNA products of transcripts (e.g. MicroRNA) to the API and schema,!371Add support for mature RNA products of transcripts (e.g. MicroRNA) to the API and schema
......@@ -67,6 +67,7 @@ use strict;
use warnings;
use Bio::EnsEMBL::DBSQL::BaseAdaptor;
use Bio::EnsEMBL::MicroRNA;
use Bio::EnsEMBL::RNAProduct;
use Bio::EnsEMBL::Utils::Exception qw( throw warning );
use Bio::EnsEMBL::Utils::Scalar qw( assert_ref );
......@@ -294,7 +295,7 @@ SQL
# to be handed directly to users because in its current form
# it can be trivially exploited to inject arbitrary SQL.
# Returntype : ArrayRef of either Bio::EnsEMBL::RNAProducts or undefs
# Exceptions : none
# Exceptions : throws if rnaproduct type is absent or unknown
# Caller : internal
# Status : At Risk (In Development)
......@@ -329,8 +330,16 @@ sub _fetch_direct_query {
next;
}
my $rnaproduct =
Bio::EnsEMBL::RNAProduct->new_fast( {
my $class_name;
# FIXME: the usual thing about using type_id directly
if ($rnaproduct_type_id == 0) {
$class_name = 'Bio::EnsEMBL::RNAProduct';
} elsif ($rnaproduct_type_id == 1) {
$class_name = 'Bio::EnsEMBL::MicroRNA';
} else {
throw("Unknown rnaproduct type");
}
my $rnaproduct = $class_name->new_fast( {
'dbID' => $rnaproduct_id,
'type_id' => $rnaproduct_type_id,
'adaptor' => $self,
......
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