diff flexbar.pl @ 38:216a55a39b52 draft

Uploaded
author jtilman
date Sun, 01 Jul 2018 06:46:26 -0400
parents
children 2fcee21876db
line wrap: on
line diff
--- /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, $_;
+}
+