add stub module_name
[bioperl-network.git] / t / IO_psi10.t
blobdef9a0c6c31b4bcb50d21aee23c916c99423dcfd
1 # This is -*-Perl-*- code#
2 # Bioperl Test Harness Script for Modules#
3 # $Id$
5 use strict;
7 BEGIN {
8         use Bio::Root::Test;
9         test_begin(-tests => 22,
10                            -requires_module => 'Graph',
11                            -requires_module => 'XML::Twig');
13         use_ok('Bio::Network::IO');
14         use_ok('Bio::Network::Node');
17 my $verbose = test_debug();
20 # PSI XML from DIP
22 ok my $io = Bio::Network::IO->new
23   (-format => 'psi10',
24         -file   => test_input_file("psi_xml.dat"));
25 ok my $g1 = $io->next_network();
26 is $g1->edge_count, 3;
27 is $g1->node_count, 4;
28 is $g1->is_connected, 1;
29 my $n = $g1->get_nodes_by_id('O24853');
30 my @proteins = $n->proteins;
31 is $proteins[0]->species->node_name, "Helicobacter pylori 26695";
32 is $proteins[0]->primary_seq->desc, "hypothetical HP0001";
33 my @rts = $g1->articulation_points;
34 is scalar @rts, 1; # correct, by inspection in Cytoscape
35 @proteins = $rts[0]->proteins;
36 my $seq = $proteins[0];
37 is $seq->desc, "hypothetical HP0001"; # correct, by inspection in Cytoscape
40 # PSI XML from IntAct
42 ok $io = Bio::Network::IO->new
43   (-format => 'psi10',
44         -file   => test_input_file("sv40_small.xml"));
45 ok $g1 = $io->next_network();
46 is $g1->edge_count, 3;
47 is $g1->node_count, 5;
48 is $g1->is_connected, "";
50 $n = $g1->get_nodes_by_id("P03070");
51 @proteins = $n->proteins;
52 is $proteins[0]->species->scientific_name, "Simian virus 40";
53 is $proteins[0]->primary_seq->desc, "Large T antigen";
55 my @components = $g1->connected_components;
56 is scalar @components, 2;
58 # there was an intermittent bug in articulation_points() here
59 # but not in the invocation above, this appears to be fixed
60 # in Graph v. .86
61 @rts = $g1->articulation_points;
62 is scalar @rts, 1;
63 @proteins = $rts[0]->proteins;
64 $seq = $proteins[0];
65 is $seq->desc, "Erythropoietin receptor precursor";
68 # GO terms
70 $n = $g1->get_nodes_by_id("EBI-474016");
71 @proteins = $n->proteins;
74 # PSI XML from HPRD
76 # The individual files from HPRD are not standard PSI, problems parsing them
77 ok $io = Bio::Network::IO->new
78   (-format => 'psi10',
79         -file   => test_input_file("00001.xml"));
80 # ok $g1 = $io->next_network(); 
82 __END__