X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=bp_bin%2Freplace_vals;h=860b913156962b29c581141442e244ca9982b05d;hb=f2b18307294690cf1376b51357469910b509e695;hp=8ad373e8eeb88b1bd71708a7cbf4775d7886e401;hpb=d7247b71a23e582c9efebc72797deea227eebce7;p=biopieces.git diff --git a/bp_bin/replace_vals b/bp_bin/replace_vals index 8ad373e..860b913 100755 --- a/bp_bin/replace_vals +++ b/bp_bin/replace_vals @@ -60,7 +60,7 @@ if options[:file] 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 @@ -70,8 +70,8 @@ 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