Mercurial > repos > jtilman > flexbar
changeset 10:f0bdf862ba39
Simplified perl wrapper.
author | jtilman |
---|---|
date | Mon, 31 Dec 2012 18:40:01 +0100 |
parents | cb6deaad121f |
children | 52c5e53aff28 |
files | flexbar.pl |
diffstat | 1 files changed, 19 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/flexbar.pl Mon Dec 31 00:50:58 2012 +0100 +++ b/flexbar.pl Mon Dec 31 18:40:01 2012 +0100 @@ -5,38 +5,29 @@ use warnings; use strict; -my $flexbarDir = ""; - -my $pwd = $ENV{PWD}; +my $format = pop @ARGV; +my $folder = pop @ARGV; +my $id = pop @ARGV; +my $outFile = pop @ARGV; -my $lastIdx = $#ARGV; -my $format = $ARGV[$lastIdx]; -my $folder = $ARGV[$lastIdx - 1]; -my $id = $ARGV[$lastIdx - 2]; -my $outFile = $ARGV[$lastIdx - 3]; +my $call = join " ", @ARGV; -my $call = join " ", @ARGV[0..($lastIdx - 4)]; +system $call .' --target reads > '. $outFile and exit 1; -system $flexbarDir . $call .' --target reads > '. $outFile; -foreach(<$pwd ."/reads"*>){ +foreach(<reads*>){ - if(/^\.\//){ - my $file = $pwd ."/". $_; - - s/^\.\///; - my $fileType; - - $fileType = $1 if /\.(\w+)$/; - $fileType = $format if /\.\w+fast\w$/; - $fileType = 'tabular' if $fileType eq 'lengthdist'; - - s/_//g; - - my $name = "primary_". $id ."_". $_ ."_visible_". $fileType; - - rename $file, $name; - rename $name, $folder; - } + my $fileType; + + $fileType = $1 if /\.(\w+)$/; + $fileType = $format if /\.\w+fast\w$/; + $fileType = 'tabular' if $fileType eq 'lengthdist'; + + s/_//g; + + my $name = "primary_". $id ."_". $_ ."_visible_". $fileType; + + rename $_, $name; + rename $name, $folder; }