X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=bp_bin%2Fwrite_fasta_files;h=36011ed411fad74d891f2f12f7108bfc02eb91a2;hb=2f0fd91b461033529a4a72e161bd133252a22eb6;hp=3ffeb82c5608eff45e7b72e53ad49484b4540152;hpb=3eb0e92699257e81781dd85dfd215ec12070b2df;p=biopieces.git diff --git a/bp_bin/write_fasta_files b/bp_bin/write_fasta_files index 3ffeb82..36011ed 100755 --- a/bp_bin/write_fasta_files +++ b/bp_bin/write_fasta_files @@ -46,15 +46,17 @@ fh_hash = {} Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output| input.each_record do |record| if record[:SEQ_NAME] and record[:SEQ] and record[key] - if fh_hash.has_key? record[key].to_sym + seq = Seq.new_bp(record) + + if fh_hash[record[key].to_sym] fasta_io = fh_hash[record[key].to_sym] else - mid_file = File.join(options[:dir], record[key] + ".fasta") - fasta_io = Fasta.open(mid_file, "w") + fasta_file = File.join(options[:dir], record[key] + ".fasta") + fasta_io = Fasta.open(fasta_file, "w") fh_hash[record[key].to_sym] = fasta_io end - fasta_io.puts record + fasta_io.puts seq.to_fasta end output.puts record unless options[:no_stream]