Mercurial > repos > edward-kirton > roche454_toolsuite
annotate roche454/runMapping_wrapper.pl @ 0:f036c7107601
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:50:32 -0400 |
parents | |
children | 368a6ebebdde |
rev | line source |
---|---|
0
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
1 #!/jgi/tools/bin/perl -w |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
2 |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
3 use strict; |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
4 use File::Copy; |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
5 |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
6 # EXPECT 21 FILE HANDLES, SOME OF WHICH MAY BE 'None' |
f036c7107601
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; |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
8 my $alignment_info=shift @ARGV; |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
9 my $all_contigs_fasta=shift @ARGV; |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
10 my $all_contigs_qual=shift @ARGV; |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
11 my $all_diffs=shift @ARGV |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
12 my $all_struct_vars=shift @ARGV |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
13 my $hc_diff=shift @ARGV |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
14 my $hc_struct_vars=shift @ARGV |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
15 my $mapping_qc=shift @ARGV |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
16 my $newbler_metrics=shift @ARGV; |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
17 my $pair_align=shift @ARGV; |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
18 my $read_status=shift @ARGV; |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
19 my $ref_status=shift @ARGV; |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
20 my $tag_pair_align=shift @ARGV; |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
21 my $trim_status=shift @ARGV; |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
22 my $trimmed_reads_fasta=shift @ARGV; |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
23 my $trimmed_reads_qual=shift @ARGV; |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
24 my $contigs_ace=shift @ARGV; |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
25 my $large_contigs_fasta=shift @ARGV; |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
26 my $large_contigs_qual=shift @ARGV; |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
27 my $gene_status=shift @ARGV; |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
28 |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
29 # REMOVE PARAMETERS FOR OPTIONAL FILES WHICH WERE NOT PROVIDED |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
30 |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
31 my @cmd=removeUnusedOptions(@ARGV); |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
32 |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
33 # RUN COMMAND |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
34 # NOTE: FIRST ARG EXPECTED TO BE EXECUTABLE |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
35 my $stderr; |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
36 eval { $stderr=`@cmd 2>&1`; }; |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
37 if ( $@ ) { |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
38 print STDERR "Newbler ERROR: $stderr\n"; |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
39 `cat $outdir/assembly/454NewblerProgress.txt 1>&2`; |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
40 die($@); |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
41 } |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
42 |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
43 get_outfile("$outdir/454AlignmentInfo.tsv", $alignment_info); |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
44 get_outfile("$outdir/454AllContigs.fna", $all_contigs_fasta); |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
45 get_outfile("$outdir/454AllContigs.qual", $all_contigs_qual); |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
46 get_outfile("$outdir/454AllDiffs.txt", $all_diffs); |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
47 get_outfile("$outdir/454AllStructVars.txt", $all_struct_vars); |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
48 get_outfile("$outdir/454HCDiff.txt", $hc_diff); |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
49 get_outfile("$outdir/454HCStructVars.txt", $hc_struct_vars); |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
50 get_outfile("$outdir/454MappingQC.xls", $mapping_qc); |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
51 get_outfile("$outdir/454NewblerMetrics.txt", $newbler_metrics); |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
52 get_outfile("$outdir/454PairAlign.txt", $pair_align); |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
53 get_outfile("$outdir/454ReadStatus.txt", $read_status); |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
54 get_outfile("$outdir/454RefStatus.txt", $ref_status); |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
55 get_outfile("$outdir/454TagPairAlign.txt", $tag_pair_align); |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
56 get_outfile("$outdir/454TrimStatus.txt", $trim_status); |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
57 get_outfile("$outdir/454TrimmedReads.fna", $trimmed_reads_fasta); |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
58 get_outfile("$outdir/454TrimmedReads.qual", $trimmed_reads_qual); |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
59 get_outfile("$outdir/454Contigs.ace", $contigs_ace); |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
60 get_outfile("$outdir/454LargeContigs.fna", $large_contigs_fasta); |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
61 get_outfile("$outdir/454LargeContigs.qual", $large_contigs_qual); |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
62 get_outfile("$outdir/454GeneStatus.txt", $gene_status); |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
63 exit; |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
64 |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
65 # EVERY 'None' ARG AND IT'S PRECEEDING OPTION TAG ARE DISCARDED |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
66 sub removeUnusedOptions { |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
67 my @cmd=(); |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
68 my $prev; |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
69 foreach (@_) { |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
70 unless ($_ eq 'None') { |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
71 push @cmd, $prev if defined($prev); |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
72 $prev=$_; |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
73 } else { |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
74 $prev=undef; |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
75 } |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
76 } |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
77 push @cmd, $prev if defined($prev); |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
78 return @cmd; |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
79 } |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
80 |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
81 sub get_outfile { |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
82 my ($src, $dest)=@_; |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
83 # make sure dest defined and src exist; skip if dest is 'None' |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
84 if ( $dest and $dest ne 'None' and $src and -f $src ) { |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
85 move($src,$dest); |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
86 } |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
87 } |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
88 |
f036c7107601
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
edward-kirton
parents:
diff
changeset
|
89 __END__ |