ModuleBuildBioperl -> Bio::Root::Build
[bioperl-network.git] / t / IO_psi25.t
blobd63960d51a3877086f1bf3fae3ae9fbe06827e82
1 # This is -*-Perl-*- code#
2 # Bioperl Test Harness Script for Modules#
3 # $Id$
5 use vars qw($NUMTESTS $DEBUG $ERROR);
6 use strict;
7 $DEBUG = $ENV{'BIOPERLDEBUG'} || 0;
9 BEGIN {
10         # to handle systems with no installed Test module
11         # we include the t dir (where a copy of Test.pm is located)
12         # as a fallback
13         eval { require Test; };
14         $ERROR = 0;
15         if ( $@ ) {
16                 use lib 't';
17         }
18         use Test;
19         $NUMTESTS = 9;
20         plan tests => $NUMTESTS;
21         eval { require Graph; };
22         if ( $@ ) {
23                 warn("Graph required for graph creation and analysis, skipping tests");
24                 $ERROR = 1;
25         }
26         eval { require XML::Twig; };
27         if ($@) {
28                 warn "XML::Twig needed for XML format parsing, skipping tests";
29                 $ERROR = 1;
30         }
33 END {
34         foreach ( $Test::ntest..$NUMTESTS) {
35                 skip("Missing dependencies. Skipping tests",1);
36         }
39 exit 0 if $ERROR == 1;
41 require Bio::Network::IO;
43 my $verbose = 0;
44 $verbose = 1 if $DEBUG;
46 ok 1;
49 # PSI XML from IntAct
51 ok my $io = Bio::Network::IO->new
52   (-format  => 'psi25',
53         -file    => Bio::Root::IO->catfile("t", "data", "human_small-01.xml"),
54    -verbose => $verbose );
55 ok my $g1 = $io->next_network(); 
56 ok $g1->node_count, 646;
57 # remember that interactions are only formed of pairs of nodes 
58 ok $g1->interactions, 439;
60 # PSI XML from MINT
62 ok $io = Bio::Network::IO->new
63   (-format => 'psi25',
64         -file   => Bio::Root::IO->catfile("t", "data", "Viruses.psi25.xml"),
65    -verbose => $verbose );
66 ok $g1 = $io->next_network(); 
67 ok $g1->node_count, 521;
68 ok $g1->interactions, 994;
71 __END__