From b0359c7d9d83364ccef02c705b27a995102a6551 Mon Sep 17 00:00:00 2001 From: Arne Stabenau <stabenau@sanger.ac.uk> Date: Tue, 11 May 2004 13:28:47 +0000 Subject: [PATCH] tests for transcript and translation attributes --- modules/t/transcript.t | 67 ++++++++++++++++++++++++++++++++++++++++- modules/t/translation.t | 56 +++++++++++++++++++++++++++++++++- 2 files changed, 121 insertions(+), 2 deletions(-) diff --git a/modules/t/transcript.t b/modules/t/transcript.t index 7fb68583c0..a438eda7a1 100644 --- a/modules/t/transcript.t +++ b/modules/t/transcript.t @@ -5,7 +5,7 @@ use vars qw( $verbose ); BEGIN { $| = 1; use Test; - plan tests => 46; + plan tests => 53; } use MultiTestDB; @@ -305,6 +305,8 @@ my $trstable_count = count_rows($db, "transcript_stable_id"); my $ex_tr_minus = @{$tr->get_all_Exons()}; + + $multi->save("core", "transcript", "transcript_stable_id", "translation", "translation_stable_id", "protein_feature", "exon", "exon_stable_id", "exon_transcript", "object_xref", @@ -321,4 +323,67 @@ ok( count_rows( $db, "translation") == ($tl_count - 1)); ok( count_rows( $db, "exon_transcript") == ($ex_tr_count - $ex_tr_minus)); ok( count_rows( $db, "transcript_stable_id") == ($trstable_count - 1)); +# +# test _rna_edit for transcripts +# + +$tr = $ta->fetch_by_stable_id( "ENST00000217347" ); + +# +# 5 prime UTR editing +# + +my $seq1 = $tr->edited_seq(); +my $tlseq1 = $tr->translateable_seq(); + +my $attrib = Bio::EnsEMBL::Attribute->new + ( + -code => '_rna_edit', + -value => "0 6 GATTACA", + -name => "RNA editing" + ); + +$tr->add_Attributes( $attrib ); + +my $seq2 = $tr->edited_seq(); + +ok( $seq1 ne $seq2 ); +ok( $seq2 =~ /^GATTACA/ ); + + +# +# insert just at the start of the translation +# makes it longer. (For non phase zero start exons) +# cdna_coding_start for this transcript is 65, 64 is just before that +# + +$attrib = Bio::EnsEMBL::Attribute->new + ( + -code => '_rna_edit', + -value => "64 64 NNN", + -name => "RNA editing" + ); + +$tr->add_Attributes( $attrib ); + +my $tlseq2 = $tr->translateable_seq(); + +ok( $tlseq1 ne $tlseq2 ); +ok( $tlseq2 =~ /^NNNATG/ ); +ok( $tlseq1 eq substr( $tlseq2,3 )); + +# +# try save and retrieve by lazy load +# + +$multi->hide( "core", "transcript_attrib" ); +my $attribAdaptor = $db->get_AttributeAdaptor(); + +$attribAdaptor->store_on_Transcript( $tr, $tr->get_all_Attributes() ); + +$tr = $ta->fetch_by_stable_id( "ENST00000217347" ); + +ok( $tr->translateable_seq() eq $tlseq2 ); +ok( $tr->edited_seq() =~ /^GATTACA/ ); + $multi->restore(); diff --git a/modules/t/translation.t b/modules/t/translation.t index d96e29c1d5..a16a8ab098 100644 --- a/modules/t/translation.t +++ b/modules/t/translation.t @@ -8,7 +8,7 @@ use Bio::EnsEMBL::Exon; BEGIN { $| = 1; use Test; - plan tests => 26; + plan tests => 29; } my $loaded = 0; @@ -152,6 +152,60 @@ ok(count_rows($db, 'translation') == $tl_count - 1); ok(count_rows($db, 'translation_stable_id') == $tlstable_count - 1); ok(count_rows($db, 'protein_feature') == $pfeat_count - $pfeat_minus); +# +# Attribute handling for selenocystein +# + +my $tr = $tra->fetch_by_stable_id( "ENST00000217347" ); + +my $attrib = Bio::EnsEMBL::Attribute->new + ( + -code => '_selenocystein', + -value => 2, + -name => "Selenocystein positions" + ); + +$tr->translation->add_Attributes( $attrib ); + +$attrib = Bio::EnsEMBL::Attribute->new + ( + -code => '_selenocystein', + -value => 3, + -name => "Selenocystein positions" + ); +$tr->translation->add_Attributes( $attrib ); +$tr->translation->add_selenocystein_position( 4 ); + +my $tlseq = $tr->translate->seq(); + +debug( "UUU inserted: ".$tlseq ); +ok( $tlseq =~ /^.UUU/ ); + +# +# store and retrieve by lazy load +# + +$multi->hide( "core", "translation_attrib" ); + +my $tl = $tr->translation(); +my $attrAdaptor = $db->get_AttributeAdaptor(); + +$attrAdaptor->store_on_Translation( $tl, $tl->get_all_Attributes() ); + +$tr = $tra->fetch_by_stable_id( "ENST00000217347" ); + +$tlseq = $tr->translate->seq(); +ok( $tlseq =~ /^.UUU/ ); $multi->restore(); + + +# +# Check if this was not caching artefact +# No selenos should occur here +# +$tr = $tra->fetch_by_stable_id( "ENST00000217347" ); + +$tlseq = $tr->translate->seq(); +ok( $tlseq !~ /^.UUU/ ); -- GitLab