annotate runAssembly_cDNA_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 #!/usr/bin/env perl
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
2
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
3 use warnings;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
4 use strict;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
5 use File::Copy;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
6
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
7 # EXPECT 23 FILE HANDLES, SOME OF WHICH MAY BE 'None'
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
8 die("Missing arguments; expected at least 23, got ".scalar(@ARGV)."\n") unless @ARGV >= 23;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
9 my $outdir=shift @ARGV;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
10 my $newbler_metrics=shift @ARGV;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
11 my $read_status=shift @ARGV;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
12 my $trimmed_reads_fasta=shift @ARGV;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
13 my $trimmed_reads_qual=shift @ARGV;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
14 my $alignment_info=shift @ARGV;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
15 my $all_contigs_fasta=shift @ARGV;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
16 my $all_contigs_qual=shift @ARGV;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
17 my $contigs_ace=shift @ARGV;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
18 my $contigs_consed_ace=shift @ARGV;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
19 my $contig_graph=shift @ARGV;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
20 my $pair_align=shift @ARGV;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
21 my $pair_status=shift @ARGV;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
22 my $scaffolds_fasta=shift @ARGV;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
23 my $scaffolds_qual=shift @ARGV;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
24 my $scaffolds_agp=shift @ARGV;
3
bf1f8bc4abe6 minor updates for v2.6
eskirton@lbl.gov
parents: 2
diff changeset
25 my $contig_scaffolds_agp=shift @ARGV;
2
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
26 my $tag_pair_align=shift @ARGV;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
27 my $trim_status=shift @ARGV;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
28 my $isotigs_ace=shift @ARGV;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
29 my $isotigs_fasta=shift @ARGV;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
30 my $isotigs_qual=shift @ARGV;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
31 my $isotigs_agp=shift @ARGV;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
32 my $isotigs_layout=shift @ARGV;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
33
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
34 # REMOVE PARAMETERS FOR OPTIONAL FILES WHICH WERE NOT PROVIDED
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
35
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
36 my @cmd=removeUnusedOptions(@ARGV);
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
37
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
38 # RUN COMMAND
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
39 my $stderr;
3
bf1f8bc4abe6 minor updates for v2.6
eskirton@lbl.gov
parents: 2
diff changeset
40 eval { $stderr=`runAssembly @cmd 2>&1`; };
2
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
41 if ( $@ ) {
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
42 print STDERR "Newbler ERROR: $stderr\n";
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
43 `cat $outdir/assembly/454NewblerProgress.txt 1>&2`;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
44 die($@);
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
45 }
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
46
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
47 get_outfile("$outdir/454NewblerMetrics.txt", $newbler_metrics);
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
48 get_outfile("$outdir/454ReadStatus.txt", $read_status);
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
49 get_outfile("$outdir/454TrimmedReads.fna", $trimmed_reads_fasta);
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
50 get_outfile("$outdir/454TrimmedReads.qual", $trimmed_reads_qual);
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
51 get_outfile("$outdir/454AlignmentInfo.tsv", $alignment_info);
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
52 get_outfile("$outdir/454AllContigs.fna", $all_contigs_fasta);
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
53 get_outfile("$outdir/454AllContigs.qual", $all_contigs_qual);
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
54 get_outfile("$outdir/454Contigs.ace", $contigs_ace);
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
55 get_outfile("$outdir/consed/edit_dir/454Contigs.ace.1", $contigs_consed_ace);
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
56 get_outfile("$outdir/454ContigGraph.txt", $contig_graph);
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
57 get_outfile("$outdir/454PairAlign.txt", $pair_align);
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
58 get_outfile("$outdir/454PairStatus.txt", $pair_status);
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
59 get_outfile("$outdir/454Scaffolds.fna", $scaffolds_fasta);
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
60 get_outfile("$outdir/454Scaffolds.qual", $scaffolds_qual);
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
61 get_outfile("$outdir/454Scaffolds.txt", $scaffolds_agp);
3
bf1f8bc4abe6 minor updates for v2.6
eskirton@lbl.gov
parents: 2
diff changeset
62 get_outfile("$outdir/454ContigScaffolds.txt", $contig_scaffolds_agp);
2
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
63 get_outfile("$outdir/454TagPairAlign.txt", $tag_pair_align);
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
64 get_outfile("$outdir/454TrimStatus.txt", $trim_status);
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
65 get_outfile("$outdir/454Isotigs.ace", $isotigs_ace);
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
66 get_outfile("$outdir/454Isotigs.fna", $isotigs_fasta);
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
67 get_outfile("$outdir/454Isotigs.qual", $isotigs_qual);
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
68 get_outfile("$outdir/454Isotigs.txt", $isotigs_agp);
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
69 get_outfile("$outdir/454IsotigsLayout.txt", $isotigs_layout);
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
70 exit;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
71
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
72 # EVERY 'None' ARG AND IT'S PRECEEDING OPTION TAG ARE DISCARDED
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
73 sub removeUnusedOptions {
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
74 my @cmd=();
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
75 my $prev;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
76 foreach (@_) {
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
77 unless ($_ eq 'None') {
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
78 push @cmd, $prev if defined($prev);
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
79 $prev=$_;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
80 } else {
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
81 $prev=undef;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
82 }
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
83 }
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
84 push @cmd, $prev if defined($prev);
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
85 return @cmd;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
86 }
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
87
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
88 sub get_outfile {
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
89 my ($src, $dest)=@_;
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
90 # make sure dest defined and src exist; skip if dest is 'None'
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
91 if ( $dest and $dest ne 'None' and $src and -f $src ) {
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
92 move($src,$dest);
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
93 }
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
94 }
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
95
2d86d5b112e8 Uploaded
edward-kirton
parents:
diff changeset
96 __END__