From 683863b75f8d8bef2461039a6911b0e9619cc113 Mon Sep 17 00:00:00 2001 From: Bo Li Date: Sat, 21 Jul 2012 21:11:07 -0500 Subject: [PATCH] Fixed a bug in perl scripts for printing error messages --- convert-sam-for-rsem | 8 ++++---- rsem-calculate-expression | 12 ++++++------ rsem-generate-ngvector | 8 ++++---- rsem-plot-transcript-wiggles | 1 + rsem-prepare-reference | 12 ++++++------ 5 files changed, 21 insertions(+), 20 deletions(-) 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"; } -- 2.39.2