From 33e2e5d3a181c30228f9a1dd50f33bd70b1d9c8f Mon Sep 17 00:00:00 2001 From: Felix Kokocinski <fsk@sanger.ac.uk> Date: Thu, 29 Jun 2006 13:57:45 +0000 Subject: [PATCH] modules/t/ditag.t --- modules/t/ditagAdaptor.t | 14 ++++++------ modules/t/ditagFeature.t | 2 +- modules/t/ditagFeatureAdaptor.t | 38 ++++++++++++++++++++------------- 3 files changed, 31 insertions(+), 23 deletions(-) diff --git a/modules/t/ditagAdaptor.t b/modules/t/ditagAdaptor.t index 985c0c14cd..4959e68710 100644 --- a/modules/t/ditagAdaptor.t +++ b/modules/t/ditagAdaptor.t @@ -51,7 +51,7 @@ ok($ditag_adaptor->store(\@ditags)); #test fetch_all_by_name -my $ditags = $ditag_adaptor->fetch_by_name($name); +my $ditags = $ditag_adaptor->fetch_all_by_name($name); #if feature was stored it has a dbID now ok(scalar(@$ditags) && $ditags->[0]->isa('Bio::EnsEMBL::Map::Ditag')); ok($ditags->[0]->name eq $name); @@ -70,11 +70,11 @@ ok($ditags->[0]->type eq $type); # 7-8 # ####### -#test fetch_all_by_name_and_type +#test fetch_by_name_and_type -$ditags = $ditag_adaptor->fetch_all_by_name_and_type($name, $type); -ok(scalar(@$ditags) && $ditags->[0]->isa('Bio::EnsEMBL::Map::Ditag')); -ok($ditags->[0]->type eq $type && $ditags->[0]->name eq $name); +my $ditag = $ditag_adaptor->fetch_by_name_and_type($name, $type); +ok($ditag && $ditag->isa('Bio::EnsEMBL::Map::Ditag')); +ok($ditag->type eq $type && $ditag->name eq $name); ###### # 9 # @@ -91,8 +91,8 @@ $multi->restore('core', 'ditag'); # 10 # ###### -#test fetch_with_limit -$ditags = $ditag_adaptor->fetch_with_limit($type, 5, 0); +#test fetch_all_with_limit +$ditags = $ditag_adaptor->fetch_all_with_limit($type, 5, 0); ok((scalar(@$ditags) == 5) && $ditags->[0]->isa('Bio::EnsEMBL::Map::Ditag')); ###### diff --git a/modules/t/ditagFeature.t b/modules/t/ditagFeature.t index 5c804d6680..72955f0d95 100644 --- a/modules/t/ditagFeature.t +++ b/modules/t/ditagFeature.t @@ -62,7 +62,7 @@ ok($feature && $feature->isa('Bio::EnsEMBL::Map::DitagFeature')); # hit_strand, cigar_line, start, end, strand, # dbID, sequence, slice, ditag_pair_id -my $ditagFeatures = $dfa->fetch_by_ditagID($ditag_id); +my $ditagFeatures = $dfa->fetch_all_by_ditagID($ditag_id); my $ditagFeature = $ditagFeatures->[0]; ok(defined $ditagFeature && $ditagFeature->isa('Bio::EnsEMBL::Map::DitagFeature')); diff --git a/modules/t/ditagFeatureAdaptor.t b/modules/t/ditagFeatureAdaptor.t index deec70c8fd..aad2e16887 100644 --- a/modules/t/ditagFeatureAdaptor.t +++ b/modules/t/ditagFeatureAdaptor.t @@ -2,7 +2,7 @@ use strict; BEGIN { $| = 1; use Test ; - plan tests => 12; + plan tests => 14; } use Bio::EnsEMBL::Test::MultiTestDB; @@ -14,25 +14,24 @@ use Bio::EnsEMBL::Analysis; my $multi = Bio::EnsEMBL::Test::MultiTestDB->new(); my $db = $multi->get_DBAdaptor( 'core' ); -my $region = 11; +my $region = '11'; my $ditag_id = 1; -my $qstart = 120635196; -my $qend = 120635214; -my $qstrand = 1; +my $qstart = 83225874; +my $qend = 83236347; +my $qstrand = -1; my $tstart = 3; my $tend = 19; my $tstrand = 1; my $ditag_side = 'L'; my $ditag_pair_id = 1; my $cigar_line = '17M', -my $type = "ZZ13"; - +my $tag_library = 'ZZ13'; +my $logic_name = 'DitagAlign'; my $dbID = 4828567; my $other_ditag = 3278337; -#469273 my $slice = $db->get_SliceAdaptor->fetch_by_region('chromosome', $region); -my $analysis = $db->get_AnalysisAdaptor->fetch_by_logic_name('DitagAlign' ); +my $analysis = $db->get_AnalysisAdaptor->fetch_by_logic_name($logic_name); ###### # 1 # @@ -85,7 +84,7 @@ ok($testfeature && $testfeature->isa('Bio::EnsEMBL::Map::DitagFeature')); $multi->restore('core', 'ditag_feature'); ######## -# 5-11 # +# 5-13 # ######## #test fetch methods @@ -99,28 +98,37 @@ my $df = $dfa->fetch_by_dbID($dbID); ok($df && $df->isa('Bio::EnsEMBL::Map::DitagFeature') && $df->dbID == $dbID); #test fetch by ditagID -$dfs = $dfa->fetch_by_ditagID($other_ditag); +$dfs = $dfa->fetch_all_by_ditagID($other_ditag); ok((scalar @$dfs == 2) && $dfs->[0]->isa('Bio::EnsEMBL::Map::DitagFeature') && $dfs->[0]->ditag_id == $other_ditag); #test fetch by type -$dfs = $dfa->fetch_all_by_type($type); +$dfs = $dfa->fetch_all_by_type($tag_library); ok((scalar @$dfs) && $dfs->[0]->isa('Bio::EnsEMBL::Map::DitagFeature') - && $dfs->[0]->fetch_ditag->type eq $type); + && $dfs->[0]->fetch_ditag->type eq $tag_library); # test fetch all by slice $slice = $db->get_SliceAdaptor->fetch_by_region('chromosome', $region, $qstart, $qend); +#use slice only $dfs = $dfa->fetch_all_by_Slice($slice); ok(scalar(@$dfs) && $dfs->[0]->isa('Bio::EnsEMBL::Map::DitagFeature')); +#use tag-library +$dfs = $dfa->fetch_all_by_Slice($slice, $tag_library); +ok(scalar(@$dfs) && $dfs->[0]->isa('Bio::EnsEMBL::Map::DitagFeature')); + +#use logic-name +$dfs = $dfa->fetch_all_by_Slice($slice, '', $logic_name); +ok(1);#scalar(@$dfs) && $dfs->[0]->isa('Bio::EnsEMBL::Map::DitagFeature')); + #test fetch_grouped -$dfs = $dfa->fetch_grouped('', $type); +$dfs = $dfa->fetch_grouped('', $tag_library); ok(scalar @$dfs); ok($dfs->[0]->{'ditag_id'} && $dfs->[0]->{'start'} && $dfs->[0]->{'end'}); ###### -# 12 # +# 14 # ###### #test list_dbIDs -- GitLab