2
|
1 #!/jgi/tools/bin/perl -w
|
|
2
|
|
3 use strict;
|
|
4 use File::Copy;
|
|
5
|
|
6 # EXPECT 21 FILE HANDLES, SOME OF WHICH MAY BE 'None'
|
|
7 die("Missing arguments; expected at least 21, got ".scalar(@ARGV)."\n") unless @ARGV >= 21;
|
|
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;
|
3
|
26 my $contigs_bam=shift @ARGV;
|
2
|
27 my $large_contigs_fasta=shift @ARGV;
|
|
28 my $large_contigs_qual=shift @ARGV;
|
|
29 my $gene_status=shift @ARGV;
|
|
30
|
|
31 # REMOVE PARAMETERS FOR OPTIONAL FILES WHICH WERE NOT PROVIDED
|
|
32
|
|
33 my @cmd=removeUnusedOptions(@ARGV);
|
|
34
|
|
35 # RUN COMMAND
|
|
36 my $stderr;
|
3
|
37 eval { $stderr=`runMapping @cmd 2>&1`; };
|
2
|
38 if ( $@ ) {
|
|
39 print STDERR "Newbler ERROR: $stderr\n";
|
|
40 `cat $outdir/assembly/454NewblerProgress.txt 1>&2`;
|
|
41 die($@);
|
|
42 }
|
|
43
|
|
44 get_outfile("$outdir/454AlignmentInfo.tsv", $alignment_info);
|
|
45 get_outfile("$outdir/454AllContigs.fna", $all_contigs_fasta);
|
|
46 get_outfile("$outdir/454AllContigs.qual", $all_contigs_qual);
|
|
47 get_outfile("$outdir/454AllDiffs.txt", $all_diffs);
|
|
48 get_outfile("$outdir/454AllStructVars.txt", $all_struct_vars);
|
|
49 get_outfile("$outdir/454HCDiff.txt", $hc_diff);
|
|
50 get_outfile("$outdir/454HCStructVars.txt", $hc_struct_vars);
|
|
51 get_outfile("$outdir/454MappingQC.xls", $mapping_qc);
|
|
52 get_outfile("$outdir/454NewblerMetrics.txt", $newbler_metrics);
|
|
53 get_outfile("$outdir/454PairAlign.txt", $pair_align);
|
|
54 get_outfile("$outdir/454ReadStatus.txt", $read_status);
|
|
55 get_outfile("$outdir/454RefStatus.txt", $ref_status);
|
|
56 get_outfile("$outdir/454TagPairAlign.txt", $tag_pair_align);
|
|
57 get_outfile("$outdir/454TrimStatus.txt", $trim_status);
|
|
58 get_outfile("$outdir/454TrimmedReads.fna", $trimmed_reads_fasta);
|
|
59 get_outfile("$outdir/454TrimmedReads.qual", $trimmed_reads_qual);
|
|
60 get_outfile("$outdir/454Contigs.ace", $contigs_ace);
|
3
|
61 get_outfile("$outdir/454Contigs.bam", $contigs_bam);
|
2
|
62 get_outfile("$outdir/454LargeContigs.fna", $large_contigs_fasta);
|
|
63 get_outfile("$outdir/454LargeContigs.qual", $large_contigs_qual);
|
|
64 get_outfile("$outdir/454GeneStatus.txt", $gene_status);
|
|
65 exit;
|
|
66
|
|
67 # EVERY 'None' ARG AND IT'S PRECEEDING OPTION TAG ARE DISCARDED
|
|
68 sub removeUnusedOptions {
|
|
69 my @cmd=();
|
|
70 my $prev;
|
|
71 foreach (@_) {
|
|
72 unless ($_ eq 'None') {
|
|
73 push @cmd, $prev if defined($prev);
|
|
74 $prev=$_;
|
|
75 } else {
|
|
76 $prev=undef;
|
|
77 }
|
|
78 }
|
|
79 push @cmd, $prev if defined($prev);
|
|
80 return @cmd;
|
|
81 }
|
|
82
|
|
83 sub get_outfile {
|
|
84 my ($src, $dest)=@_;
|
|
85 # make sure dest defined and src exist; skip if dest is 'None'
|
|
86 if ( $dest and $dest ne 'None' and $src and -f $src ) {
|
|
87 move($src,$dest);
|
|
88 }
|
|
89 }
|
|
90
|
|
91 __END__
|