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