comparison flexbar.pl @ 38:216a55a39b52 draft

Uploaded
author jtilman
date Sun, 01 Jul 2018 06:46:26 -0400
parents
children 2fcee21876db
comparison
equal deleted inserted replaced
37:497da23fee84 38:216a55a39b52
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
16 if($arg =~ /\.(fastq\w+)$/ || $arg =~ /\.(fastq\w+\.gz)$/){
17
18 $format = $1;
19 my $file = $arg;
20
21 $arg =~ s/\.fastq\w+$/\.fastq/;
22 $arg =~ s/\.fastq\w+\.gz$/\.fastq\.gz/;
23
24 $ARGV[$_] = $arg;
25 rename $file, $arg;
26
27 push @inFiles, $arg if $arg =~ /\.dat_input\.fastq$/ || $arg =~ /\.dat_input\.fastq\.gz$/;
28 push @outFiles, $arg if $arg =~ /\.dat\.fastq$/ || $arg =~ /\.dat\.fastq\.gz$/;
29 }
30 }
31
32 my $call = join " ", @ARGV;
33
34 system $call and exit 1;
35
36
37 unlink $_ or warn "Could not unlink $_: $!" foreach(@inFiles);
38
39 foreach(@outFiles){
40
41 my $file = $_;
42
43 s/\.fastq$//;
44 s/\.fastq\.gz$//;
45
46 rename $file, $_;
47 }
48