[BUG] bug 2598
[bioperl-live.git] / t / interpro.t
blobe5fea0a4a438047291465930ce4a6a54f8d5c4bc
1 # -*-Perl-*- Test Harness script for Bioperl
2 # $Id$
4 use strict;
6 BEGIN {
7   use lib 't/lib';
8   use BioperlTest;
9   
10   test_begin(-tests => 19,
11                          -requires_module => 'XML::DOM::XPath');
12   
13   use_ok('Bio::SeqIO');
16 my $verbose = test_debug();
18 my $t_file = test_input_file('test.interpro');
19 my $a_in = Bio::SeqIO->new( -file => $t_file,
20                                                                          -verbose => $verbose,
21                                                                          -format => 'interpro');
23 my $seq = $a_in->next_seq();
24 ok($seq);
25 isa_ok($seq, 'Bio::Seq::RichSeq');
26 is(scalar( $seq->get_SeqFeatures() ),6);
28 my($feat) = $seq->get_SeqFeatures();
29 isa_ok($feat,'Bio::SeqFeature::Generic');
31 is($feat->display_name,'Retinoblastoma-associated protein, B-box');
33 ok($seq = $a_in->next_seq());
34 is(scalar( $seq->get_SeqFeatures() ),40);
36 ok(!($seq = $a_in->next_seq()));
38 # Bug 1908 (enhancement)
39 $t_file = test_input_file('interpro_ebi.xml');
40 my $b_in = Bio::SeqIO->new( -file => $t_file,
41                                                                          -verbose => $verbose,
42                                                                          -format => 'interpro');
43 $seq = $b_in->next_seq();
44 ok($seq);
46 my @features = $seq->get_SeqFeatures;
47 is scalar @features,2;
48 is $features[0]->primary_tag, 'region';
49 is $features[0]->display_name,'Protein of unknown function DUF1021';
50 is $features[0]->location->end,78;
52 my @dblinks = $features[0]->annotation->get_Annotations('dblink');
53 is (scalar @dblinks,3);
54 is $dblinks[1]->primary_id,'IPR009366';
55 is $dblinks[2]->primary_id,'PF06257.1';
57 my $other_t_file = test_input_file('test.interpro-go.xml');
58 my $ipr_in = Bio::SeqIO->new( -file => $other_t_file,
59                               -verbose => $verbose,
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);
66 is $dblinks[3]->primary_id,'GO:0003677';