New INSTALL.WIN doc (from wiki)
[bioperl-live.git] / t / interpro.t
blob115201c80a6626e9527b77d687918e1bb91f8f39
1 # -*-Perl-*-
2 # Bioperl Test Harness Script for Modules
3 # $Id$
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'
8 use strict;
9 BEGIN {
10   use vars qw($error $NUMTESTS);
11   $error = 0;
12   # to handle systems with no installed Test module
13   # we include the t dir (where a copy of Test.pm is located)
14   # as a fallback
15   eval { require Test; };
16   if ( $@ ) {
17     use lib 't';
18   }
19   # interpro uses XML::DOM
20   eval {require XML::DOM::XPath};
21   if ( $@ ) {
22     $error = 1;
23     warn "XML::DOM::XPath not found - skipping interpro tests\n";
24   }
25   $NUMTESTS = 17;
26   use Test;
27   plan tests => $NUMTESTS;
30 END { 
31   foreach ( $Test::ntest..$NUMTESTS) {
32     skip('Unable to run interpro tests because XML::DOM::XPath is not installed',1);
33   }
36 if ( $error == 1 ) {
37         exit(0);
40 use Bio::SeqIO;
42 my $verbose = $ENV{'BIOPERLDEBUG'};
43 ok(1);
45 my $t_file = Bio::Root::IO->catfile("t","data","test.interpro");
46 my $a_in = Bio::SeqIO->new( -file => $t_file,
47                                                                          -verbose => $verbose,
48                                                                          -format => 'interpro');
50 my $seq = $a_in->next_seq();
51 ok($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,
68                                                                          -verbose => $verbose,
69                                                                          -format => 'interpro');
70 $seq = $b_in->next_seq();
71 ok($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';
84 __END__