annotate flexbar.pl @ 1:a8399cb4972b

Uploaded Flexbar perl tool wrapper file flexbar.pl
author jtilman
date Sun, 30 Dec 2012 14:01:39 -0500
parents
children f0bdf862ba39
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
a8399cb4972b Uploaded Flexbar perl tool wrapper file flexbar.pl
jtilman
parents:
diff changeset
1 #!/usr/bin/env perl
a8399cb4972b Uploaded Flexbar perl tool wrapper file flexbar.pl
jtilman
parents:
diff changeset
2
a8399cb4972b Uploaded Flexbar perl tool wrapper file flexbar.pl
jtilman
parents:
diff changeset
3 # Author: Johannes T. Roehr
a8399cb4972b Uploaded Flexbar perl tool wrapper file flexbar.pl
jtilman
parents:
diff changeset
4
a8399cb4972b Uploaded Flexbar perl tool wrapper file flexbar.pl
jtilman
parents:
diff changeset
5 use warnings;
a8399cb4972b Uploaded Flexbar perl tool wrapper file flexbar.pl
jtilman
parents:
diff changeset
6 use strict;
a8399cb4972b Uploaded Flexbar perl tool wrapper file flexbar.pl
jtilman
parents:
diff changeset
7
a8399cb4972b Uploaded Flexbar perl tool wrapper file flexbar.pl
jtilman
parents:
diff changeset
8 my $flexbarDir = "";
a8399cb4972b Uploaded Flexbar perl tool wrapper file flexbar.pl
jtilman
parents:
diff changeset
9
a8399cb4972b Uploaded Flexbar perl tool wrapper file flexbar.pl
jtilman
parents:
diff changeset
10 my $pwd = $ENV{PWD};
a8399cb4972b Uploaded Flexbar perl tool wrapper file flexbar.pl
jtilman
parents:
diff changeset
11
a8399cb4972b Uploaded Flexbar perl tool wrapper file flexbar.pl
jtilman
parents:
diff changeset
12 my $lastIdx = $#ARGV;
a8399cb4972b Uploaded Flexbar perl tool wrapper file flexbar.pl
jtilman
parents:
diff changeset
13 my $format = $ARGV[$lastIdx];
a8399cb4972b Uploaded Flexbar perl tool wrapper file flexbar.pl
jtilman
parents:
diff changeset
14 my $folder = $ARGV[$lastIdx - 1];
a8399cb4972b Uploaded Flexbar perl tool wrapper file flexbar.pl
jtilman
parents:
diff changeset
15 my $id = $ARGV[$lastIdx - 2];
a8399cb4972b Uploaded Flexbar perl tool wrapper file flexbar.pl
jtilman
parents:
diff changeset
16 my $outFile = $ARGV[$lastIdx - 3];
a8399cb4972b Uploaded Flexbar perl tool wrapper file flexbar.pl
jtilman
parents:
diff changeset
17
a8399cb4972b Uploaded Flexbar perl tool wrapper file flexbar.pl
jtilman
parents:
diff changeset
18 my $call = join " ", @ARGV[0..($lastIdx - 4)];
a8399cb4972b Uploaded Flexbar perl tool wrapper file flexbar.pl
jtilman
parents:
diff changeset
19
a8399cb4972b Uploaded Flexbar perl tool wrapper file flexbar.pl
jtilman
parents:
diff changeset
20 system $flexbarDir . $call .' --target reads > '. $outFile;
a8399cb4972b Uploaded Flexbar perl tool wrapper file flexbar.pl
jtilman
parents:
diff changeset
21
a8399cb4972b Uploaded Flexbar perl tool wrapper file flexbar.pl
jtilman
parents:
diff changeset
22 foreach(<$pwd ."/reads"*>){
a8399cb4972b Uploaded Flexbar perl tool wrapper file flexbar.pl
jtilman
parents:
diff changeset
23
a8399cb4972b Uploaded Flexbar perl tool wrapper file flexbar.pl
jtilman
parents:
diff changeset
24 if(/^\.\//){
a8399cb4972b Uploaded Flexbar perl tool wrapper file flexbar.pl
jtilman
parents:
diff changeset
25 my $file = $pwd ."/". $_;
a8399cb4972b Uploaded Flexbar perl tool wrapper file flexbar.pl
jtilman
parents:
diff changeset
26
a8399cb4972b Uploaded Flexbar perl tool wrapper file flexbar.pl
jtilman
parents:
diff changeset
27 s/^\.\///;
a8399cb4972b Uploaded Flexbar perl tool wrapper file flexbar.pl
jtilman
parents:
diff changeset
28 my $fileType;
a8399cb4972b Uploaded Flexbar perl tool wrapper file flexbar.pl
jtilman
parents:
diff changeset
29
a8399cb4972b Uploaded Flexbar perl tool wrapper file flexbar.pl
jtilman
parents:
diff changeset
30 $fileType = $1 if /\.(\w+)$/;
a8399cb4972b Uploaded Flexbar perl tool wrapper file flexbar.pl
jtilman
parents:
diff changeset
31 $fileType = $format if /\.\w+fast\w$/;
a8399cb4972b Uploaded Flexbar perl tool wrapper file flexbar.pl
jtilman
parents:
diff changeset
32 $fileType = 'tabular' if $fileType eq 'lengthdist';
a8399cb4972b Uploaded Flexbar perl tool wrapper file flexbar.pl
jtilman
parents:
diff changeset
33
a8399cb4972b Uploaded Flexbar perl tool wrapper file flexbar.pl
jtilman
parents:
diff changeset
34 s/_//g;
a8399cb4972b Uploaded Flexbar perl tool wrapper file flexbar.pl
jtilman
parents:
diff changeset
35
a8399cb4972b Uploaded Flexbar perl tool wrapper file flexbar.pl
jtilman
parents:
diff changeset
36 my $name = "primary_". $id ."_". $_ ."_visible_". $fileType;
a8399cb4972b Uploaded Flexbar perl tool wrapper file flexbar.pl
jtilman
parents:
diff changeset
37
a8399cb4972b Uploaded Flexbar perl tool wrapper file flexbar.pl
jtilman
parents:
diff changeset
38 rename $file, $name;
a8399cb4972b Uploaded Flexbar perl tool wrapper file flexbar.pl
jtilman
parents:
diff changeset
39 rename $name, $folder;
a8399cb4972b Uploaded Flexbar perl tool wrapper file flexbar.pl
jtilman
parents:
diff changeset
40 }
a8399cb4972b Uploaded Flexbar perl tool wrapper file flexbar.pl
jtilman
parents:
diff changeset
41 }
a8399cb4972b Uploaded Flexbar perl tool wrapper file flexbar.pl
jtilman
parents:
diff changeset
42