Commit 253ad7d6 authored by hjulienn's avatar hjulienn
Browse files

clean print

parent 8a0f2f0c
...@@ -39,7 +39,7 @@ def add_chromosome_imputation_argument(): ...@@ -39,7 +39,7 @@ def add_chromosome_imputation_argument():
parser.add_argument('--R2-threshold', help= "R square (imputation quality) threshold bellow which SNPs are filtered from the output", default = 0.6) parser.add_argument('--R2-threshold', help= "R square (imputation quality) threshold bellow which SNPs are filtered from the output", default = 0.6)
parser.add_argument("--ld-type", help= "Ld can be supplied as plink command --ld-snp-list output files (see raiss.ld_matrix.launch_plink_ld to compute these data using plink) or as a couple of a scipy sparse matrix (.npz )and an .csv containing SNPs index", default="plink") parser.add_argument("--ld-type", help= "Ld can be supplied as plink command --ld-snp-list output files (see raiss.ld_matrix.launch_plink_ld to compute these data using plink) or as a couple of a scipy sparse matrix (.npz )and an .csv containing SNPs index", default="plink")
parser.add_argument('--ref-panel-suffix', help= "end of the suffix for the reference panel files", default = ".bim") parser.add_argument('--ref-panel-suffix', help= "end of the suffix for the reference panel files", default = ".bim")
parser.add_argument('--minimum-ld', help = "this parameter ensure that their is enough typed SNPs around the imputed to perform a high accuracy imputation", default = 20) parser.add_argument('--minimum-ld', help = "this parameter ensure that their is enough typed SNPs around the imputed to perform a high accuracy imputation", default = 5)
parser.set_defaults(func=launch_chromosome_imputation) parser.set_defaults(func=launch_chromosome_imputation)
return(parser) return(parser)
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
""" """
def filter_output(zscores, fout, R2_threshold = 0.6, minimum_ld = 20): def filter_output(zscores, fout, R2_threshold = 0.6, minimum_ld = 5):
""" """
procedure that format output for JASS procedure that format output for JASS
......
...@@ -39,6 +39,7 @@ def generated_test_data(zscore, N_to_mask=5000, condition=None, stratifying_vec ...@@ -39,6 +39,7 @@ def generated_test_data(zscore, N_to_mask=5000, condition=None, stratifying_vec
print(np.unique(binned)) print(np.unique(binned))
print(inter_id[(binned==(1))]) print(inter_id[(binned==(1))])
print(N_to_mask // N_bins) print(N_to_mask // N_bins)
for i in range(N_bins): for i in range(N_bins):
print(i) print(i)
print(np.where(binned==(i+1))) print(np.where(binned==(i+1)))
......
...@@ -77,14 +77,15 @@ def load_plink_ld(plink_ld, ref_chr_df): ...@@ -77,14 +77,15 @@ def load_plink_ld(plink_ld, ref_chr_df):
un_index = mat_ld.index.union(mat_ld.columns) un_index = mat_ld.index.union(mat_ld.columns)
mat_ld = mat_ld.reindex(index=un_index, columns=un_index) mat_ld = mat_ld.reindex(index=un_index, columns=un_index)
mat_ld.fillna(0, inplace=True) mat_ld.fillna(0, inplace=True)
sym = np.where(np.abs(mat_ld.values) > np.abs(mat_ld.values.transpose()), mat_ld.values, mat_ld.values.transpose()) sym = np.where(np.abs(mat_ld.values) > np.abs(mat_ld.values.transpose()), mat_ld.values, mat_ld.values.transpose())
mat_ld = pd.DataFrame(sym, index=mat_ld.index, columns=mat_ld.columns) mat_ld = pd.DataFrame(sym, index=mat_ld.index, columns=mat_ld.columns)
int_index = ref_chr_df.index.intersection(mat_ld.index) int_index = ref_chr_df.index.intersection(mat_ld.index)
print(int_index) print(int_index)
re_index = ref_chr_df.loc[int_index].sort_values(by="pos").index re_index = ref_chr_df.loc[int_index].sort_values(by="pos").index
mat_ld = mat_ld.loc[re_index, re_index] mat_ld = mat_ld.loc[re_index, re_index]
print(mat_ld.loc[1:5, 1:5])
return mat_ld return mat_ld
def load_sparse_matrix(path_sparse_LD, ref_chr_df): def load_sparse_matrix(path_sparse_LD, ref_chr_df):
...@@ -120,7 +121,6 @@ def generate_genome_matrices(region_files, reffolder, folder_output, suffix = "" ...@@ -120,7 +121,6 @@ def generate_genome_matrices(region_files, reffolder, folder_output, suffix = ""
""" """
regions = pd.read_csv(region_files) regions = pd.read_csv(region_files)
for reg in regions.iterrows(): for reg in regions.iterrows():
print(reg[0])
# input reference panel file # input reference panel file
fi_ref = "{0}/{1}.{2}".format(reffolder, reg[1]['chr'], suffix) fi_ref = "{0}/{1}.{2}".format(reffolder, reg[1]['chr'], suffix)
......
...@@ -53,11 +53,6 @@ def compute_var(sig_i_t, sig_t_inv, lamb, batch=True): ...@@ -53,11 +53,6 @@ def compute_var(sig_i_t, sig_t_inv, lamb, batch=True):
return var, ld_score return var, ld_score
def check_inversion(sig_t, sig_t_inv): def check_inversion(sig_t, sig_t_inv):
print("sig_t")
print(sig_t)
print("sig_t_inv")
print(sig_t_inv)
return np.allclose(sig_t, np.dot(sig_t, np.dot(sig_t_inv, sig_t))) return np.allclose(sig_t, np.dot(sig_t, np.dot(sig_t_inv, sig_t)))
def var_in_boundaries(var,lamb): def var_in_boundaries(var,lamb):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment