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