add useful functions in utils_quantgen.R