Skip to content
Snippets Groups Projects
Commit af79604d authored by premanand17's avatar premanand17
Browse files

Updated POD for fetch_all_by_Transcript, updated test and test data

parent 03e92fd4
No related branches found
No related tags found
2 merge requests!147Updated fetch_all_by_Transcript method to optionally filter by featur…,!147Updated fetch_all_by_Transcript method to optionally filter by featur…
......@@ -63,12 +63,15 @@ use vars qw(@ISA);
Arg [1] : Bio::EnsEMBL::Transcript $transcript
The transcript to fetch supporting features for
Arg [2] : String (optional)
Feature type to filter upon (either 'dna_align_feature' or 'protein_align_feature')
Example : @sfs = @{$supporting_feat_adaptor->fetch_all_by_Transcript($transcript)};
@sfs = @{$supporting_feat_adaptor->fetch_all_by_Transcript($transcript, $feature_type)};
Description: Retrieves supporting features (evidence) for a given transcript.
Returntype : list of Bio::EnsEMBL::BaseAlignFeatures in the same coordinate
system as the $transcript argument
Exceptions : warning if $transcript is not in the database (i.e. dbID not defined)
throw if a retrieved supporting feature is of unknown type
throw if a retrieved or requested supporting feature is of unknown type
Caller : Bio::EnsEMBL::Transcript
Status : Stable
......@@ -117,19 +120,18 @@ sub fetch_all_by_Transcript {
push @{$out_feature_type->{$type}}, $new_feature if ($new_feature);
}
}
$sth->finish();
if(defined $feature_type){
return $out_feature_type->{$feature_type};
}else{
}
$sth->finish();
while(my ($feature_type, $new_features) = each(%$out_feature_type)){
push @$out, @{$new_features};
if(defined $feature_type){
return $out_feature_type->{$feature_type};
}else{
while(my ($feature_type, $new_features) = each(%$out_feature_type)){
push @$out, @{$new_features};
}
}
}
return $out;
}
......
......@@ -23,4 +23,5 @@
21738 18273 1282 469283 31166507 31196939 1 97759 ensembl protein_coding KNOWN \N 1 21738 ENST00000217347 1 2004-12-06 12:00:00 2004-12-06 12:00:00
21739 18274 1282 469283 31210077 31225346 1 0 ensembl protein_coding NOVEL \N 1 21739 ENST00000300425 1 2004-12-06 12:00:00 2004-12-06 12:00:00
21740 18275 1282 965899 10060 10405 1 0 ensembl protein_coding NOVEL \N 1 21740 ENST00000355555 1 2004-12-06 12:00:00 2004-12-06 12:00:00
21741 18276 1282 317101 20000 21000 1 \N ensembl protein_coding NOVEL weird 1 21741 ENST00000111111 1 2014-12-11 14:00:00 2014-12-11 14:00:00
\ No newline at end of file
21741 18276 1282 469290 1 150 1 \N ensembl protein_coding NOVEL weird 1 21741 ENST00000111111 1 2014-12-11 14:00:00 2014-12-11 14:00:00
21742 18276 1282 317101 20000 21000 1 \N ensembl protein_coding NOVEL weird 1 21742 ENST00000222222 1 2016-08-15 14:00:00 2016-08-15 17:00:00
\ No newline at end of file
21741 dna_align_feature 1449321
21741 dna_align_feature 11290104
21741 protein_align_feature 813252
21741 protein_align_feature 813424
21741 protein_align_feature 813184
\ No newline at end of file
21742 dna_align_feature 1449321
21742 dna_align_feature 11290104
21742 protein_align_feature 813252
21742 protein_align_feature 813424
21742 protein_align_feature 813184
\ No newline at end of file
......@@ -15,13 +15,10 @@
use strict;
use Test::More;
use Test::Exception;
use Test::Warnings;
use Bio::EnsEMBL::Test::MultiTestDB;
use Bio::EnsEMBL::DnaDnaAlignFeature;
use Bio::EnsEMBL::Test::TestUtils;
use Data::Dumper;
our $verbose = 0;
my $multi = Bio::EnsEMBL::Test::MultiTestDB->new();
......@@ -31,7 +28,7 @@ ok(1);
#Fetch Transcript by stable_id and ensure it has a slice
my $db = $multi->get_DBAdaptor('core');
my $ta = $db->get_TranscriptAdaptor();
my $tr = $ta->fetch_by_stable_id( "ENST00000111111" );
my $tr = $ta->fetch_by_stable_id( "ENST00000222222" );
ok($tr, "Fetched the Transcript by stable_id");
ok($tr->slice(), "Transcript has slice");
......@@ -66,5 +63,10 @@ foreach my $supporting_feature(@$supporting_features_dnas){
ok('Bio::EnsEMBL::DnaDnaAlignFeature' eq ref $supporting_feature, "Got back the right ref type: Bio::EnsEMBL::DnaDnaAlignFeature");
}
#Test exceptions with unknown feature_types
dies_ok { $tsf_adaptor->fetch_all_by_Transcript($tr, "unknown_feature_type") } 'fetch_all_by_Transcript dies with unknown feature_type';
throws_ok {$tsf_adaptor->fetch_all_by_Transcript($tr, "unknown_feature_type") } qr/feature type must be dna_align_feature or protein_align_feature/,
'feature type must be dna_align_feature or protein_align_feature';
done_testing();
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