1 # This is -*-Perl-*- code#
2 # Bioperl Test Harness Script for Modules
3 # $Id: Node.t 14466 2008-02-04 05:15:58Z bosborne $
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::IO;
39 $verbose = 1 if $DEBUG;
41 # tests for Graph's problematic articulation_points()
42 # As of 2/2008 this test suite is still not reliably passing -
43 # I run it 5 times and I'll get an error 1 out of 5:
44 # Can't locate object method "proteins" via package "Bio::Network::Node...
51 my $io = Bio::Network::IO->new(
53 -file => Bio::Root::IO->catfile("t","data","tab1part.tab"),
56 ok my $g1 = $io->next_network();
58 my @nodes = $g1->articulation_points();
60 my $nodes = $g1->articulation_points();
63 # test articulation_points, but first check that each Node
64 # in network exists as an object
66 $io = Bio::Network::IO->new
68 -file => Bio::Root::IO->catfile("t","data","bovin_small_intact.xml"));
69 my $g = $io->next_network();
74 foreach my $node (@nodes) {
75 my @seqs = $node->proteins;
76 ok $seqs[0]->display_id;
79 # ($ap, $bc, $br) = $g->biconnectivity;
81 @nodes = $g->articulation_points;
82 ok scalar @nodes, 4; # OK, inspected in Cytoscape
84 my @eids = qw(Q29462 P16106 Q27954 P53619);
85 foreach my $node (@nodes) {
86 my @seqs = $node->proteins;
87 ok my $id = $seqs[0]->display_id;
91 # additional articulation_points tests
92 # arath_small-02.xml is PSI MI version 1.0
94 ok $io = Bio::Network::IO->new
96 -file => Bio::Root::IO->catfile("t", "data", "arath_small-02.xml"));
97 ok $g1 = $io->next_network();
99 ok $g1->interactions, 516;
100 @nodes = $g1->articulation_points;
103 for my $node (@nodes) {
104 for my $prot ($node->proteins) {
105 ok $prot->display_id;