Mercurial > repos > edward-kirton > roche454_toolsuite
comparison runAssembly_wrapper.pl @ 2:2d86d5b112e8
Uploaded
author | edward-kirton |
---|---|
date | Thu, 14 Jul 2011 22:14:07 -0400 |
parents | |
children | bf1f8bc4abe6 |
comparison
equal
deleted
inserted
replaced
1:368a6ebebdde | 2:2d86d5b112e8 |
---|---|
1 #!/usr/bin/env perl | |
2 | |
3 use warnings; | |
4 use strict; | |
5 use File::Copy; | |
6 | |
7 # EXPECT 20 FILE HANDLES, SOME OF WHICH MAY BE 'None' | |
8 die("Missing arguments; expected at least 20, got ".scalar(@ARGV)."\n") unless @ARGV >= 20; | |
9 my $outdir=shift @ARGV; | |
10 my $newbler_metrics=shift @ARGV; | |
11 my $read_status=shift @ARGV; | |
12 my $trimmed_reads_fasta=shift @ARGV; | |
13 my $trimmed_reads_qual=shift @ARGV; | |
14 my $alignment_info=shift @ARGV; | |
15 my $all_contigs_fasta=shift @ARGV; | |
16 my $all_contigs_qual=shift @ARGV; | |
17 my $contigs_ace=shift @ARGV; | |
18 my $contigs_consed_ace=shift @ARGV; | |
19 my $contig_graph=shift @ARGV; | |
20 my $pair_align=shift @ARGV; | |
21 my $pair_status=shift @ARGV; | |
22 my $scaffolds_fasta=shift @ARGV; | |
23 my $scaffolds_qual=shift @ARGV; | |
24 my $scaffolds_agp=shift @ARGV; | |
25 my $tag_pair_align=shift @ARGV; | |
26 my $trim_status=shift @ARGV; | |
27 my $large_contigs_fasta=shift @ARGV; | |
28 my $large_contigs_qual=shift @ARGV; | |
29 | |
30 # REMOVE PARAMETERS FOR OPTIONAL FILES WHICH WERE NOT PROVIDED | |
31 | |
32 my @cmd=removeUnusedOptions(@ARGV); | |
33 | |
34 # RUN COMMAND | |
35 # NOTE: FIRST ARG EXPECTED TO BE EXECUTABLE | |
36 my $stderr; | |
37 eval { $stderr=`@cmd 2>&1`; }; | |
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/454NewblerMetrics.txt", $newbler_metrics); | |
45 get_outfile("$outdir/454ReadStatus.txt", $read_status); | |
46 get_outfile("$outdir/454TrimmedReads.fna", $trimmed_reads_fasta); | |
47 get_outfile("$outdir/454TrimmedReads.qual", $trimmed_reads_qual); | |
48 get_outfile("$outdir/454AlignmentInfo.tsv", $alignment_info); | |
49 get_outfile("$outdir/454AllContigs.fna", $all_contigs_fasta); | |
50 get_outfile("$outdir/454AllContigs.qual", $all_contigs_qual); | |
51 get_outfile("$outdir/454Contigs.ace", $contigs_ace); | |
52 get_outfile("$outdir/consed/edit_dir/454Contigs.ace.1", $contigs_consed_ace); | |
53 get_outfile("$outdir/454ContigGraph.txt", $contig_graph); | |
54 get_outfile("$outdir/454PairAlign.txt", $pair_align); | |
55 get_outfile("$outdir/454PairStatus.txt", $pair_status); | |
56 get_outfile("$outdir/454Scaffolds.fna", $scaffolds_fasta); | |
57 get_outfile("$outdir/454Scaffolds.qual", $scaffolds_qual); | |
58 get_outfile("$outdir/454Scaffolds.txt", $scaffolds_agp); | |
59 get_outfile("$outdir/454TagPairAlign.txt", $tag_pair_align); | |
60 get_outfile("$outdir/454TrimStatus.txt", $trim_status); | |
61 get_outfile("$outdir/454LargeContigs.fna", $large_contigs_fasta); | |
62 get_outfile("$outdir/454LargeContigs.qual", $large_contigs_qual); | |
63 exit; | |
64 | |
65 # EVERY 'None' ARG AND IT'S PRECEEDING OPTION TAG ARE DISCARDED | |
66 sub removeUnusedOptions { | |
67 my @cmd=(); | |
68 my $prev; | |
69 foreach (@_) { | |
70 unless ($_ eq 'None') { | |
71 push @cmd, $prev if defined($prev); | |
72 $prev=$_; | |
73 } else { | |
74 $prev=undef; | |
75 } | |
76 } | |
77 push @cmd, $prev if defined($prev); | |
78 return @cmd; | |
79 } | |
80 | |
81 sub get_outfile { | |
82 my ($src, $dest)=@_; | |
83 # make sure dest defined and src exist; skip if dest is 'None' | |
84 if ( $dest and $dest ne 'None' and $src and -f $src ) { | |
85 move($src,$dest); | |
86 } | |
87 } | |
88 | |
89 __END__ |