diff --git a/modules/t/transcript.t b/modules/t/transcript.t index be214635cba9c62bd376f28ab20df3c967cc0b11..467e5f1892c050f1abc2b46f40737f158fc1ba53 100644 --- a/modules/t/transcript.t +++ b/modules/t/transcript.t @@ -4,7 +4,7 @@ use vars qw( $verbose ); BEGIN { $| = 1; use Test; - plan tests => 132; + plan tests => 133; } use Bio::EnsEMBL::Test::MultiTestDB; @@ -432,6 +432,52 @@ ok($tr->translate->seq() eq 'MNFALILMINTLLALLLMIITFWLPQLNGYMEKSTPYECGFDPMSPARVPF +# check that attributes are stored when transcript is stored + +$tr = $ta->fetch_by_stable_id( "ENST00000217347" ); +my $g = $db->get_GeneAdaptor->fetch_by_transcript_id($tr->dbID()); + + +$tr->translation()->adaptor(undef); +$tr->translation()->dbID(undef); + +# unstore the transcript so it can be stored again + +foreach my $ex (@{$tr->get_all_Exons()}) { + $ex->dbID(undef); + $ex->adaptor(undef); +} + +$tr->dbID(undef); +$tr->adaptor(undef); + + +$multi->hide('core', 'transcript', 'transcript_attrib', 'translation', + 'exon_transcript', 'exon', 'exon_stable_id', + 'transcript_stable_id', 'translation_stable_id'); + + +my $attrib1 = Bio::EnsEMBL::Attribute->new + ( -code => '_rna_edit', + -value => "65 64 NNN", + -name => "RNA editing"); + +$tr->add_Attributes($attrib1); + +my $attrib2 = Bio::EnsEMBL::Attribute->new + ( -code => '_rna_edit', + -value => "66 65 NNN", + -name => "RNA editing"); + +$tr->add_Attributes($attrib2); + +$ta->store($tr, $g->dbID()); + +ok(count_rows($db, 'transcript_attrib') == 2); + + + +$multi->restore('core'); sub test_trans_mapper_edits { diff --git a/modules/t/translation.t b/modules/t/translation.t index 7ce80be53d157509b7ea4e8e3b585d35e8988c1d..82a1bdc62a47dc5d954876bf71a1981f75b77938 100644 --- a/modules/t/translation.t +++ b/modules/t/translation.t @@ -7,7 +7,7 @@ use Bio::EnsEMBL::Exon; BEGIN { $| = 1; use Test; - plan tests => 30; + plan tests => 31; } my $loaded = 0; @@ -220,3 +220,45 @@ my $tr2 = $tra->fetch_by_stable_id('ENST00000252021'); my @tls = @{$ta->fetch_all_by_Transcript_list([$tr,$tr2])}; ok(@tls == 2); + + + +# test that translation attribs are stored when translation is stored +# check that attributes are stored when transcript is stored + +$tr = $tra->fetch_by_stable_id( "ENST00000217347" ); + +$tl = $tr->translation(); + +# unstore the translation so it can be stored again + +$tl->adaptor(undef); +$tl->dbID(undef); + + +$multi->hide('core', 'transcript', 'translation_attrib', 'translation', + 'translation_stable_id'); + + +# add a couple of attributes to the translation + +$sc = Bio::EnsEMBL::SeqEdit->new(-START => 2, + -END => 2, + -ALT_SEQ => 'U', + -CODE => '_selenocysteine', + -NAME => 'Selenocysteine'); + +$tl->add_Attributes( $sc->get_Attribute() ); + +$sc->start(3); +$sc->end(3); + +$tl->add_Attributes( $sc->get_Attribute() ); + +$ta->store($tl, $tr->dbID()); + +ok(count_rows($db, 'translation_attrib') == 2); + +$multi->restore('core'); + +