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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1, Tue Feb 12 22:00:03 2013 UTC revision 1.2, Wed Feb 13 20:42:16 2013 UTC
# Line 1  Line 1 
1    use File::Basename;
2    use lib '../FigKernelPackages';
3  use strict;  use strict;
4  use Proc::ParallelLoop;  use Proc::ParallelLoop;
5  use gjoseqlib;  use gjoseqlib;
# Line 7  Line 9 
9  # Given N files, each of which contains a header line with the tag for the  # Given N files, each of which contains a header line with the tag for the
10  # set, and the rest is a set of fasta files to be processed for that set.  # set, and the rest is a set of fasta files to be processed for that set.
11  #  #
12  # Writes out N files with the kmers found in heach.  # Writes out N files with the kmers found in each.
13  #  #
14    
15    my $k = 25;
16  my $nprocs = 6;  my $nprocs = 6;
17  my @files = @ARGV;  my @files = @ARGV;
18    
# Line 30  Line 33 
33          my($tag, $file) = @$ent;          my($tag, $file) = @$ent;
34    
35          open(my $fh, "<", $file) or die "Cannot open $file; $!";          open(my $fh, "<", $file) or die "Cannot open $file; $!";
36            my $base = basename($file);
37            open(my $out, ">", "out/$base") or die"Cannot open out/$file: $!";
38    
39          while (my($id, $def, $seq) = read_next_fasta_seq($fh))          while (my($id, $def, $seq) = read_next_fasta_seq($fh))
40          {          {
41              print "Got $id for $tag\n";              my $s = length($seq);
42                for (my $i=0; ($i < (length($seq) - $k)); $i++)
43                {
44                    my $kmer = uc substr($seq,$i,$k);
45                    if ($kmer !~ /[^ACDEFGHIKLMNPQRSTVWY]/)
46                    {
47                        print $out $kmer, "\t", $tag, "\n";
48                    }
49                }
50          }          }
51    
52          close($fh);          close($fh);

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3