[Bio] / Kmers2 / mk-dna-kmers.pl Repository:
ViewVC logotype

View of /Kmers2/mk-dna-kmers.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (download) (as text) (annotate)
Tue Feb 12 22:00:03 2013 UTC (6 years, 10 months ago) by olson
Branch: MAIN
initial version

use strict;
use Proc::ParallelLoop;
use gjoseqlib;
#
# Make DNA kmers.
#
# Given N files, each of which contains a header line with the tag for the
# set, and the rest is a set of fasta files to be processed for that set.
#
# Writes out N files with the kmers found in heach.
#

my $nprocs = 6;
my @files = @ARGV;

for my $inp (@files)
{
    open(I, "<", $inp) or die "Cannot open $inp: $!";

    my $tag = <I>;
    chomp $tag;

    my @work = <I>;
    chomp @work;

    @work = map { [$tag, $_] } @work;

    pareach \@work, sub {
	my $ent = shift;
	my($tag, $file) = @$ent;

	open(my $fh, "<", $file) or die "Cannot open $file; $!";

	while (my($id, $def, $seq) = read_next_fasta_seq($fh))
	{
	    print "Got $id for $tag\n";
	}

	close($fh);
    }, { Max_Workers => $nprocs };
	
}

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3