annotate runMapping_wrapper.pl @ 3:bf1f8bc4abe6 default tip

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