while line = gets do c = line.split(/\t/) d = [] d << c[6].gsub(/_[0-9]+/, '') # query ID d << c[6].gsub(/[^_]+_([0-9]+)/, '\1') # query len d << c[0] # target chr d << (c[1] == "F" ? "+" : "-") # strand d << (c[2].to_i <= c[3].to_i ? c[2] : c[3]) # target start d << (c[2].to_i <= c[3].to_i ? c[3] : c[2]) # target end d << c[4].gsub(/%/, '') # similarity d << c[5].gsub(/%/, '') # query coverage d << c[16] # e-value d << c[17] # bit score d << c[18] # alignment target sequence d << c[19] # alignment query sequence d << c[20] # alignment result puts d.join("\t") end