bin/split_fasta.rb in seqtrimnext-2.0.55 vs bin/split_fasta.rb in seqtrimnext-2.0.56
- old
+ new
@@ -7,39 +7,36 @@
puts "#{$0} FASTA_FILE OUTPUT_NAME SEQS_PER_FILE_COUNT"
exit
end
-
+
fastq = ARGV.shift
output_name = ARGV.shift
split_by = ARGV.shift.to_i
file_index=1
out=File.new("#{output_name}#{file_index}.fasta",'w')
-
fqr=FastaQualFile.new(fastq)
count = 0
fqr.each do |seq_name,seq_fasta,comments|
-
- out.puts(">#{seq_name+i.to_s} #{comments}")
- out.puts(seq_fasta)
+ if (count >= split_by)
+ count=0
- count +=1
-
- if (count % split_by) == 0
-
file_index +=1
out.close
out=File.new("#{output_name}#{file_index}.fasta",'w')
-
end
-end
-
-out.close
-fqr.close
+ out.puts(">#{seq_name} #{comments}")
+ out.puts(seq_fasta)
+ count +=1
+
+end
+
+out.close if out
+fqr.close
\ No newline at end of file