From: Bo Li Date: Sun, 22 Jul 2012 02:11:07 +0000 (-0500) Subject: Fixed a bug in perl scripts for printing error messages X-Git-Url: https://git.donarmstrong.com/?p=rsem.git;a=commitdiff_plain;h=683863b75f8d8bef2461039a6911b0e9619cc113 Fixed a bug in perl scripts for printing error messages --- diff --git a/convert-sam-for-rsem b/convert-sam-for-rsem index 13b9b13..decf861 100755 --- a/convert-sam-for-rsem +++ b/convert-sam-for-rsem @@ -82,16 +82,16 @@ $command = $dir."rsem-sam-validator $out_file"; # command, {err_msg} sub runCommand { - print STDERR $_[0]."\n"; + print $_[0]."\n"; my $status = system($_[0]); if ($status != 0) { my $errmsg; if (scalar(@_) > 1) { $errmsg = $_[1]; } - else { $errmsg = "\"$command\" failed! Plase check if you provide correct parameters/options for the script!"; } - print STDERR $errmsg."\n"; + else { $errmsg = "\"$command\" failed! Plase check if you provide correct parameters/options for the pipeline!"; } + print $errmsg."\n"; exit(-1); } - print STDERR "\n"; + print "\n"; } __END__ diff --git a/rsem-calculate-expression b/rsem-calculate-expression index 9e6ef2e..684e33c 100755 --- a/rsem-calculate-expression +++ b/rsem-calculate-expression @@ -345,12 +345,12 @@ if ($mTime) { sub runCommand { print $_[0]."\n"; my $status = system($_[0]); - 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!"; } - print $errmsg."\n"; - exit(-1); + if ($status != 0) { + my $errmsg = ""; + if (scalar(@_) > 1) { $errmsg .= $_[1]."\n"; } + $errmsg .= "\"$_[0]\" failed! Plase check if you provide correct parameters/options for the pipeline!\n"; + print $errmsg; + exit(-1); } print "\n"; } diff --git a/rsem-generate-ngvector b/rsem-generate-ngvector index c4d26a8..cd184b6 100755 --- a/rsem-generate-ngvector +++ b/rsem-generate-ngvector @@ -28,10 +28,10 @@ sub runCommand { print $_[0]."\n"; my $status = system($_[0]); 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!"; } - print $errmsg."\n"; + my $errmsg = ""; + if (scalar(@_) > 1) { $errmsg .= $_[1]."\n"; } + $errmsg .= "\"$_[0]\" failed! Plase check if you provide correct parameters/options for the pipeline!\n"; + print $errmsg; exit(-1); } print "\n"; diff --git a/rsem-plot-transcript-wiggles b/rsem-plot-transcript-wiggles index 25e8b35..37c7e27 100755 --- a/rsem-plot-transcript-wiggles +++ b/rsem-plot-transcript-wiggles @@ -46,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"; diff --git a/rsem-prepare-reference b/rsem-prepare-reference index 80a9549..56d6972 100755 --- a/rsem-prepare-reference +++ b/rsem-prepare-reference @@ -97,12 +97,12 @@ if (!$no_bowtie) { sub runCommand { print $_[0]."\n"; my $status = system($_[0]); - 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!"; } - print $errmsg."\n"; - exit(-1); + if ($status != 0) { + my $errmsg = ""; + if (scalar(@_) > 1) { $errmsg .= $_[1]."\n"; } + $errmsg .= "\"$_[0]\" failed! Plase check if you provide correct parameters/options for the pipeline!\n"; + print $errmsg; + exit(-1); } print "\n"; }