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

View of /FigKernelScripts/pg_function_of.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (download) (as text) (annotate)
Wed Apr 10 19:15:29 2013 UTC (6 years, 7 months ago) by olson
Branch: MAIN
CVS Tags: rast_rel_2014_0729, rast_rel_2014_0912, HEAD
Changes since 1.1: +5 -1 lines
Modifications to pangenome code to move common code to PG.pm.

use strict;
use Data::Dumper;
use Getopt::Long;
use PG;

my $usage = "usage: pg_function_of -d Data\n";
my $dataD;
my $rc  = GetOptions('d=s' => \$dataD,);

if ((! $rc) || (! -d $dataD)) { print STDERR $usage; exit }

my $pg = new PG($dataD);

my $to_func = $pg->load_funcs();

while (defined($_ = <STDIN>))
{
    chop;
    print $_,"\t";
    my $f;
    if (($_ =~ /(\S+)$/) && ($f = $to_func->{$1}))
    {
	print $f;
    }
    print "\n";
}

sub load_funcs {
    my($dataD) = @_;

    my $to_func = {};

    foreach my $job (`cut -f 3 $dataD/genomes.with.job`)
    {
	chop $job;
	foreach $_ (`cat /vol/rast-prod/jobs/$job/rp/*/proposed*functions`)
	{
	    if ($_ =~ /^(\S+)\t(\S.*\S)/)
	    {
		$to_func->{$1} = $2;
	    }
	}
    }
    return $to_func;
}

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3