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]
+ seq = Seq.new_bp(record)
+
if fh_hash.has_key? record[key].to_sym
fasta_io = fh_hash[record[key].to_sym]
else
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]
end
# Class method for opening data stream for writing Biopiece records.
- # Records are written to STDOU (default) or file.
+ # Records are written to STDOUT (default) or file.
def self.open_output(output)
if output.nil?
output = self.new(STDOUT, stdio = true)
# Add ubiquitous options casts.
def ubiquitous
- @cast_list << {:long=>'help', :short=>'?', :type=>'flag', :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}
- @cast_list << {:long=>'stream_in', :short=>'I', :type=>'file!', :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}
- @cast_list << {:long=>'stream_out', :short=>'O', :type=>'file', :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}
- @cast_list << {:long=>'verbose', :short=>'v', :type=>'flag', :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}
+ @cast_list << {:long=>'help', :short=>'?', :type=>'flag', :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}
+ @cast_list << {:long=>'stream_in', :short=>'I', :type=>'file!', :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}
+ @cast_list << {:long=>'stream_out', :short=>'O', :type=>'file', :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}
+ @cast_list << {:long=>'verbose', :short=>'v', :type=>'flag', :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}
end
# Check integrity of the casts.