Mercurial > repos > edward-kirton > velvet_toolsuite
annotate velvet/velvetg_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 |
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 # Conventience wrapper for velvetg; copies outfiles to galaxy-specified destinations. |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
4 # Please email bugs/feature requests to Edward Kirton (ESKirton@LBL.gov) |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
5 # |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
6 # History: |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
7 # - 2010/03/04 : file created |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
8 # - 2001/02/05 : added new options, outfiles; renamed to velvetg_jgi to avoid collision with the other velvetg tool |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
9 |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
10 use strict; |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
11 use warnings; |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
12 use File::Copy; |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
13 |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
14 # shift wrapper args |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
15 my $velveth_path=shift @ARGV or die; |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
16 my $velvetg_path=shift @ARGV or die; |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
17 my $velvetg_outfile=shift @ARGV or die; |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
18 my $contigs_outfile=shift @ARGV or die; |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
19 my $stats_outfile=shift @ARGV or die; |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
20 my $lastgraph_outfile=shift @ARGV or die; |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
21 my $unused_reads_outfile=shift @ARGV or die; |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
22 my $amos_outfile=shift @ARGV or die; |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
23 |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
24 # setup velvetg folder |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
25 die("Velveth folder does not exist: $velveth_path\n") unless -d $velveth_path; |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
26 -d $velvetg_path or mkdir($velvetg_path) or die("Unable to create output folder, $velvetg_path: $!\n"); |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
27 die("velveth Sequences file does not exist: $velveth_path/Sequences") unless -f "$velveth_path/Sequences"; |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
28 symlink("$velveth_path/Sequences", "$velvetg_path/Sequences"); |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
29 die("velveth Roadmaps file does not exist: $velveth_path/Roadmaps") unless -f "$velveth_path/Roadmaps"; |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
30 symlink("$velveth_path/Roadmaps", "$velvetg_path/Roadmaps"); |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
31 die("velveth Log file does not exist: $velveth_path/Log") unless -f "$velveth_path/Log"; |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
32 copy("$velveth_path/Log", "$velvetg_path/Log"); |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
33 |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
34 # run command (remaining args, starting with exe path) |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
35 open (VELVETG, "@ARGV|") or die("Unable to run velvetg\n"); |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
36 open (OUT, ">$velvetg_outfile") or die("Unable to open outfile, $velvetg_outfile: $!\n"); |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
37 while (<VELVETG>) { |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
38 print OUT $_; |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
39 print if /^Final graph/; |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
40 } |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
41 close VELVETG; |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
42 close OUT; |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
43 |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
44 # process output |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
45 unlink($contigs_outfile); |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
46 move("$velvetg_path/contigs.fa", $contigs_outfile); |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
47 unlink($stats_outfile); |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
48 move("$velvetg_path/stats.txt", $stats_outfile); |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
49 |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
50 unlink($lastgraph_outfile); |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
51 if ( -f "$velvetg_path/LastGraph") { |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
52 move("$velvetg_path/LastGraph", $lastgraph_outfile); |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
53 } elsif ( -f "$velvetg_path/Graph2") { |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
54 move("$velvetg_path/Graph2", $lastgraph_outfile); |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
55 } else { |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
56 open(OUT, ">$lastgraph_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
|
57 print OUT "ERROR: $velvetg_path/LastGraph not found!\n"; |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
58 close OUT; |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
59 } |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
60 unlink($unused_reads_outfile); |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
61 move("$velvetg_path/UnusedReads.fa", $unused_reads_outfile); |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
62 if ( $amos_outfile ne 'None' ) { |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
63 unlink($amos_outfile); |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
64 move("$velvetg_path/velvet_asm.afg", $amos_outfile); |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
65 } |
4afe13ac23b6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
66 exit; |