From f0df7d192c6206aa8c5e44365b55cff478be9a0a Mon Sep 17 00:00:00 2001 From: Sam Gelman Date: Fri, 24 Jan 2025 13:41:56 -0600 Subject: [PATCH] Saving NaN (or user-specified value) to parsed dataset file for non-existent values --- code/parse_raw_dms_data.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/parse_raw_dms_data.py b/code/parse_raw_dms_data.py index 38f03d2..8c2f490 100644 --- a/code/parse_raw_dms_data.py +++ b/code/parse_raw_dms_data.py @@ -9,7 +9,7 @@ import utils -def sort_and_save_to_csv(df, out_fn, precision=7, sort_muts=True, sort_variants=True): +def sort_and_save_to_csv(df, out_fn, precision=7, sort_muts=True, sort_variants=True, na_rep=""): # make sure variants have their list of mutations in sorted order if sort_muts: df["variant"] = utils.sort_variant_mutations(df["variant"]) @@ -24,7 +24,7 @@ def sort_and_save_to_csv(df, out_fn, precision=7, sort_muts=True, sort_variants= if not isdir(dirname(out_fn)): os.makedirs(dirname(out_fn)) - df.to_csv(out_fn, sep="\t", float_format=float_format.format, index=False) + df.to_csv(out_fn, sep="\t", float_format=float_format.format, index=False, na_rep=na_rep) def parse_avgfp(score_precision=7):