From 437be19699ae1a3c7ce22908dca4b036f6c7a4b6 Mon Sep 17 00:00:00 2001 From: hjulienn <hanna.julienne@pasteur.fr> Date: Thu, 5 Jan 2023 13:20:52 +0100 Subject: [PATCH] treat exception when missing position --- jass_preprocessing/map_reference.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jass_preprocessing/map_reference.py b/jass_preprocessing/map_reference.py index 65550fd..260e16e 100644 --- a/jass_preprocessing/map_reference.py +++ b/jass_preprocessing/map_reference.py @@ -21,8 +21,10 @@ def read_reference(gwas_reference_panel, mask_MHC=False, minimum_MAF=None, regio """ ref = pd.read_csv(gwas_reference_panel, header=None, sep= "\t", names =[ 'chr', "snp_id", "MAF","pos", "ref", "alt"], - dtype = {"chr": str, "snp_id":str, "MAF": np.double, "pos":np.int64, "ref":str, "alt":str}, + dtype = {"chr": str, "snp_id":str, "MAF": np.double, "pos":np.double, "ref":str, "alt":str}, index_col="snp_id") + ref = ref.loc[~ref.pos.isnull()] + ref.pos = ref.pos.astype('int') def sorted_alleles(x): return "".join(sorted(x)) -- GitLab