# HG changeset patch # User jtilman # Date 1530441986 14400 # Node ID 216a55a39b528914a971added346bd3c3eef8dc0 # Parent 497da23fee84ec3d423e0eda8b287edc04b4a970 Uploaded diff -r 497da23fee84 -r 216a55a39b52 flexbar.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flexbar.pl Sun Jul 01 06:46:26 2018 -0400 @@ -0,0 +1,48 @@ +#!/usr/bin/env perl + +# Flexbar wrapper for Galaxy tool definition, version 3.4.2 +# Author: Johannes Roehr + +use warnings; +use strict; + +my $format; +my @inFiles; +my @outFiles; + +foreach(0..$#ARGV){ + my $arg = $ARGV[$_]; + + if($arg =~ /\.(fastq\w+)$/ || $arg =~ /\.(fastq\w+\.gz)$/){ + + $format = $1; + my $file = $arg; + + $arg =~ s/\.fastq\w+$/\.fastq/; + $arg =~ s/\.fastq\w+\.gz$/\.fastq\.gz/; + + $ARGV[$_] = $arg; + rename $file, $arg; + + push @inFiles, $arg if $arg =~ /\.dat_input\.fastq$/ || $arg =~ /\.dat_input\.fastq\.gz$/; + push @outFiles, $arg if $arg =~ /\.dat\.fastq$/ || $arg =~ /\.dat\.fastq\.gz$/; + } +} + +my $call = join " ", @ARGV; + +system $call and exit 1; + + +unlink $_ or warn "Could not unlink $_: $!" foreach(@inFiles); + +foreach(@outFiles){ + + my $file = $_; + + s/\.fastq$//; + s/\.fastq\.gz$//; + + rename $file, $_; +} +