1
|
1 #!/usr/bin/env perl
|
|
2
|
|
3 # Author: Johannes T. Roehr
|
|
4
|
|
5 use warnings;
|
|
6 use strict;
|
|
7
|
|
8 my $flexbarDir = "";
|
|
9
|
|
10 my $pwd = $ENV{PWD};
|
|
11
|
|
12 my $lastIdx = $#ARGV;
|
|
13 my $format = $ARGV[$lastIdx];
|
|
14 my $folder = $ARGV[$lastIdx - 1];
|
|
15 my $id = $ARGV[$lastIdx - 2];
|
|
16 my $outFile = $ARGV[$lastIdx - 3];
|
|
17
|
|
18 my $call = join " ", @ARGV[0..($lastIdx - 4)];
|
|
19
|
|
20 system $flexbarDir . $call .' --target reads > '. $outFile;
|
|
21
|
|
22 foreach(<$pwd ."/reads"*>){
|
|
23
|
|
24 if(/^\.\//){
|
|
25 my $file = $pwd ."/". $_;
|
|
26
|
|
27 s/^\.\///;
|
|
28 my $fileType;
|
|
29
|
|
30 $fileType = $1 if /\.(\w+)$/;
|
|
31 $fileType = $format if /\.\w+fast\w$/;
|
|
32 $fileType = 'tabular' if $fileType eq 'lengthdist';
|
|
33
|
|
34 s/_//g;
|
|
35
|
|
36 my $name = "primary_". $id ."_". $_ ."_visible_". $fileType;
|
|
37
|
|
38 rename $file, $name;
|
|
39 rename $name, $folder;
|
|
40 }
|
|
41 }
|
|
42
|