38
|
1 #!/usr/bin/env perl
|
|
2
|
|
3 # Flexbar wrapper for Galaxy tool definition, version 3.4.2
|
|
4 # Author: Johannes Roehr
|
|
5
|
|
6 use warnings;
|
|
7 use strict;
|
|
8
|
|
9 my $format;
|
|
10 my @inFiles;
|
|
11 my @outFiles;
|
|
12
|
|
13 foreach(0..$#ARGV){
|
|
14 my $arg = $ARGV[$_];
|
|
15
|
40
|
16 if($arg =~ /\.(fastq\w+)$/ || $arg =~ /\.(fastq\w+\.gz)$/ || $arg =~ /\.(fastq\w+\.bz2)$/){
|
38
|
17
|
40
|
18 if(defined $format && $format ne $1){
|
|
19 print STDERR "Paired read files should have the same format.\n";
|
|
20 exit 1;
|
|
21 }
|
38
|
22 $format = $1;
|
40
|
23
|
38
|
24 my $file = $arg;
|
|
25
|
|
26 $arg =~ s/\.fastq\w+$/\.fastq/;
|
|
27 $arg =~ s/\.fastq\w+\.gz$/\.fastq\.gz/;
|
40
|
28 $arg =~ s/\.fastq\w+\.bz2$/\.fastq\.bz2/;
|
|
29
|
|
30 push @inFiles, $arg if $arg =~ /\.dat_input\.fastq$/ || $arg =~ /\.dat_input\.fastq\.gz$/ || $arg =~ /\.dat_input\.fastq\.bz2$/;
|
|
31 push @outFiles, $arg if $arg =~ /\.dat\.fastq$/ || $arg =~ /\.dat\.fastq\.gz$/ || $arg =~ /\.dat\.fastq\.bz2$/;
|
38
|
32
|
|
33 $ARGV[$_] = $arg;
|
|
34 rename $file, $arg;
|
|
35 }
|
|
36 }
|
|
37
|
|
38 my $call = join " ", @ARGV;
|
|
39
|
|
40 system $call and exit 1;
|
|
41
|
|
42
|
|
43 unlink $_ or warn "Could not unlink $_: $!" foreach(@inFiles);
|
|
44
|
|
45 foreach(@outFiles){
|
|
46
|
|
47 my $file = $_;
|
|
48
|
|
49 s/\.fastq$//;
|
|
50 s/\.fastq\.gz$//;
|
40
|
51 s/\.fastq\.bz2$//;
|
38
|
52
|
|
53 rename $file, $_;
|
|
54 }
|
|
55
|