X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=rsem-plot-transcript-wiggles;h=46a71aaee21ea7abc7d45533db12b93812c7230a;hb=a1dc3c6c442d288c7f4218cbb8b7a54f08e9d980;hp=5054f5bc0d4fa3256bc4ac4899162c4b4e570847;hpb=fc69cf6af24c0550e55447fc82f01cb6f90c1c42;p=rsem.git diff --git a/rsem-plot-transcript-wiggles b/rsem-plot-transcript-wiggles index 5054f5b..46a71aa 100755 --- a/rsem-plot-transcript-wiggles +++ b/rsem-plot-transcript-wiggles @@ -19,8 +19,12 @@ pod2usage(-msg => "Invalid number of arguments!", -exitval => 2, -verbose => 2) my ($fn, $dir, $suf) = fileparse($0); my $command = ""; +unless (-e "$ARGV[0].transcript.sorted.bam") { + $command = $dir."sam/samtools sort $ARGV[0].transcript.bam $ARGV[0].transcript.sorted"; + &runCommand($command); +} unless (-e "$ARGV[0].transcript.readdepth") { - $command = $dir."rsem-bam2readdepth $ARGV[0].transcript.sorted.bam > $ARGV[0].transcript.readdepth"; + $command = $dir."rsem-bam2readdepth $ARGV[0].transcript.sorted.bam $ARGV[0].transcript.readdepth"; &runCommand($command); } @@ -34,7 +38,7 @@ if ($show_unique) { &runCommand($command); } unless (-e "$ARGV[0].uniq.transcript.readdepth") { - $command = $dir."rsem-bam2readdepth $ARGV[0].uniq.transcript.sorted.bam > $ARGV[0].uniq.transcript.readdepth"; + $command = $dir."rsem-bam2readdepth $ARGV[0].uniq.transcript.sorted.bam $ARGV[0].uniq.transcript.readdepth"; &runCommand($command); } } @@ -42,6 +46,7 @@ if ($show_unique) { $command = $dir."rsem-gen-transcript-plots $ARGV[0] $ARGV[1] $gene_list $show_unique $ARGV[2]"; &runCommand($command); + # command, {err_msg} sub runCommand { print $_[0]."\n"; @@ -49,7 +54,7 @@ sub runCommand { if ($status != 0) { my $errmsg; if (scalar(@_) > 1) { $errmsg = $_[1]; } - else { $errmsg = "\"$command\" failed! Plase check if you provide correct parameters/options for the pipeline!"; } + else { $errmsg = "\"$command\" failed! Please check if you provide correct parameters/options for the pipeline!"; } print $errmsg."\n"; exit(-1); }