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

View of /FigKernelScripts/pg_compute_corr.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (download) (as text) (annotate)
Sat Sep 7 12:41:57 2013 UTC (6 years, 2 months ago) by overbeek
Branch: MAIN
CVS Tags: rast_rel_2014_0729, rast_rel_2014_0912, HEAD
Changes since 1.2: +2 -2 lines
handle extraction of genome id better

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

my $usage = "usage: pg_compute_corr -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 @genome_dirs = $pg->genome_dirs();

my @todo;
@genome_dirs = sort @genome_dirs;
mkdir("$dataD/Corr",0777);
my($i,$j);
for ($i=0; ($i < $#genome_dirs); $i++)
{
    my $g1 = ($genome_dirs[$i] =~ /\b(\d+\.\d+)$/ ) ? $1 : '';
    
    for ($j=$i+1; ($j < @genome_dirs); $j++)
    {
	my $g2 = ($genome_dirs[$j] =~ /\b(\d+\.\d+)$/ ) ? $1 : '';
	if ($g1 && $g2)
	{
	    my $out = "$dataD/Corr/$g1-$g2";
	    if (! -s $out)
	    {
		push(@todo,"svr_corresponding_genes2 $genome_dirs[$i] $genome_dirs[$j] > $out");
	    }
	}
    }
}

&pareach(\@todo,\&run,{ Max_Workers => 8 });

sub run {
    my($cmd) = @_;

#    print STDERR "running: $cmd\n";
    my $rc = system($cmd);
    if ($rc)
    {
	die "$rc: $cmd failed";
    }
}

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3