Skip to content
Snippets Groups Projects
Commit e7fde0e3 authored by Hanna  JULIENNE's avatar Hanna JULIENNE
Browse files

Maintenance: removed deprecated numpy types

parent 3ccf6dac
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,7 @@ Write clean GWAS datasets by chromosome
__updated__ = '2022-03-02'
import pandas as pd
import numpy as np
import jass_preprocessing as jp
import time
import argparse
......@@ -40,7 +41,6 @@ def launch_preprocessing(args):
gwas_map.set_index("tag", inplace=True)
print(gwas_map)
for tag in gwas_map.index:
gwas_filename = gwas_map.loc[tag, "filename"]
print('processing GWAS: {}'.format(tag))
......@@ -56,13 +56,13 @@ def launch_preprocessing(args):
gw_df = jp.map_gwas.read_gwas(GWAS_link, mapgw)
print("#SNPs in GWAS summary statistic file: {}".format(gw_df.shape[0]))
ref = jp.map_reference.read_reference(args.ref_path, bool(args.mask_MHC), float(args.minimum_MAF), region_to_mask=eval(args.additional_masked_region))
ref = jp.map_reference.read_reference(args.ref_path, np.bool_(args.mask_MHC), np.double(args.minimum_MAF), region_to_mask=eval(args.additional_masked_region))
mgwas = jp.map_reference.map_on_ref_panel(gw_df, ref, gwas_map.loc[tag, "index_type"])
print("#SNPs mapped to reference panel: {}".format(mgwas.shape[0]))
mgwas = jp.map_reference.compute_snp_alignement(mgwas)
mgwas = jp.compute_score.compute_z_score(mgwas)
mgwas = jp.compute_score.compute_sample_size(mgwas, args.diagnostic_folder, tag, float(args.percent_sample_size))
mgwas = jp.compute_score.compute_sample_size(mgwas, args.diagnostic_folder, tag, np.double(args.percent_sample_size))
end = time.time()
print("#SNPs remaining after sample size filter: {}".format(mgwas.shape[0]))
......@@ -91,7 +91,6 @@ def add_preprocessing_argument():
parser.add_argument('--additional-masked-region', required=False, help= "List of dictionary containing coordinate of region to mask. For example :[{'chr':6, 'start':50000000, 'end': 70000000}, {'chr':6, 'start':100000000, 'end': 120000000}]", default='None')
parser.add_argument('--imputation-quality-treshold', required=False, help= "minimum imputation quality in summary statistics", default='None')
parser.set_defaults(func=launch_preprocessing)
return parser
......
......@@ -51,7 +51,7 @@ def compute_sample_size(mgwas, diagnostic_folder, trait, perSS = 0.7):
warnings.warn("Some snp had an infinite sample size")
myW_thres = np.percentile(myN.dropna(), 90)
ss_thres = float(perSS) * myW_thres
ss_thres = np.double(perSS) * myW_thres
mgwas["computed_N"] = myN
plt.clf()
p1 = sns.distplot(mgwas.computed_N[~mgwas.computed_N.isna()])
......
......@@ -21,7 +21,7 @@ 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.float, "pos":np.int, "ref":str, "alt":str},
dtype = {"chr": str, "snp_id":str, "MAF": np.double, "pos":np.int64, "ref":str, "alt":str},
index_col="snp_id")
def sorted_alleles(x):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment