Commit 9c9a1ce1 authored by Andreas Kusalananda Kähäri's avatar Andreas Kusalananda Kähäri
Browse files

Changes in store() to quieten the unit tests.

parent 8f65f33e
...@@ -790,11 +790,9 @@ sub store { ...@@ -790,11 +790,9 @@ sub store {
# store translation # store translation
# #
my @translations = my $alt_translations =
@{ $db->get_TranslationAdaptor() $transcript->get_all_alternative_translations();
->fetch_all_by_Transcript($transcript) }; my $translation = $transcript->translation();
my $translation = shift(@translations);
if ( defined($translation) ) { if ( defined($translation) ) {
#make sure that the start and end exon are set correctly #make sure that the start and end exon are set correctly
...@@ -865,42 +863,45 @@ sub store { ...@@ -865,42 +863,45 @@ sub store {
# Store the alternative translations, if there are any. # Store the alternative translations, if there are any.
# #
foreach my $alt_translation (@translations) { if ( defined($alt_translations) ) {
my $start_exon = $alt_translation->start_Exon(); foreach my $alt_translation ( @{$alt_translations} ) {
my $end_exon = $alt_translation->end_Exon(); my $start_exon = $alt_translation->start_Exon();
my $end_exon = $alt_translation->end_Exon();
if ( !defined($start_exon) ) { if ( !defined($start_exon) ) {
throw("Translation does not define a start exon."); throw("Translation does not define a start exon.");
} elsif ( !defined($end_exon) ) { } elsif ( !defined($end_exon) ) {
throw("Translation does not defined an end exon."); throw("Translation does not defined an end exon.");
} }
if ( !defined( $start_exon->dbID() ) ) { if ( !defined( $start_exon->dbID() ) ) {
my $key = $start_exon->hashkey(); my $key = $start_exon->hashkey();
($start_exon) = grep { $_->hashkey() eq $key } @{$exons}; ($start_exon) = grep { $_->hashkey() eq $key } @{$exons};
if ( defined($start_exon) ) { if ( defined($start_exon) ) {
$alt_translation->start_Exon($start_exon); $alt_translation->start_Exon($start_exon);
} else { } else {
throw( throw(
"Translation's start_Exon does not appear to be one of the " "Translation's start_Exon does not appear to be one of the "
. "exons in its associated Transcript" ); . "exons in its associated Transcript" );
} }
} elsif ( !defined( $end_exon->dbID() ) ) { } elsif ( !defined( $end_exon->dbID() ) ) {
my $key = $end_exon->hashkey(); my $key = $end_exon->hashkey();
($end_exon) = grep { $_->hashkey() eq $key } @$exons; ($end_exon) = grep { $_->hashkey() eq $key } @$exons;
if ( defined($end_exon) ) { if ( defined($end_exon) ) {
$translation->end_Exon($end_exon); $translation->end_Exon($end_exon);
} else { } else {
throw("Translation's end_Exon does not appear to be one of the " throw(
"Translation's end_Exon does not appear to be one of the "
. "exons in its associated Transcript." ); . "exons in its associated Transcript." );
}
} }
}
$db->get_TranslationAdaptor() $db->get_TranslationAdaptor()
->store( $alt_translation, $transc_dbID ); ->store( $alt_translation, $transc_dbID );
} ## end foreach my $alt_translation... } ## end foreach my $alt_translation...
} ## end if ( defined($alt_translations...))
# #
# store the xrefs/object xref mapping # store the xrefs/object xref mapping
......
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