1 # This is -*-Perl-*- code#
2 # Bioperl Test Harness Script for Modules
9 test_begin(-tests => 17,
10 -requires_module => 'Graph');
12 use_ok('Bio::Network::IO');
16 my $verbose = test_debug();
21 my $io = Bio::Network::IO->new(
23 -file => test_input_file("tab4part.tab"));
24 my $g1 = $io->next_network();
26 ok $g1->vertices == 7;
30 $io = Bio::Network::IO->new(
32 -file => test_input_file("tab1part.tab"),
35 ok $g1 = $io->next_network();
36 ok my $node = $g1->get_nodes_by_id('PIR:A64696');
37 my @proteins = $node->proteins;
38 ok $proteins[0]->accession_number, 'PIR:A64696';
39 my %ids = $g1->get_ids_by_node($node);
41 my @ids = qw(A64696 2314583 3053N);
42 for my $k (keys %ids) {
43 ok $ids{$k} eq $ids[$x++];
46 # test write to filehandle...
48 my $out_file = test_output_file();
49 my $out = Bio::Network::IO->new(
51 -file => ">".$out_file);
53 ok $out->write_network($g1);
55 # can we round trip, is the output the same as original format?
57 my $io2 = Bio::Network::IO->new(
61 ok my $g2 = $io2->next_network();
62 ok $node = $g2->get_nodes_by_id('PIR:A64696');
63 @proteins = $node->proteins;
64 ok $proteins[0]->accession_number eq 'PIR:A64696';