2 # Bioperl Test Harness Script for Modules
5 # Before `make install' is performed this script should be runnable with
6 # `make test'. After `make install' it should work as `perl test.t'
10 use vars qw($error $NUMTESTS);
12 # to handle systems with no installed Test module
13 # we include the t dir (where a copy of Test.pm is located)
15 eval { require Test; };
19 # interpro uses XML::DOM
20 eval {require XML::DOM::XPath};
23 warn "XML::DOM::XPath not found - skipping interpro tests\n";
27 plan tests => $NUMTESTS;
31 foreach ( $Test::ntest..$NUMTESTS) {
32 skip('Unable to run interpro tests because XML::DOM::XPath is not installed',1);
42 my $verbose = $ENV{'BIOPERLDEBUG'};
45 my $t_file = Bio::Root::IO->catfile("t","data","test.interpro");
46 my $a_in = Bio::SeqIO->new( -file => $t_file,
48 -format => 'interpro');
50 my $seq = $a_in->next_seq();
52 ok($seq->isa('Bio::Seq::RichSeq'));
53 ok(scalar( $seq->get_SeqFeatures() ) == 6);
55 my($feat) = $seq->get_SeqFeatures();
56 ok($feat->isa('Bio::SeqFeature::Generic'));
58 ok($feat->display_name eq 'Retinoblastoma-associated protein, B-box');
60 ok($seq = $a_in->next_seq());
61 ok(scalar( $seq->get_SeqFeatures() ) == 40);
63 ok(!($seq = $a_in->next_seq()));
65 # Bug 1908 (enhancement)
66 $t_file = Bio::Root::IO->catfile("t","data","interpro_ebi.xml");
67 my $b_in = Bio::SeqIO->new( -file => $t_file,
69 -format => 'interpro');
70 $seq = $b_in->next_seq();
73 my @features = $seq->get_SeqFeatures;
74 ok scalar @features,2;
75 ok $features[0]->primary_tag, 'region';
76 ok $features[0]->display_name,'Protein of unknown function DUF1021';
77 ok $features[0]->location->end,78;
79 my @dblinks = $features[0]->annotation->get_Annotations('dblink');
80 ok (scalar @dblinks,3);
81 ok $dblinks[1]->primary_id,'IPR009366';
82 ok $dblinks[2]->primary_id,'PF06257.1';