lib/rbbt/tsv/change_id.rb in rbbt-util-5.27.2 vs lib/rbbt/tsv/change_id.rb in rbbt-util-5.27.3
- old
+ new
@@ -8,11 +8,12 @@
identifiers, persist_input = Misc.process_options options, :identifiers, :persist_input
identifiers = Organism.identifiers(tsv.namespace) if identifiers.nil? and tsv.namespace
- if not tsv.fields.include? format
+
+ if ! tsv.fields.include?(format)
new = {}
tsv.each do |k,v|
if v === String or v === Array
new[k] = v.dup
else
@@ -29,9 +30,10 @@
if Array === identifiers
tsv = tsv.attach identifiers.first, :fields => [format], :persist_input => true, :identifiers => identifiers.last
else
tsv = tsv.attach identifiers, :fields => [format], :persist_input => true
end
+
tsv = tsv.reorder(format, tsv.fields[0..-2])
tsv = tsv.to_flat if orig_type == :flat