[Bio] / Kmers2 / multimerge.pl Repository:
ViewVC logotype

View of /Kmers2/multimerge.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (download) (as text) (annotate)
Fri Feb 15 21:27:38 2013 UTC (6 years, 9 months ago) by olson
Branch: MAIN
CVS Tags: HEAD
updates

use Data::Dumper;
use strict;
use Proc::ParallelLoop;

my $work = shift;
my @list = @ARGV;

my $tmp = "/space/partitions/tmp";
-d $work or mkdir($work)  or die "mkdir $work failed: $!";

my $n = 50;
my $n1 = $n + 1;

my $depth = 1;
my $nprocs = 2;

while (@list > 1)
{
    my @work;
    my $i = 1;
    my @new;
    while (@list)
    {
	my @c = splice(@list, 0, $n);
	my $out = "$work/merge.$depth.$i";
	push(@work, [\@c, $out]);
	$i++;
	push(@new, $out);
    }

    print Dumper(\@work);

    pareach \@work, sub {
	my($elt) = @_;
	my($list, $out_file) = @$elt;

	my $cmd = "sort --batch-size $n1 -S 20G -m --parallel 1 -T $tmp @$list > $out_file";
	print "$cmd\n";
	my $rc = system($cmd);
	if ($rc != 0)
	{
	    die "sort failed rc=$rc: $cmd\n";
	}
    }, { Max_Workers => $nprocs };
    
    @list = @new;
    $depth++;
}
print Dumper(\@list);

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3