1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
#!/usr/bin/env perl
use strict;
use warnings;
my $usage = "\n\n\tusage: $0 graphFromIwormFasta.out\n\n";
my $file = $ARGV[0] or die $usage;
main: {
my %graph;
open(my $fh, $file) or die $!;
while (<$fh>) {
chomp;
my @x = split(/\t/);
my $node_id = shift @x;
my $spacer = shift @x;
foreach my $other_node (@x) {
$graph{$node_id}->{$other_node}++;
}
}
close $fh;
my $found_missing_recip = 0;
foreach my $node (keys %graph) {
foreach my $other_node (keys %{$graph{$node}}) {
if (! exists $graph{$other_node}->{$node}) {
$found_missing_recip = 1;
print STDERR "Error, have $node\->$other_node, but missing $other_node\->$node\n";
}
}
}
if ($found_missing_recip) {
die "Error, missing recips found.\n";
}
else {
print STDERR "\n\nAll good. :-)\n\n";
exit(0);
}
}
|