1 # -*-Perl-*- Test Harness script for Bioperl
9 test_begin(-tests => 20,
10 -requires_module => 'XML::DOM::XPath');
12 use_ok('Bio::SeqIO::interpro');
15 my $verbose = test_debug();
17 my $t_file = test_input_file('test.interpro');
18 my $a_in = Bio::SeqIO->new( -file => $t_file,
20 -format => 'interpro');
21 isa_ok($a_in, 'Bio::SeqIO');
23 my $seq = $a_in->next_seq();
24 ok($seq, 'seq obj is defined');
25 isa_ok($seq, 'Bio::Seq::RichSeq');
26 is(scalar( $seq->get_SeqFeatures() ), 6, 'right number of SeqFeatures');
28 my($feat) = $seq->get_SeqFeatures();
29 isa_ok($feat,'Bio::SeqFeature::Generic');
31 is($feat->display_name,'Retinoblastoma-associated protein, B-box', 'display_name()');
33 ok($seq = $a_in->next_seq(), 'seq object is defined');
34 is(scalar( $seq->get_SeqFeatures() ),40, 'right number of SeqFeatures');
36 ok(!($seq = $a_in->next_seq()), 'there is no next_seq (correctly)');
38 # Bug 1908 (enhancement)
39 $t_file = test_input_file('interpro_ebi.xml');
40 my $b_in = Bio::SeqIO->new( -file => $t_file,
42 -format => 'interpro');
43 $seq = $b_in->next_seq();
46 my @features = $seq->get_SeqFeatures;
47 is(scalar @features, 2, 'right number of SeqFeatures');
48 is($features[0]->primary_tag, 'region', 'primary_tag()');
49 is($features[0]->display_name, 'Protein of unknown function DUF1021', 'display_name()');
50 is($features[0]->location->end, 78, 'location->end()');
52 my @dblinks = $features[0]->annotation->get_Annotations('dblink');
53 is(scalar @dblinks, 3, 'right number of dblinks');
54 is($dblinks[1]->primary_id, 'IPR009366', 'first primary_id');
55 is($dblinks[2]->primary_id, 'PF06257.1', 'second primary_id');
57 my $other_t_file = test_input_file('test.interpro-go.xml');
58 my $ipr_in = Bio::SeqIO->new( -file => $other_t_file,
60 -format => 'interpro');
62 $seq = $ipr_in->next_seq();
63 @features = $seq->get_SeqFeatures;
64 @dblinks = $features[0]->annotation->get_Annotations('dblink');
65 is(scalar @dblinks, 4, 'right number of dblinks');
66 is($dblinks[3]->primary_id, 'GO:0003677', 'primary_id via dblinks');