k = fields[options[:search_col] - 1]
v = fields[options[:replace_col] - 1]
- raise RuntimeError, "duplicate key: #{k} found in file" if replace_hash.has_key? k
+ raise RuntimeError, "duplicate key: #{k} found in file" if replace_hash[k]
replace_hash[k] = v
end
Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output|
input.each_record do |record|
- if record.has_key? key
- if replace_hash.has_key? record[key]
+ if record[key]
+ if replace_hash[record[key]]
record[key] = replace_hash[record[key]]
end
end