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