1 # This is -*-Perl-*- code#
2 # Bioperl Test Harness Script for Modules
8 test_begin(-tests => 17,
9 -requires_module => 'Graph');
11 use_ok('Bio::Network::IO');
15 my $verbose = test_debug();
20 my $io = Bio::Network::IO->new(
22 -file => test_input_file("tab4part.tab"));
23 my $g1 = $io->next_network();
25 ok $g1->vertices == 7;
29 $io = Bio::Network::IO->new(
31 -file => test_input_file("tab1part.tab"),
34 ok $g1 = $io->next_network();
35 ok my $node = $g1->get_nodes_by_id('PIR:A64696');
36 my @proteins = $node->proteins;
37 ok $proteins[0]->accession_number, 'PIR:A64696';
38 my %ids = $g1->get_ids_by_node($node);
40 my @ids = qw(A64696 2314583 3053N);
41 for my $k (keys %ids) {
42 ok $ids{$k} eq $ids[$x++];
45 # test write to filehandle...
47 my $out_file = test_output_file();
48 my $out = Bio::Network::IO->new(
50 -file => ">".$out_file);
52 ok $out->write_network($g1);
54 # can we round trip, is the output the same as original format?
56 my $io2 = Bio::Network::IO->new(
60 ok my $g2 = $io2->next_network();
61 ok $node = $g2->get_nodes_by_id('PIR:A64696');
62 @proteins = $node->proteins;
63 ok $proteins[0]->accession_number eq 'PIR:A64696';