1 # This is -*-Perl-*- code#
2 # Bioperl Test Harness Script for Modules
9 test_begin(-tests => 32,
10 -requires_module => 'Graph');
12 use_ok('Bio::Network::ProteinNet');
13 use_ok('Bio::Network::Node');
17 my $verbose = test_debug();
19 my $seq1 = Bio::Seq->new(-seq => "aaaaaaa",-display_id => 1);
20 my $seq2 = Bio::Seq->new(-seq => "ttttttt",-display_id => 2);
21 my $seq3 = Bio::Seq->new(-seq => "ggggggg",-display_id => 3);
26 my $node = Bio::Network::Node->new(-protein => $seq1);
27 ok $node->is_complex == 0;
28 my $count = $node->proteins;
31 my @proteins = $node->proteins;
32 ok $proteins[0]->seq eq "aaaaaaa";
33 ok $proteins[0]->display_id == 1;
34 is $node->subunit_number($proteins[0]), undef;
35 $node->subunit_number($proteins[0],52);
36 ok $node->subunit_number($proteins[0]) == 52;
39 # 1 or more proteins, but no subunit composition
41 $node = Bio::Network::Node->new(-protein => [($seq1,$seq2,$seq3)]);
42 ok $node->is_complex == 1;
43 @proteins = $node->proteins;
45 my @seqs = qw(aaaaaaa ggggggg ttttttt);
46 for my $protein (@proteins) {
47 ok $protein->seq eq $seqs[$x++];
48 is $node->subunit_number($protein), undef;
50 $count = $node->proteins;
53 $node = Bio::Network::Node->new(-protein => [($seq1)]);
54 ok $node->is_complex == 0;
57 # 1 or more proteins, specifying subunit composition
59 $node = Bio::Network::Node->new(-protein => [ [($seq1, 2) ],
62 ok $node->is_complex == 1;
63 @proteins = $node->proteins;
65 @seqs = qw(aaaaaaa ggggggg ttttttt);
67 for my $protein (@proteins) {
68 ok $protein->seq eq $seqs[$x];
69 ok $node->subunit_number($protein) == $nums[$x++];
71 $count = $node->proteins;
74 $node = Bio::Network::Node->new(-protein => [ [($seq3, 1)] ]);
75 ok $node->is_complex == 0;
76 ok $node->proteins == 1;
78 $node = Bio::Network::Node->new(-protein => [ [($seq3, 1)],
80 ok $node->is_complex == 1;
81 ok $node->proteins == 2;
83 ok $node->is_complex == 0;
85 $node->subunit_number($seq2,2);
86 ok $node->subunit_number($seq2) == 2;