1 # This is -*-Perl-*- code#
2 # Bioperl Test Harness Script for Modules
3 # $Id: protgraph.t,v 1.1 2004/03/13 23:45:32 radams Exp
5 use vars qw($NUMTESTS $DEBUG $ERROR);
7 $DEBUG = $ENV{'BIOPERLDEBUG'} || 0;
10 # to handle systems with no installed Test module
11 # we include the t dir (where a copy of Test.pm is located)
13 eval { require Test; };
20 plan tests => $NUMTESTS;
21 eval { require Graph; };
23 warn "Perl's Graph needed for the bioperl-network package, skipping tests";
29 foreach ( $Test::ntest..$NUMTESTS) {
30 skip("Missing dependencies. Skipping tests",1);
34 exit 0 if $ERROR == 1;
36 require Bio::Network::ProteinNet;
37 require Bio::Network::IO;
38 require Bio::Network::Interaction;
41 $verbose = 1 if $DEBUG;
43 # tests for Graph's problematic articulation_points()
50 my $io = Bio::Network::IO->new(
52 -file => Bio::Root::IO->catfile("t","data","tab1part.tab"),
55 ok my $g1 = $io->next_network();
57 my @nodes = $g1->articulation_points();
59 my $nodes = $g1->articulation_points();
62 # test articulation_points, but first check that each Node
63 # in network can load...
65 $io = Bio::Network::IO->new
67 -file => Bio::Root::IO->catfile("t","data","bovin_small_intact.xml"));
68 my $g = $io->next_network();
72 foreach my $node (@nodes) {
73 my @seqs = $nodes[0]->proteins;
74 ok $seqs[0]->display_id;
77 # ($ap, $bc, $br) = $g->biconnectivity;
79 @nodes = $g->articulation_points;
80 ok scalar @nodes, 4; # OK, inspected in Cytoscape
82 my @eids = qw(EBI-307814 EBI-79764 EBI-620432 EBI-620400);
83 my @seqs = $nodes[0]->proteins; # Node not always loaded
84 my $id = $seqs[0]->display_id;
86 @seqs = $nodes[1]->proteins; # Node not always loaded
87 $id = $seqs[0]->display_id;
89 @seqs = $nodes[2]->proteins; # Node not always loaded
90 $id = $seqs[0]->display_id;
92 @seqs = $nodes[3]->proteins; # Node not always loaded
93 $id = $seqs[0]->display_id;
96 # additional articulation_points tests
97 # arath_small-02.xml is PSI MI version 1.0
99 ok $io = Bio::Network::IO->new
101 -file => Bio::Root::IO->catfile("t", "data", "arath_small-02.xml"));
102 ok $g1 = $io->next_network();
104 ok $g1->interactions, 516;
105 @nodes = $g1->articulation_points;
107 my @ids = qw(EBI-621930 EBI-622235 EBI-622281 EBI-622140
108 EBI-622382 EBI-622306 EBI-622264 EBI-622203 );
109 for my $node (@nodes) {
110 for my $prot ($node->proteins) {
111 my $id = $prot->display_id;