annotate flexbar.pl @ 38:216a55a39b52 draft

Uploaded
author jtilman
date Sun, 01 Jul 2018 06:46:26 -0400
parents
children 2fcee21876db
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
1 #!/usr/bin/env perl
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
2
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
3 # Flexbar wrapper for Galaxy tool definition, version 3.4.2
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
4 # Author: Johannes Roehr
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
5
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
6 use warnings;
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
7 use strict;
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
8
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
9 my $format;
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
10 my @inFiles;
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
11 my @outFiles;
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
12
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
13 foreach(0..$#ARGV){
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
14 my $arg = $ARGV[$_];
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
15
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
16 if($arg =~ /\.(fastq\w+)$/ || $arg =~ /\.(fastq\w+\.gz)$/){
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
17
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
18 $format = $1;
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
19 my $file = $arg;
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
20
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
21 $arg =~ s/\.fastq\w+$/\.fastq/;
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
22 $arg =~ s/\.fastq\w+\.gz$/\.fastq\.gz/;
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
23
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
24 $ARGV[$_] = $arg;
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
25 rename $file, $arg;
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
26
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
27 push @inFiles, $arg if $arg =~ /\.dat_input\.fastq$/ || $arg =~ /\.dat_input\.fastq\.gz$/;
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
28 push @outFiles, $arg if $arg =~ /\.dat\.fastq$/ || $arg =~ /\.dat\.fastq\.gz$/;
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
29 }
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
30 }
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
31
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
32 my $call = join " ", @ARGV;
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
33
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
34 system $call and exit 1;
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
35
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
36
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
37 unlink $_ or warn "Could not unlink $_: $!" foreach(@inFiles);
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
38
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
39 foreach(@outFiles){
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
40
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
41 my $file = $_;
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
42
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
43 s/\.fastq$//;
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
44 s/\.fastq\.gz$//;
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
45
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
46 rename $file, $_;
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
47 }
216a55a39b52 Uploaded
jtilman
parents:
diff changeset
48