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::Node;
41 $verbose = 1 if $DEBUG;
45 my $seq1 = Bio::Seq->new(-seq => "aaaaaaa",-display_id => 1);
46 my $seq2 = Bio::Seq->new(-seq => "ttttttt",-display_id => 2);
47 my $seq3 = Bio::Seq->new(-seq => "ggggggg",-display_id => 3);
52 my $node = Bio::Network::Node->new(-protein => $seq1);
53 ok $node->is_complex, 0;
54 my $count = $node->proteins;
57 my @proteins = $node->proteins;
58 ok $proteins[0]->seq, "aaaaaaa";
59 ok $proteins[0]->display_id, 1;
60 ok $node->subunit_number($proteins[0]), undef;
61 $node->subunit_number($proteins[0],52);
62 ok $node->subunit_number($proteins[0]), 52;
65 # 1 or more proteins, but no subunit composition
67 $node = Bio::Network::Node->new(-protein => [($seq1,$seq2,$seq3)]);
68 ok $node->is_complex, 1;
69 @proteins = $node->proteins;
71 my @seqs = qw(aaaaaaa ggggggg ttttttt);
72 for my $protein (@proteins) {
73 ok $protein->seq, $seqs[$x++];
74 ok $node->subunit_number($protein), undef;
76 $count = $node->proteins;
79 $node = Bio::Network::Node->new(-protein => [($seq1)]);
80 ok $node->is_complex, 0;
83 # 1 or more proteins, specifying subunit composition
85 $node = Bio::Network::Node->new(-protein => [ [($seq1, 2) ],
88 ok $node->is_complex, 1;
89 @proteins = $node->proteins;
91 @seqs = qw(aaaaaaa ggggggg ttttttt);
93 for my $protein (@proteins) {
94 ok $protein->seq, $seqs[$x];
95 ok $node->subunit_number($protein), $nums[$x++];
97 $count = $node->proteins;
100 $node = Bio::Network::Node->new(-protein => [ [($seq3, 1)] ]);
101 ok $node->is_complex, 0;
102 ok $node->proteins, 1;
104 $node = Bio::Network::Node->new(-protein => [ [($seq3, 1)],
106 ok $node->is_complex, 1;
107 ok $node->proteins, 2;
108 $node->is_complex(0);
109 ok $node->is_complex, 0;
111 $node->subunit_number($seq2,2);
112 ok $node->subunit_number($seq2), 2;