casts = []
casts << {long: 'key', short: 'k', type: 'string', mandatory: true, default: nil, allowed: nil, disallowed: nil}
casts << {long: 'dir', short: 'd', type: 'dir!', mandatory: true, default: nil, allowed: nil, disallowed: nil}
+casts << {long: 'prefix', short: 'p', type: 'string', mandatory: false, default: nil, allowed: nil, disallowed: nil}
casts << {long: 'no_stream', short: 'x', type: 'flag', mandatory: false, default: nil, allowed: nil, disallowed: nil}
casts << {long: 'compress', short: 'Z', type: 'string', mandatory: false, default: nil, allowed: "gzip,bzip,bzip2", disallowed: nil}
casts << {long: 'encoding', short: 'e', type: 'string', mandatory: false, default: 'base_33', allowed: allowed_enc, disallowed: nil}
if fh_hash[record[key].to_sym]
fastq_io = fh_hash[record[key].to_sym]
else
- fastq_file = File.join(options[:dir], record[key] + ".fastq")
+ if options[:prefix]
+ fastq_file = File.join(options[:dir], [options[:prefix], record[key]].join("_") + ".fastq")
+ else
+ fastq_file = File.join(options[:dir], record[key] + ".fastq")
+ end
+
fastq_file << ".gz" if compress == :gzip
fastq_file << ".bz2" if compress == :bzip or compress == :bzip2
fastq_io = Fastq.open(fastq_file, "w", compress: compress)