changeset 40:2fcee21876db draft

Uploaded
author jtilman
date Sun, 01 Jul 2018 08:00:26 -0400
parents ae7d2b47ad07
children b0847c1e320b
files flexbar.pl
diffstat 1 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/flexbar.pl	Sun Jul 01 07:59:40 2018 -0400
+++ b/flexbar.pl	Sun Jul 01 08:00:26 2018 -0400
@@ -13,19 +13,25 @@
 foreach(0..$#ARGV){
 	my $arg = $ARGV[$_];
 	
-	if($arg =~ /\.(fastq\w+)$/ || $arg =~ /\.(fastq\w+\.gz)$/){
+	if($arg =~ /\.(fastq\w+)$/ || $arg =~ /\.(fastq\w+\.gz)$/ || $arg =~ /\.(fastq\w+\.bz2)$/){
 		
+		if(defined $format && $format ne $1){
+			print STDERR "Paired read files should have the same format.\n";
+			exit 1;
+		}
 		$format = $1;
+		
 		my $file = $arg;
 		
 		$arg =~ s/\.fastq\w+$/\.fastq/;
 		$arg =~ s/\.fastq\w+\.gz$/\.fastq\.gz/;
+		$arg =~ s/\.fastq\w+\.bz2$/\.fastq\.bz2/;
+		
+		push @inFiles,  $arg if $arg =~ /\.dat_input\.fastq$/ || $arg =~ /\.dat_input\.fastq\.gz$/ || $arg =~ /\.dat_input\.fastq\.bz2$/;
+		push @outFiles, $arg if $arg =~ /\.dat\.fastq$/       || $arg =~ /\.dat\.fastq\.gz$/       || $arg =~ /\.dat\.fastq\.bz2$/;
 		
 		$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$/;
 	}
 }
 
@@ -42,6 +48,7 @@
 	
 	s/\.fastq$//;
 	s/\.fastq\.gz$//;
+	s/\.fastq\.bz2$//;
 	
 	rename $file, $_;
 }