Skip to content

Commit

Permalink
Add Iterator tests to the VariationAdaptor module
Browse files Browse the repository at this point in the history
  • Loading branch information
Laurent Gil committed Feb 6, 2015
1 parent 8e0411e commit 55e2f25
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion modules/t/variationAdaptor.t
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use warnings;
use Test::More;
use Data::Dumper;


use Bio::EnsEMBL::Variation::DBSQL::VariationSetAdaptor;
use Bio::EnsEMBL::Test::TestUtils;
use Bio::EnsEMBL::Test::MultiTestDB;

Expand All @@ -33,6 +33,8 @@ my $va = $vdb->get_VariationAdaptor();

ok($va && $va->isa('Bio::EnsEMBL::Variation::DBSQL::VariationAdaptor'), "isa var adaptor");

my $vsa = $vdb->get_VariationSetAdaptor();

# test fetch by dbID

my $var = $va->fetch_by_dbID(4770800);
Expand Down Expand Up @@ -114,6 +116,29 @@ ok($failed_var->failed_description() eq $fail_desc, "fail description");
ok(join(";", @{$failed_var->get_all_failed_descriptions()}) eq $fail_desc, "all fail descriptions");


## Iterators
print "\n# Test - Iterators\n";
my %var_list = ( 'rs117161559' => 25992950,
'rs138574806' => 27085574,
'rs183577856' => 40763453
);
my @var_dbIDs = values(%var_list);
my @var_names = sort{ $var_list{$a} <=> $var_list{$b}} keys(%var_list);

# test fetch Iterator by dbID list
my $it1 = $va->fetch_Iterator_by_dbID_list(\@var_dbIDs);
ok($var_list{$it1->next()->name}, "iterator by id - 1");
ok($var_list{$it1->next()->name}, "iterator by id - 2");
ok($var_list{$it1->next()->name}, "iterator by id - 3");

# test fetch Iterator by VariationSet
my $vs = $vsa->fetch_by_name('1000 Genomes - AFR');
my $isv = $va->fetch_Iterator_by_VariationSet($vs);
ok($isv->next()->name eq $var_names[0], "iterator by VariationSet - 1");
ok($isv->next()->name eq $var_names[1], "iterator by VariationSet - 2");
ok($isv->next()->name eq $var_names[2], "iterator by VariationSet - 3");


# store
$var = $va->fetch_by_dbID(4770800);

Expand Down

0 comments on commit 55e2f25

Please sign in to comment.