X-Git-Url: https://git.donarmstrong.com/?p=rsem.git;a=blobdiff_plain;f=convert-sam-for-rsem;h=c0776162e064ef7bec9eeefbdf0412be4a22f8ad;hp=7d60f70974fa7db3dc1b96d615771bd7c23b1206;hb=636b82d9f60ebcbec7ef1b73ba23bbbacfd8b36a;hpb=0165dcc248203dce454881b6f1707cdf248497c2 diff --git a/convert-sam-for-rsem b/convert-sam-for-rsem index 7d60f70..c077616 100755 --- a/convert-sam-for-rsem +++ b/convert-sam-for-rsem @@ -1,11 +1,15 @@ -#!/usr/bin/perl +#!/usr/bin/env perl use Getopt::Long; use Pod::Usage; +use FindBin; +use lib $FindBin::Bin; use File::Basename; use File::Path 'rmtree'; use strict; +use rsem_perl_utils; + my ($in_file, $out_file) = (); my @tmp_dirs = (); @@ -29,7 +33,7 @@ $suf = lc(substr($suf, 1)); pod2usage(-msg => "Input file's suffix is neither sam nor bam!", -exitval => 2, -verbose => 2) if (($suf ne "sam") && ($suf ne "bam")); my $isSam = ($suf eq "sam"); -($fn, $dir, $suf) = fileparse($0); +$dir = "$FindBin::Bin/"; my $temp_dir = "$out_file.temp"; if (-d $temp_dir) { print "Warning: $temp_dir exists, convert-sam-for-rsem will write temporary files into this folder and delete it after it finishes!\n"; } @@ -79,21 +83,6 @@ print STDERR "Conversion is completed. $out_file will be checked by 'rsem-sam-va $command = $dir."rsem-sam-validator $out_file"; &runCommand($command); - -# command, {err_msg} -sub runCommand { - print $_[0]."\n"; - my $status = system($_[0]); - if ($status != 0) { - my $errmsg; - if (scalar(@_) > 1) { $errmsg = $_[1]; } - else { $errmsg = "\"$command\" failed! Please check if you provide correct parameters/options for the pipeline!"; } - print $errmsg."\n"; - exit(-1); - } - print "\n"; -} - __END__ =head1 NAME @@ -102,11 +91,7 @@ convert-sam-for-rsem =head1 SYNOPSIS -=over - - convert-sam-for-rsem [options] output_file_name - -=back +convert-sam-for-rsem [options] output_file_name =head1 ARGUMENTS