[Bio] / FigKernelScripts / check_consistency_of_rectangles.pl Repository:
ViewVC logotype

View of /FigKernelScripts/check_consistency_of_rectangles.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (download) (as text) (annotate)
Mon Nov 19 23:02:39 2012 UTC (7 years ago) by overbeek
Branch: MAIN
CVS Tags: rast_rel_2014_0729, rast_rel_2014_0912, HEAD
check consistency of solid rectangles

use strict;
use Data::Dumper;
use FIG;
my $fig = new FIG;

$/ = "\n//\n";

my $good = 0;
my $bad = 0;

my $rectangle;
while (defined($rectangle = <STDIN>))
{
    chomp $rectangle;
    my @instances = map { [split(/\t/,$_)] } split(/\n/,$rectangle);
    my $i;
    my $j;
    for ($i = 1; ($i < @{$instances[0]}); $i++)
    {
	my %funcs;
	for ($j=0; ($j < @instances); $j++)
	{
	    my $func = &func_of($fig,$instances[$j]->[$i]);
	    push(@{$funcs{$func}},$instances[$j]->[$i]);
	}
	if (keys(%funcs) > 1)
	{
	    $bad++;
	    foreach my $func ( sort { @{$funcs{$b}} <=> @{$funcs{$a}} } keys(%funcs))
	    {
		print $func, "\n";
		print "\t", join(",",@{$funcs{$func}}),"\n";
	    }
	    print "\n";
	}
	else
	{
	    $good++;
	}
    }
    print STDERR "bad=$bad   good = $good\n";
}

sub func_of {
    my($fig,$peg) = @_;

    my $f = $fig->function_of($peg);
    if (! $f) { $f = "hypothetical protein" }
    $f =~ s/\s+\#.*//;
    return $f;
}

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3