Skip to content
Snippets Groups Projects
Commit 950d35f4 authored by Alessandro Vullo's avatar Alessandro Vullo
Browse files

[ENSCORESW-1117]. Test fetch_all_by_genome_component method.

parent ea945dc6
No related merge requests found
......@@ -156,7 +156,7 @@ is($alt_transcript_count, $genome->get_alt_transcript_count(), "Number of alt tr
#
# Test polyploid genome support
#
# get a genome container for a non polyploid (human) genome core db
# get a genome container for a non polyploid genome core db (human)
my $human = $multi->get_DBAdaptor("core");
my $hgdba = $human->get_adaptor('GenomeContainer');
......@@ -164,7 +164,7 @@ ok($hgdba && $hgdba->isa('Bio::EnsEMBL::DBSQL::GenomeContainer'), 'GenomeContain
ok(!$hgdba->is_polyploid, "Human genome is not polyploid");
is_deeply($hgdba->get_genome_components(), [], "Human does not have genome components");
# get a genome container for a polyploid (bread wheat) genome core db
# get a genome container for a polyploid genome core db (bread wheat)
my $multi_polyploid = Bio::EnsEMBL::Test::MultiTestDB->new("polyploidy");
my $wheat = $multi_polyploid->get_DBAdaptor("core");
my $wgdba = $wheat->get_adaptor('GenomeContainer');
......
......@@ -408,6 +408,60 @@ $slices = $slice_adaptor->fetch_all('toplevel');
ok(@$slices == 1 && $slices->[0]->seq_region_name() eq '20');
print_slices($slices);
#
# test fetch_all_by_genome_component
#
debug("Testing fetch_all_by_genome_component");
my $multi_polyploid = Bio::EnsEMBL::Test::MultiTestDB->new("polyploidy");
my $wheatdb = $multi_polyploid->get_DBAdaptor("core");
my $wheat_slice_adaptor = Bio::EnsEMBL::DBSQL::SliceAdaptor->new($wheatdb);
isa_ok($wheat_slice_adaptor, 'Bio::EnsEMBL::DBSQL::SliceAdaptor');
# should throw if argument is not provided
throws_ok { $wheat_slice_adaptor->fetch_all_by_genome_component }
qr/Undefined/, 'Call without argument';
# should throw if argument is an invalid genome component
throws_ok { $wheat_slice_adaptor->fetch_all_by_genome_component('C') }
qr/Invalid/, 'Call with invalid argument';
# test with valid genome components
debug("Getting top level slices on A");
$slices = $wheat_slice_adaptor->fetch_all_by_genome_component('A');
ok(scalar @$slices == 1, "Number of top level slices on component A");
$slice = $slices->[0];
isa_ok($slice, 'Bio::EnsEMBL::Slice');
is($slice->seq_region_name, "IWGSC_CSS_5AL_scaff_2697823", "seq region name");
is($slice->start, 1, "slice start");
is($slice->end, 5428, "slice end");
is($slice->strand, 1, "slice strand");
is($slice->seq_region_length, 5428, "slice seq region length");
is($slice->adaptor, $wheat_slice_adaptor, 'slice adaptor');
debug("Getting top level slices on B");
$slices = $wheat_slice_adaptor->fetch_all_by_genome_component('B');
ok(scalar @$slices == 1, "Number of top level slices on component B");
$slice = $slices->[0];
isa_ok($slice, 'Bio::EnsEMBL::Slice');
is($slice->seq_region_name, "IWGSC_CSS_6BS_scaff_233977", "seq region name");
is($slice->start, 1, "slice start");
is($slice->end, 4562, "slice end");
is($slice->strand, 1, "slice strand");
is($slice->seq_region_length, 4562, "slice seq region length");
is($slice->adaptor, $wheat_slice_adaptor, 'slice adaptor');
debug("Getting top level slices on D");
$slices = $wheat_slice_adaptor->fetch_all_by_genome_component('D');
ok(scalar @$slices == 1, "Number of top level slices on component D");
$slice = $slices->[0];
isa_ok($slice, 'Bio::EnsEMBL::Slice');
is($slice->seq_region_name, "IWGSC_CSS_6DS_scaff_2121653", "seq region name");
is($slice->start, 1, "slice start");
is($slice->end, 18301, "slice end");
is($slice->strand, 1, "slice strand");
is($slice->seq_region_length, 18301, "slice seq region length");
is($slice->adaptor, $wheat_slice_adaptor, 'slice adaptor');
#
# test the fuzzy matching of clone accessions
#
......
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