Skip to content
Snippets Groups Projects
Commit 39b2a967 authored by Andy Yates's avatar Andy Yates
Browse files

Go through an object and make sure everything is populated once we go through...

Go through an object and make sure everything is populated once we go through a call of $gene->load().
parent 3288ab57
No related branches found
No related tags found
No related merge requests found
use strict;
use warnings;
use Test::More;
#use Test::Differences qw/eq_or_diff/;
use Bio::EnsEMBL::Test::MultiTestDB;
my $db = Bio::EnsEMBL::Test::MultiTestDB->new();
my $dba = $db->get_DBAdaptor('core');
$db->save('core', qw/intron_supporting_evidence transcript_intron_supporting_evidence/);
my $ga = $dba->get_GeneAdaptor();
#Test the keys held by a fully populated gene change
my $gene = $ga->fetch_by_stable_id('ENSG00000131044');
$gene->load();
my @generic_keys = qw/
dbID adaptor stable_id created_date modified_date version
/;
my @location_keys = qw/start end strand slice/;
my $expected_keys = {
'gene' => [sort @generic_keys, @location_keys, qw/
analysis
attributes
is_current biotype status source
description
canonical_transcript canonical_transcript_id _transcript_array
canonical_annotation
dbentries display_xref external_name external_db external_status
/],
'transcript' => [sort @generic_keys, @location_keys, qw/
analysis
attributes
_ise_array
_supporting_evidence
_trans_exon_array
cdna_coding_start cdna_coding_end
alternative_translations translation edits_enabled
is_current biotype status description
dbentries display_xref external_name external_db external_status external_display_name
/],
'translation' => [sort @generic_keys, qw/
attributes
start_exon end_exon start end transcript
seq
protein_features
dbentries
/],
'exon' => [sort @generic_keys, @location_keys, qw/
_seq_cache
_supporting_evidence
phase end_phase is_constitutive is_current
/],
};
$expected_keys->{transcript_canonical} = [sort @{$expected_keys->{transcript}}, 'is_canonical'];
assert_keys($gene, 'gene', 'Fully populated gene should have all elements filled');
my $transcripts = $gene->get_all_Transcripts();
is(scalar(@{$transcripts}), 2, 'Gene has 2 transcripts');
assert_transcript($transcripts->[0], 'transcript_canonical');
assert_transcript($transcripts->[1], 'transcript');
$db->restore();
done_testing();
sub assert_transcript {
my ($transcript, $key) = @_;
assert_keys($transcript, $key, 'Fully populated transcript');
assert_keys($transcript->translation(), 'translation', 'Fully populated translation');
foreach my $exon (@{$transcript->get_all_Exons()}) {
assert_keys($exon, 'exon', 'Fully populated exon');
}
}
sub assert_keys {
my ($feature, $type_key, $msg) = @_;
is_deeply(get_keys($feature), $expected_keys->{$type_key}, $msg);
# eq_or_diff(get_keys($feature), $expected_keys->{$type_key}, $msg);
}
sub get_keys {
return [sort keys %{$_[0]}];
}
\ No newline at end of file
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