-tmpdir = bp.mktmpdir
-infile = "#{tmpdir}/in.fna"
-outfile = "#{tmpdir}/out.prodigal"
-
-Fasta.open(infile, mode="w") do |fasta_io|
- bp.each_record do |record|
- if record.has_key? :SEQ
- total += record[:SEQ].length
- lengths << record[:SEQ].length
+tmpdir = Biopieces.mktmpdir
+infile = File.join(tmpdir, "in.fna")
+outfile = File.join(tmpdir, "out.prodigal")
+
+Fasta.open(infile, "w") do |fasta_output|
+ Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output|
+ input.each_record do |record|
+ if record[:SEQ]
+ seq = Seq.new_bp(record)
+
+ total += record[:SEQ].length
+ lengths << record[:SEQ].length
+ end
+
+ output.puts record unless options[:no_stream]
+ fasta_output.puts seq.to_fasta