bin/split_fastq.rb in seqtrimnext-2.0.57 vs bin/split_fastq.rb in seqtrimnext-2.0.59
- old
+ new
@@ -2,23 +2,29 @@
require 'scbi_fastq'
if ARGV.count < 3
- puts "#{$0} FASTQ OUTPUT_NAME SPLIT_BY"
+ puts "#{$0} FASTQ OUTPUT_NAME SPLIT_BY [-gz]"
exit
end
-
fastq = ARGV.shift
output_name = ARGV.shift
split_by = ARGV.shift.to_i
+gz_arg=ARGV.shift
+gz=false
+if !gz_arg.nil? and gz_arg.index('-gz')
+ gz='.gz'
+end
+
+
file_index=1
-out=FastqFile.new("#{output_name}#{file_index}.fastq",'w')
+out=FastqFile.new("#{output_name}#{file_index}.fastq#{gz}","w#{gz}")
fqr=FastqFile.new(fastq)
count = 0
@@ -30,10 +36,10 @@
if (count % split_by) == 0
file_index +=1
out.close
- out=FastqFile.new("#{output_name}#{file_index}.fastq",'w')
+ out=FastqFile.new("#{output_name}#{file_index}.fastq#{gz}","w#{gz}")
end
end
out.close