annotate velvet/velveth_jgi_wrapper.pl @ 0:4afe13ac23b6 default tip

Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
author edward-kirton
date Tue, 07 Jun 2011 17:52:16 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
4afe13ac23b6 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
1 #!/usr/bin/env perl
4afe13ac23b6 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
2
4afe13ac23b6 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
3 use strict;
4afe13ac23b6 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
4 use warnings;
4afe13ac23b6 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
5 my $start=time;
4afe13ac23b6 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
6 my $outfile=shift @ARGV;
4afe13ac23b6 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
7 my $outdir=shift @ARGV;
4afe13ac23b6 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
8 my $kmer=$ARGV[2];
4afe13ac23b6 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
9 die ("USER ERROR: Hash length (kmer) must be odd!\n") unless $kmer % 2;
4afe13ac23b6 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
10 my $tot_reads=0;
4afe13ac23b6 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
11 open (VELVETH, "@ARGV 2>&1|") or die("Unable to run velveth: $!\n");
4afe13ac23b6 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
12 open(OUT, ">$outfile") or die($!);
4afe13ac23b6 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
13 while (<VELVETH>) {
4afe13ac23b6 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
14 print OUT $_;
4afe13ac23b6 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
15 if (/^\[\d+\.\d+\] (\d+) sequences found/) {
4afe13ac23b6 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
16 $tot_reads += $1;
4afe13ac23b6 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
17 }
4afe13ac23b6 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
18 }
4afe13ac23b6 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
19 close VELVETH;
4afe13ac23b6 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
20 close OUT;
4afe13ac23b6 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
21 die("No reads found\n") unless $tot_reads;
4afe13ac23b6 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
22 my $sec=time-$start;
4afe13ac23b6 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
23 my $min=int($sec/60);
4afe13ac23b6 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
24 $sec -= ($min*60);
4afe13ac23b6 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
25 my $hr=int($min/60);
4afe13ac23b6 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
26 $min -= ($hr*60);
4afe13ac23b6 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
27 print "$tot_reads processed in";
4afe13ac23b6 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
28 print " $hr hr" if $hr;
4afe13ac23b6 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
29 print " $min min" if $min;
4afe13ac23b6 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
30 print " $sec sec\n";
4afe13ac23b6 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff changeset
31 exit