gwaslab 3.6.6__py3-none-any.whl → 3.6.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of gwaslab might be problematic. Click here for more details.
- gwaslab/__init__.py +57 -47
- gwaslab/{bd_common_data.py → bd/bd_common_data.py} +10 -9
- gwaslab/bd/bd_config.py +28 -0
- gwaslab/{bd_download.py → bd/bd_download.py} +1 -1
- gwaslab/{bd_get_hapmap3.py → bd/bd_get_hapmap3.py} +9 -6
- gwaslab/bd/bd_path_manager.py +110 -0
- gwaslab/data/formatbook.json +805 -9
- gwaslab/{ldsc_irwls.py → extension/ldsc/ldsc_irwls.py} +1 -1
- gwaslab/{ldsc_regressions.py → extension/ldsc/ldsc_regressions.py} +2 -2
- gwaslab/{ldsc_sumstats.py → extension/ldsc/ldsc_sumstats.py} +2 -2
- gwaslab/{prscs_mcmc_gtb.py → extension/prscs/prscs_mcmc_gtb.py} +1 -1
- gwaslab/g_Sumstats.py +130 -96
- gwaslab/g_SumstatsMulti.py +69 -40
- gwaslab/g_SumstatsPair.py +54 -37
- gwaslab/g_SumstatsSet.py +88 -81
- gwaslab/g_SumstatsT.py +6 -6
- gwaslab/g_Sumstats_polars.py +84 -84
- gwaslab/g_meta_update.py +1 -1
- gwaslab/g_vchange_status.py +4 -4
- gwaslab/g_version.py +2 -2
- gwaslab/{hm_casting.py → hm/hm_casting.py} +4 -4
- gwaslab/{hm_casting_polars.py → hm/hm_casting_polars.py} +4 -4
- gwaslab/hm/hm_harmonize_sumstats.py +1635 -0
- gwaslab/hm_harmonize_sumstats.py +3 -8
- gwaslab/{io_load_ld.py → io/io_load_ld.py} +16 -13
- gwaslab/{io_preformat_input.py → io/io_preformat_input.py} +152 -73
- gwaslab/{io_preformat_input_polars.py → io/io_preformat_input_polars.py} +7 -7
- gwaslab/{io_read_pipcs.py → io/io_read_pipcs.py} +2 -2
- gwaslab/{io_read_tabular.py → io/io_read_tabular.py} +2 -2
- gwaslab/{io_to_formats.py → io/io_to_formats.py} +11 -8
- gwaslab/{io_to_pickle.py → io/io_to_pickle.py} +16 -1
- gwaslab/{qc_check_datatype_polars.py → qc/qc_check_datatype_polars.py} +2 -2
- gwaslab/{qc_fix_sumstats.py → qc/qc_fix_sumstats.py} +60 -33
- gwaslab/{qc_fix_sumstats_polars.py → qc/qc_fix_sumstats_polars.py} +15 -11
- gwaslab/{util_abf_finemapping.py → util/util_abf_finemapping.py} +2 -2
- gwaslab/{util_ex_calculate_ldmatrix.py → util/util_ex_calculate_ldmatrix.py} +18 -8
- gwaslab/{util_ex_calculate_prs.py → util/util_ex_calculate_prs.py} +2 -2
- gwaslab/{util_ex_ldproxyfinder.py → util/util_ex_ldproxyfinder.py} +6 -6
- gwaslab/{util_ex_ldsc.py → util/util_ex_ldsc.py} +18 -13
- gwaslab/{util_ex_match_ldmatrix.py → util/util_ex_match_ldmatrix.py} +8 -7
- gwaslab/util/util_ex_phewwas.py +127 -0
- gwaslab/{util_ex_process_h5.py → util/util_ex_process_h5.py} +2 -2
- gwaslab/{util_ex_process_ref.py → util/util_ex_process_ref.py} +2 -2
- gwaslab/{util_ex_run_2samplemr.py → util/util_ex_run_2samplemr.py} +18 -7
- gwaslab/{util_ex_run_ccgwas.py → util/util_ex_run_ccgwas.py} +4 -4
- gwaslab/{util_ex_run_clumping.py → util/util_ex_run_clumping.py} +28 -13
- gwaslab/{util_ex_run_coloc.py → util/util_ex_run_coloc.py} +22 -10
- gwaslab/{util_ex_run_hyprcoloc.py → util/util_ex_run_hyprcoloc.py} +4 -4
- gwaslab/{util_ex_run_magma.py → util/util_ex_run_magma.py} +21 -11
- gwaslab/{util_ex_run_mesusie.py → util/util_ex_run_mesusie.py} +3 -3
- gwaslab/{util_ex_run_mtag.py → util/util_ex_run_mtag.py} +50 -18
- gwaslab/{util_ex_run_prscs.py → util/util_ex_run_prscs.py} +3 -3
- gwaslab/{util_ex_run_scdrs.py → util/util_ex_run_scdrs.py} +10 -4
- gwaslab/{util_ex_run_susie.py → util/util_ex_run_susie.py} +49 -26
- gwaslab/{util_in_fill_data.py → util/util_in_fill_data.py} +1 -1
- gwaslab/{util_in_filter_value.py → util/util_in_filter_value.py} +18 -11
- gwaslab/{util_in_get_sig.py → util/util_in_get_sig.py} +15 -13
- gwaslab/{util_in_meta.py → util/util_in_meta.py} +1 -1
- gwaslab/{util_in_meta_polars.py → util/util_in_meta_polars.py} +1 -1
- gwaslab/{viz_aux_annotate_plot.py → viz/viz_aux_annotate_plot.py} +1 -1
- gwaslab/{viz_aux_quickfix.py → viz/viz_aux_quickfix.py} +2 -2
- gwaslab/{viz_plot_compare_af.py → viz/viz_plot_compare_af.py} +1 -1
- gwaslab/{viz_plot_compare_effect.py → viz/viz_plot_compare_effect.py} +16 -8
- gwaslab/{viz_plot_credible_sets.py → viz/viz_plot_credible_sets.py} +6 -6
- gwaslab/{viz_plot_effect.py → viz/viz_plot_effect.py} +37 -69
- gwaslab/{viz_plot_miamiplot.py → viz/viz_plot_miamiplot.py} +28 -20
- gwaslab/{viz_plot_miamiplot2.py → viz/viz_plot_miamiplot2.py} +27 -22
- gwaslab/{viz_plot_mqqplot.py → viz/viz_plot_mqqplot.py} +100 -46
- gwaslab/{viz_plot_phe_heatmap.py → viz/viz_plot_phe_heatmap.py} +18 -15
- gwaslab/{viz_plot_qqplot.py → viz/viz_plot_qqplot.py} +12 -28
- gwaslab/{viz_plot_regional2.py → viz/viz_plot_regional2.py} +11 -9
- gwaslab/{viz_plot_regionalplot.py → viz/viz_plot_regionalplot.py} +5 -4
- gwaslab/{viz_plot_rg_heatmap.py → viz/viz_plot_rg_heatmap.py} +1 -1
- gwaslab/{viz_plot_scatter_with_reg.py → viz/viz_plot_scatter_with_reg.py} +10 -7
- gwaslab/{viz_plot_stackedregional.py → viz/viz_plot_stackedregional.py} +67 -33
- gwaslab/{viz_plot_trumpetplot.py → viz/viz_plot_trumpetplot.py} +15 -9
- {gwaslab-3.6.6.dist-info → gwaslab-3.6.8.dist-info}/METADATA +1 -1
- gwaslab-3.6.8.dist-info/RECORD +123 -0
- gwaslab/bd_config.py +0 -18
- gwaslab-3.6.6.dist-info/RECORD +0 -120
- /gwaslab/{ldsc_jackknife.py → extension/ldsc/ldsc_jackknife.py} +0 -0
- /gwaslab/{ldsc_ldscore.py → extension/ldsc/ldsc_ldscore.py} +0 -0
- /gwaslab/{ldsc_parse.py → extension/ldsc/ldsc_parse.py} +0 -0
- /gwaslab/{prscs_gigrnd.py → extension/prscs/prscs_gigrnd.py} +0 -0
- /gwaslab/{prscs_parse_genet.py → extension/prscs/prscs_parse_genet.py} +0 -0
- /gwaslab/{hm_rsid_to_chrpos.py → hm/hm_rsid_to_chrpos.py} +0 -0
- /gwaslab/{io_process_args.py → io/io_process_args.py} +0 -0
- /gwaslab/{io_read_ldsc.py → io/io_read_ldsc.py} +0 -0
- /gwaslab/{qc_build.py → qc/qc_build.py} +0 -0
- /gwaslab/{qc_check_datatype.py → qc/qc_check_datatype.py} +0 -0
- /gwaslab/{util_ex_gwascatalog.py → util/util_ex_gwascatalog.py} +0 -0
- /gwaslab/{util_ex_infer_ancestry.py → util/util_ex_infer_ancestry.py} +0 -0
- /gwaslab/{util_ex_plink_filter.py → util/util_ex_plink_filter.py} +0 -0
- /gwaslab/{util_in_calculate_gc.py → util/util_in_calculate_gc.py} +0 -0
- /gwaslab/{util_in_calculate_power.py → util/util_in_calculate_power.py} +0 -0
- /gwaslab/{util_in_convert_h2.py → util/util_in_convert_h2.py} +0 -0
- /gwaslab/{util_in_correct_winnerscurse.py → util/util_in_correct_winnerscurse.py} +0 -0
- /gwaslab/{util_in_estimate_ess.py → util/util_in_estimate_ess.py} +0 -0
- /gwaslab/{util_in_get_density.py → util/util_in_get_density.py} +0 -0
- /gwaslab/{util_in_merge.py → util/util_in_merge.py} +0 -0
- /gwaslab/{util_in_snphwe.py → util/util_in_snphwe.py} +0 -0
- /gwaslab/{viz_aux_chromatin.py → viz/viz_aux_chromatin.py} +0 -0
- /gwaslab/{viz_aux_property.py → viz/viz_aux_property.py} +0 -0
- /gwaslab/{viz_aux_reposition_text.py → viz/viz_aux_reposition_text.py} +0 -0
- /gwaslab/{viz_aux_save_figure.py → viz/viz_aux_save_figure.py} +0 -0
- /gwaslab/{viz_plot_forestplot.py → viz/viz_plot_forestplot.py} +0 -0
- {gwaslab-3.6.6.dist-info → gwaslab-3.6.8.dist-info}/WHEEL +0 -0
- {gwaslab-3.6.6.dist-info → gwaslab-3.6.8.dist-info}/licenses/LICENSE +0 -0
- {gwaslab-3.6.6.dist-info → gwaslab-3.6.8.dist-info}/licenses/LICENSE_before_v3.4.39 +0 -0
- {gwaslab-3.6.6.dist-info → gwaslab-3.6.8.dist-info}/top_level.txt +0 -0
|
@@ -11,8 +11,8 @@ from __future__ import division
|
|
|
11
11
|
import numpy as np
|
|
12
12
|
import pandas as pd
|
|
13
13
|
from scipy.stats import norm, chi2
|
|
14
|
-
import gwaslab.ldsc_jackknife as jk
|
|
15
|
-
from gwaslab.ldsc_irwls import IRWLS
|
|
14
|
+
import gwaslab.extension.ldsc.ldsc_jackknife as jk
|
|
15
|
+
from gwaslab.extension.ldsc.ldsc_irwls import IRWLS
|
|
16
16
|
from scipy.stats import t as tdist
|
|
17
17
|
from collections import namedtuple
|
|
18
18
|
np.seterr(divide='raise', invalid='raise')
|
|
@@ -10,8 +10,8 @@ import numpy as np
|
|
|
10
10
|
import pandas as pd
|
|
11
11
|
from scipy import stats
|
|
12
12
|
import itertools as it
|
|
13
|
-
import gwaslab.ldsc_parse as ps
|
|
14
|
-
import gwaslab.ldsc_regressions as reg
|
|
13
|
+
import gwaslab.extension.ldsc.ldsc_parse as ps
|
|
14
|
+
import gwaslab.extension.ldsc.ldsc_regressions as reg
|
|
15
15
|
import sys
|
|
16
16
|
import traceback
|
|
17
17
|
import copy
|
|
@@ -7,7 +7,7 @@ Markov Chain Monte Carlo (MCMC) sampler for polygenic prediction with continuous
|
|
|
7
7
|
import numpy as np
|
|
8
8
|
from scipy import linalg
|
|
9
9
|
from numpy import random
|
|
10
|
-
from gwaslab.prscs_gigrnd import gigrnd
|
|
10
|
+
from gwaslab.extension.prscs.prscs_gigrnd import gigrnd
|
|
11
11
|
from gwaslab.g_Log import Log
|
|
12
12
|
import time
|
|
13
13
|
def mcmc(a, b, phi, sst_dict, n, ld_blk, blk_size, n_iter, n_burnin, thin, chrom, out_dir, beta_std, write_psi, write_pst, seed, log):
|
gwaslab/g_Sumstats.py
CHANGED
|
@@ -5,99 +5,110 @@ import copy
|
|
|
5
5
|
import gc
|
|
6
6
|
from gwaslab.g_Sumstats_summary import summarize
|
|
7
7
|
from gwaslab.g_Sumstats_summary import lookupstatus
|
|
8
|
-
from gwaslab.io_preformat_input import preformat
|
|
9
|
-
from gwaslab.io_to_formats import _to_format
|
|
10
|
-
from gwaslab.g_Log import Log
|
|
11
|
-
from gwaslab.qc_fix_sumstats import fixID
|
|
12
|
-
from gwaslab.qc_fix_sumstats import flipSNPID
|
|
13
|
-
from gwaslab.qc_fix_sumstats import stripSNPID
|
|
14
|
-
from gwaslab.qc_fix_sumstats import removedup
|
|
15
|
-
from gwaslab.qc_fix_sumstats import fixchr
|
|
16
|
-
from gwaslab.qc_fix_sumstats import fixpos
|
|
17
|
-
from gwaslab.qc_fix_sumstats import fixallele
|
|
18
|
-
from gwaslab.qc_fix_sumstats import parallelnormalizeallele
|
|
19
|
-
from gwaslab.qc_fix_sumstats import sanitycheckstats
|
|
20
|
-
from gwaslab.qc_fix_sumstats import parallelizeliftovervariant
|
|
21
|
-
from gwaslab.qc_fix_sumstats import flipallelestats
|
|
22
|
-
from gwaslab.qc_fix_sumstats import sortcoordinate
|
|
23
|
-
from gwaslab.qc_fix_sumstats import sortcolumn
|
|
24
|
-
from gwaslab.qc_fix_sumstats import _set_build
|
|
25
|
-
from gwaslab.qc_fix_sumstats import _process_build
|
|
26
|
-
from gwaslab.hm_harmonize_sumstats import parallelecheckaf
|
|
27
|
-
from gwaslab.hm_harmonize_sumstats import paralleleinferaf
|
|
28
|
-
from gwaslab.hm_harmonize_sumstats import checkref
|
|
29
|
-
from gwaslab.hm_harmonize_sumstats import oldcheckref
|
|
30
|
-
from gwaslab.hm_harmonize_sumstats import rsidtochrpos
|
|
31
|
-
from gwaslab.hm_harmonize_sumstats import parallelizeassignrsid
|
|
32
|
-
from gwaslab.hm_harmonize_sumstats import parallelinferstrand
|
|
33
|
-
from gwaslab.hm_harmonize_sumstats import parallelrsidtochrpos
|
|
34
|
-
from gwaslab.hm_harmonize_sumstats import _paralleleinferafwithmaf
|
|
35
|
-
from gwaslab.util_in_filter_value import filtervalues
|
|
36
|
-
from gwaslab.util_in_filter_value import filterout
|
|
37
|
-
from gwaslab.util_in_filter_value import filterin
|
|
38
|
-
from gwaslab.util_in_filter_value import filterregionin
|
|
39
|
-
from gwaslab.util_in_filter_value import filterregionout
|
|
40
|
-
from gwaslab.util_in_filter_value import _filter_indel
|
|
41
|
-
from gwaslab.util_in_filter_value import _filter_palindromic
|
|
42
|
-
from gwaslab.util_in_filter_value import _filter_snp
|
|
43
|
-
from gwaslab.util_in_filter_value import _filter_region
|
|
44
|
-
from gwaslab.util_in_filter_value import _exclude_hla
|
|
45
|
-
from gwaslab.util_in_filter_value import _search_variants
|
|
46
|
-
from gwaslab.util_in_filter_value import inferbuild
|
|
47
|
-
from gwaslab.util_in_filter_value import sampling
|
|
48
|
-
from gwaslab.util_in_filter_value import _get_flanking
|
|
49
|
-
from gwaslab.util_in_filter_value import _get_flanking_by_chrpos
|
|
50
|
-
from gwaslab.util_in_filter_value import _get_flanking_by_id
|
|
51
|
-
from gwaslab.util_in_calculate_gc import lambdaGC
|
|
52
|
-
from gwaslab.util_in_convert_h2 import _get_per_snp_r2
|
|
53
|
-
from gwaslab.util_in_get_sig import getsig
|
|
54
|
-
from gwaslab.util_in_get_density import getsignaldensity
|
|
55
|
-
from gwaslab.util_in_get_density import assigndensity
|
|
56
|
-
from gwaslab.util_in_get_sig import annogene
|
|
57
|
-
from gwaslab.util_in_get_sig import getnovel
|
|
58
|
-
from gwaslab.util_in_get_sig import _check_cis
|
|
59
|
-
from gwaslab.util_in_get_sig import _check_novel_set
|
|
60
|
-
from gwaslab.util_in_fill_data import filldata
|
|
61
|
-
from gwaslab.bd_get_hapmap3 import gethapmap3
|
|
62
|
-
from gwaslab.bd_common_data import get_chr_list
|
|
63
|
-
from gwaslab.bd_common_data import get_number_to_chr
|
|
64
|
-
from gwaslab.bd_common_data import get_chr_to_number
|
|
65
|
-
from gwaslab.bd_common_data import get_high_ld
|
|
66
|
-
from gwaslab.bd_common_data import get_format_dict
|
|
67
|
-
from gwaslab.bd_common_data import get_formats_list
|
|
68
8
|
from gwaslab.g_version import _show_version
|
|
69
9
|
from gwaslab.g_version import gwaslab_info
|
|
70
10
|
from gwaslab.g_meta import _init_meta
|
|
71
11
|
from gwaslab.g_meta import _append_meta_record
|
|
72
12
|
from gwaslab.g_meta_update import _update_meta
|
|
73
|
-
from gwaslab.
|
|
74
|
-
|
|
75
|
-
from gwaslab.
|
|
76
|
-
from gwaslab.
|
|
77
|
-
from gwaslab.
|
|
78
|
-
from gwaslab.
|
|
79
|
-
from gwaslab.
|
|
80
|
-
from gwaslab.
|
|
81
|
-
from gwaslab.
|
|
82
|
-
from gwaslab.
|
|
83
|
-
from gwaslab.
|
|
84
|
-
from gwaslab.
|
|
85
|
-
from gwaslab.
|
|
86
|
-
from gwaslab.
|
|
87
|
-
from gwaslab.
|
|
88
|
-
from gwaslab.
|
|
89
|
-
from gwaslab.
|
|
90
|
-
from gwaslab.
|
|
91
|
-
|
|
92
|
-
from gwaslab.
|
|
93
|
-
from gwaslab.
|
|
94
|
-
from gwaslab.
|
|
95
|
-
from gwaslab.
|
|
96
|
-
from gwaslab.
|
|
97
|
-
from gwaslab.
|
|
98
|
-
from gwaslab.
|
|
99
|
-
from gwaslab.
|
|
100
|
-
from gwaslab.
|
|
13
|
+
from gwaslab.g_Log import Log
|
|
14
|
+
|
|
15
|
+
from gwaslab.qc.qc_fix_sumstats import fixID
|
|
16
|
+
from gwaslab.qc.qc_fix_sumstats import flipSNPID
|
|
17
|
+
from gwaslab.qc.qc_fix_sumstats import stripSNPID
|
|
18
|
+
from gwaslab.qc.qc_fix_sumstats import removedup
|
|
19
|
+
from gwaslab.qc.qc_fix_sumstats import fixchr
|
|
20
|
+
from gwaslab.qc.qc_fix_sumstats import fixpos
|
|
21
|
+
from gwaslab.qc.qc_fix_sumstats import fixallele
|
|
22
|
+
from gwaslab.qc.qc_fix_sumstats import parallelnormalizeallele
|
|
23
|
+
from gwaslab.qc.qc_fix_sumstats import sanitycheckstats
|
|
24
|
+
from gwaslab.qc.qc_fix_sumstats import parallelizeliftovervariant
|
|
25
|
+
from gwaslab.qc.qc_fix_sumstats import flipallelestats
|
|
26
|
+
from gwaslab.qc.qc_fix_sumstats import sortcoordinate
|
|
27
|
+
from gwaslab.qc.qc_fix_sumstats import sortcolumn
|
|
28
|
+
from gwaslab.qc.qc_fix_sumstats import _set_build
|
|
29
|
+
from gwaslab.qc.qc_fix_sumstats import _process_build
|
|
30
|
+
from gwaslab.qc.qc_fix_sumstats import _check_data_consistency
|
|
31
|
+
|
|
32
|
+
from gwaslab.hm.hm_harmonize_sumstats import parallelecheckaf
|
|
33
|
+
from gwaslab.hm.hm_harmonize_sumstats import paralleleinferaf
|
|
34
|
+
from gwaslab.hm.hm_harmonize_sumstats import checkref
|
|
35
|
+
from gwaslab.hm.hm_harmonize_sumstats import oldcheckref
|
|
36
|
+
from gwaslab.hm.hm_harmonize_sumstats import rsidtochrpos
|
|
37
|
+
from gwaslab.hm.hm_harmonize_sumstats import parallelizeassignrsid
|
|
38
|
+
from gwaslab.hm.hm_harmonize_sumstats import parallelinferstrand
|
|
39
|
+
from gwaslab.hm.hm_harmonize_sumstats import parallelrsidtochrpos
|
|
40
|
+
from gwaslab.hm.hm_harmonize_sumstats import _paralleleinferafwithmaf
|
|
41
|
+
|
|
42
|
+
from gwaslab.util.util_in_filter_value import filtervalues
|
|
43
|
+
from gwaslab.util.util_in_filter_value import filterout
|
|
44
|
+
from gwaslab.util.util_in_filter_value import filterin
|
|
45
|
+
from gwaslab.util.util_in_filter_value import filterregionin
|
|
46
|
+
from gwaslab.util.util_in_filter_value import filterregionout
|
|
47
|
+
from gwaslab.util.util_in_filter_value import _filter_indel
|
|
48
|
+
from gwaslab.util.util_in_filter_value import _filter_palindromic
|
|
49
|
+
from gwaslab.util.util_in_filter_value import _filter_snp
|
|
50
|
+
from gwaslab.util.util_in_filter_value import _filter_region
|
|
51
|
+
from gwaslab.util.util_in_filter_value import _exclude_hla
|
|
52
|
+
from gwaslab.util.util_in_filter_value import _search_variants
|
|
53
|
+
from gwaslab.util.util_in_filter_value import inferbuild
|
|
54
|
+
from gwaslab.util.util_in_filter_value import sampling
|
|
55
|
+
from gwaslab.util.util_in_filter_value import _get_flanking
|
|
56
|
+
from gwaslab.util.util_in_filter_value import _get_flanking_by_chrpos
|
|
57
|
+
from gwaslab.util.util_in_filter_value import _get_flanking_by_id
|
|
58
|
+
from gwaslab.util.util_in_calculate_gc import lambdaGC
|
|
59
|
+
from gwaslab.util.util_in_convert_h2 import _get_per_snp_r2
|
|
60
|
+
from gwaslab.util.util_in_get_sig import getsig
|
|
61
|
+
from gwaslab.util.util_in_get_density import getsignaldensity
|
|
62
|
+
from gwaslab.util.util_in_get_density import assigndensity
|
|
63
|
+
from gwaslab.util.util_in_get_sig import annogene
|
|
64
|
+
from gwaslab.util.util_in_get_sig import getnovel
|
|
65
|
+
from gwaslab.util.util_in_get_sig import _check_cis
|
|
66
|
+
from gwaslab.util.util_in_get_sig import _check_novel_set
|
|
67
|
+
from gwaslab.util.util_ex_phewwas import _extract_associations
|
|
68
|
+
from gwaslab.util.util_in_fill_data import filldata
|
|
69
|
+
from gwaslab.util.util_ex_run_clumping import _clump
|
|
70
|
+
from gwaslab.util.util_ex_calculate_ldmatrix import tofinemapping
|
|
71
|
+
from gwaslab.util.util_ex_run_susie import _run_susie_rss
|
|
72
|
+
from gwaslab.util.util_ex_run_susie import _get_cs_lead
|
|
73
|
+
from gwaslab.util.util_ex_ldsc import _estimate_h2_by_ldsc
|
|
74
|
+
from gwaslab.util.util_ex_ldsc import _estimate_rg_by_ldsc
|
|
75
|
+
from gwaslab.util.util_ex_ldsc import _estimate_h2_cts_by_ldsc
|
|
76
|
+
from gwaslab.util.util_ex_ldsc import _estimate_partitioned_h2_by_ldsc
|
|
77
|
+
from gwaslab.util.util_ex_ldproxyfinder import _extract_ld_proxy
|
|
78
|
+
from gwaslab.util.util_ex_run_magma import _run_magma
|
|
79
|
+
from gwaslab.util.util_ex_infer_ancestry import _infer_ancestry
|
|
80
|
+
from gwaslab.util.util_ex_run_prscs import _run_prscs
|
|
81
|
+
from gwaslab.util.util_ex_calculate_prs import _calculate_prs
|
|
82
|
+
from gwaslab.util.util_ex_run_scdrs import _run_scdrs
|
|
83
|
+
from gwaslab.util.util_in_estimate_ess import _get_ess
|
|
84
|
+
from gwaslab.util.util_abf_finemapping import abf_finemapping
|
|
85
|
+
from gwaslab.util.util_abf_finemapping import make_cs
|
|
86
|
+
|
|
87
|
+
from gwaslab.bd.bd_get_hapmap3 import gethapmap3
|
|
88
|
+
from gwaslab.bd.bd_common_data import get_chr_list
|
|
89
|
+
from gwaslab.bd.bd_common_data import get_number_to_chr
|
|
90
|
+
from gwaslab.bd.bd_common_data import get_chr_to_number
|
|
91
|
+
from gwaslab.bd.bd_common_data import get_high_ld
|
|
92
|
+
from gwaslab.bd.bd_common_data import get_format_dict
|
|
93
|
+
from gwaslab.bd.bd_common_data import get_formats_list
|
|
94
|
+
from gwaslab.bd.bd_path_manager import _path
|
|
95
|
+
from gwaslab.bd.bd_get_hapmap3 import gethapmap3
|
|
96
|
+
|
|
97
|
+
from gwaslab.hm.hm_casting import _align_with_mold
|
|
98
|
+
from gwaslab.hm.hm_casting import _merge_mold_with_sumstats_by_chrpos
|
|
99
|
+
|
|
100
|
+
from gwaslab.viz.viz_plot_phe_heatmap import _gwheatmap
|
|
101
|
+
from gwaslab.viz.viz_plot_mqqplot import mqqplot
|
|
102
|
+
from gwaslab.viz.viz_plot_trumpetplot import plottrumpet
|
|
103
|
+
from gwaslab.viz.viz_plot_compare_af import plotdaf
|
|
104
|
+
from gwaslab.viz.viz_plot_credible_sets import _plot_cs
|
|
105
|
+
|
|
106
|
+
from gwaslab.io.io_read_pipcs import _read_pipcs
|
|
107
|
+
from gwaslab.io.io_load_ld import tofinemapping_using_ld
|
|
108
|
+
from gwaslab.io.io_preformat_input import preformat
|
|
109
|
+
from gwaslab.io.io_to_formats import _to_format
|
|
110
|
+
from gwaslab.io.io_to_pickle import _offload
|
|
111
|
+
from gwaslab.io.io_to_pickle import _reload
|
|
101
112
|
|
|
102
113
|
#20220309
|
|
103
114
|
class Sumstats():
|
|
@@ -173,6 +184,8 @@ class Sumstats():
|
|
|
173
184
|
self.meta["gwaslab"]["study_name"] = study
|
|
174
185
|
self.meta["gwaslab"]["species"] = species
|
|
175
186
|
|
|
187
|
+
|
|
188
|
+
|
|
176
189
|
# initialize attributes for clumping and finmapping
|
|
177
190
|
#self.to_finemapping_file_path = ""
|
|
178
191
|
#self.to_finemapping_file = pd.DataFrame()
|
|
@@ -246,7 +259,6 @@ class Sumstats():
|
|
|
246
259
|
verbose=verbose,
|
|
247
260
|
readargs=readargs,
|
|
248
261
|
log=self.log)
|
|
249
|
-
|
|
250
262
|
|
|
251
263
|
# checking genome build
|
|
252
264
|
self.meta["gwaslab"]["genome_build"] = _process_build(build, log=self.log, verbose=False)
|
|
@@ -258,6 +270,9 @@ class Sumstats():
|
|
|
258
270
|
except:
|
|
259
271
|
pass
|
|
260
272
|
gc.collect()
|
|
273
|
+
|
|
274
|
+
self.id = id(self)
|
|
275
|
+
self.tmp_path = _path(pid=self.id, log = self.log, verbose=verbose)
|
|
261
276
|
|
|
262
277
|
#### healper #################################################################################
|
|
263
278
|
def update_meta(self, **kwargs):
|
|
@@ -790,6 +805,13 @@ class Sumstats():
|
|
|
790
805
|
# return sumstats object
|
|
791
806
|
return output
|
|
792
807
|
|
|
808
|
+
def get_associations(self, **kwargs):
|
|
809
|
+
associations_full,associations_summary = _extract_associations(self.data,**kwargs)
|
|
810
|
+
|
|
811
|
+
self.associations = associations_full
|
|
812
|
+
|
|
813
|
+
return associations_summary
|
|
814
|
+
|
|
793
815
|
def check_cis(self, gls=False, **kwargs):
|
|
794
816
|
if "SNPID" in self.data.columns:
|
|
795
817
|
id_to_use = "SNPID"
|
|
@@ -895,14 +917,15 @@ class Sumstats():
|
|
|
895
917
|
**kwargs)
|
|
896
918
|
|
|
897
919
|
def run_magma(self, build=None, verbose=True, **kwargs):
|
|
898
|
-
_run_magma(self
|
|
920
|
+
_run_magma(self,
|
|
899
921
|
study=self.meta["gwaslab"]["study_name"],
|
|
900
922
|
build=build, verbose=verbose, log=self.log, **kwargs)
|
|
901
923
|
|
|
902
924
|
def run_scdrs(self, build=None, verbose=True, **kwargs):
|
|
903
|
-
_run_scdrs(
|
|
925
|
+
_run_scdrs(self,
|
|
904
926
|
study=self.meta["gwaslab"]["study_name"],
|
|
905
|
-
build=build,
|
|
927
|
+
build=build,
|
|
928
|
+
verbose=verbose, log=self.log, **kwargs)
|
|
906
929
|
## LDSC ##############################################################################################
|
|
907
930
|
def estimate_h2_by_ldsc(self, build=None, verbose=True, match_allele=True, how="right", **kwargs):
|
|
908
931
|
if build is None:
|
|
@@ -949,20 +972,24 @@ class Sumstats():
|
|
|
949
972
|
# external ################################################################################################
|
|
950
973
|
|
|
951
974
|
def calculate_ld_matrix(self,**kwargs):
|
|
952
|
-
self.finemapping["path"],self.finemapping["file"],self.finemapping["plink_log"]= tofinemapping(self
|
|
975
|
+
self.finemapping["path"],self.finemapping["file"],self.finemapping["plink_log"]= tofinemapping(self, study = self.meta["gwaslab"]["study_name"],**kwargs)
|
|
953
976
|
#self.to_finemapping_file_path, self.to_finemapping_file, self.plink_log = tofinemapping(self.data,study = self.meta["gwaslab"]["study_name"],**kwargs)
|
|
954
977
|
def extract_ld_matrix(self,**kwargs):
|
|
955
978
|
self.finemapping["path"],self.finemapping["file"],self.finemapping["plink_log"]= tofinemapping_using_ld(self.data,study = self.meta["gwaslab"]["study_name"],**kwargs)
|
|
956
979
|
|
|
957
980
|
def run_susie_rss(self,**kwargs):
|
|
958
|
-
self.pipcs=_run_susie_rss(self
|
|
981
|
+
self.pipcs=_run_susie_rss(self, self.finemapping["path"], **kwargs)
|
|
959
982
|
self.finemapping["pipcs"] = self.pipcs
|
|
960
983
|
#self.pipcs=_run_susie_rss(self.to_finemapping_file_path,**kwargs)
|
|
984
|
+
|
|
961
985
|
def get_cs_lead(self,**kwargs):
|
|
962
986
|
return _get_cs_lead(self.pipcs,**kwargs)
|
|
963
987
|
|
|
964
988
|
def clump(self,**kwargs):
|
|
965
|
-
self.clumps["clumps"], self.clumps["clumps_raw"], self.clumps["plink_log"] = _clump(self
|
|
989
|
+
self.clumps["clumps"], self.clumps["clumps_raw"], self.clumps["plink_log"] = _clump(self,
|
|
990
|
+
log=self.log,
|
|
991
|
+
study = self.meta["gwaslab"]["study_name"],
|
|
992
|
+
**kwargs)
|
|
966
993
|
|
|
967
994
|
def calculate_prs(self,**kwargs):
|
|
968
995
|
combined_results_summary = _calculate_prs(self.data, log=self.log, study = self.meta["gwaslab"]["study_name"], **kwargs)
|
|
@@ -982,4 +1009,11 @@ class Sumstats():
|
|
|
982
1009
|
build = self.meta["gwaslab"]["genome_build"]
|
|
983
1010
|
_to_format(self.data, path, log=self.log, verbose=verbose, meta=self.meta, build=build, **kwargs)
|
|
984
1011
|
|
|
985
|
-
|
|
1012
|
+
######################################################################################
|
|
1013
|
+
def offload(self):
|
|
1014
|
+
_offload(self.data, self.tmp_path, self.log)
|
|
1015
|
+
del self.data
|
|
1016
|
+
gc.collect()
|
|
1017
|
+
|
|
1018
|
+
def reload(self):
|
|
1019
|
+
self.data = _reload(self.tmp_path, self.log)
|
gwaslab/g_SumstatsMulti.py
CHANGED
|
@@ -2,49 +2,60 @@ import pandas as pd
|
|
|
2
2
|
import numpy as np
|
|
3
3
|
import copy
|
|
4
4
|
import gc
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
from gwaslab.g_Log import Log
|
|
7
7
|
from math import floor
|
|
8
8
|
from gwaslab.g_Sumstats import Sumstats
|
|
9
9
|
from gwaslab.g_Sumstats_polars import Sumstatsp
|
|
10
|
-
|
|
11
|
-
from gwaslab.
|
|
12
|
-
|
|
13
|
-
from gwaslab.hm_casting import
|
|
14
|
-
from gwaslab.hm_casting import
|
|
15
|
-
from gwaslab.hm_casting import
|
|
16
|
-
from gwaslab.hm_casting import
|
|
17
|
-
|
|
18
|
-
from gwaslab.
|
|
19
|
-
from gwaslab.
|
|
20
|
-
from gwaslab.hm_casting_polars import
|
|
21
|
-
from gwaslab.hm_casting_polars import
|
|
22
|
-
from gwaslab.hm_casting_polars import
|
|
23
|
-
|
|
24
|
-
from gwaslab.
|
|
25
|
-
|
|
26
|
-
from gwaslab.
|
|
27
|
-
from gwaslab.
|
|
28
|
-
|
|
29
|
-
from gwaslab.
|
|
30
|
-
from gwaslab.
|
|
31
|
-
|
|
32
|
-
from gwaslab.
|
|
33
|
-
from gwaslab.
|
|
34
|
-
from gwaslab.
|
|
10
|
+
|
|
11
|
+
from gwaslab.bd.bd_path_manager import _path
|
|
12
|
+
|
|
13
|
+
from gwaslab.hm.hm_casting import _merge_mold_with_sumstats_by_chrpos
|
|
14
|
+
from gwaslab.hm.hm_casting import _align_with_mold
|
|
15
|
+
from gwaslab.hm.hm_casting import _fill_missing_columns
|
|
16
|
+
from gwaslab.hm.hm_casting import _check_daf
|
|
17
|
+
from gwaslab.hm.hm_casting import _assign_warning_code
|
|
18
|
+
from gwaslab.hm.hm_casting import _renaming_cols
|
|
19
|
+
from gwaslab.hm.hm_casting import _sort_pair_cols
|
|
20
|
+
from gwaslab.hm.hm_casting_polars import _merge_mold_with_sumstats_by_chrposp
|
|
21
|
+
from gwaslab.hm.hm_casting_polars import _align_with_moldp
|
|
22
|
+
from gwaslab.hm.hm_casting_polars import _fill_missing_columnsp
|
|
23
|
+
from gwaslab.hm.hm_casting_polars import _renaming_colsp
|
|
24
|
+
from gwaslab.hm.hm_casting_polars import _sort_pair_colsp
|
|
25
|
+
|
|
26
|
+
from gwaslab.qc.qc_fix_sumstats import flipallelestats
|
|
27
|
+
from gwaslab.qc.qc_fix_sumstats_polars import flipallelestatsp
|
|
28
|
+
|
|
29
|
+
from gwaslab.qc.qc_check_datatype_polars import check_datatype_polars
|
|
30
|
+
from gwaslab.qc.qc_check_datatype_polars import check_dataframe_shape_polars
|
|
31
|
+
|
|
32
|
+
from gwaslab.qc.qc_check_datatype import check_datatype
|
|
33
|
+
from gwaslab.qc.qc_check_datatype import check_dataframe_shape
|
|
34
|
+
from gwaslab.qc.qc_fix_sumstats import _process_build
|
|
35
|
+
|
|
36
|
+
from gwaslab.util.util_ex_calculate_ldmatrix import tofinemapping
|
|
37
|
+
from gwaslab.util.util_ex_run_coloc import _run_coloc_susie
|
|
38
|
+
from gwaslab.util.util_in_filter_value import filtervalues
|
|
39
|
+
from gwaslab.util.util_ex_run_2samplemr import _run_two_sample_mr
|
|
40
|
+
from gwaslab.util.util_ex_run_clumping import _clump
|
|
41
|
+
from gwaslab.util.util_ex_ldproxyfinder import _extract_with_ld_proxy
|
|
42
|
+
from gwaslab.util.util_ex_match_ldmatrix import tofinemapping_m
|
|
43
|
+
from gwaslab.util.util_ex_run_mesusie import _run_mesusie
|
|
44
|
+
from gwaslab.util.util_in_meta import meta_analyze_multi
|
|
45
|
+
from gwaslab.util.util_ex_run_hyprcoloc import _run_hyprcoloc
|
|
46
|
+
from gwaslab.util.util_in_get_sig import getsig
|
|
47
|
+
from gwaslab.util.util_in_fill_data import _get_multi_min
|
|
48
|
+
from gwaslab.util.util_ex_run_mtag import _run_mtag
|
|
49
|
+
|
|
50
|
+
from gwaslab.viz.viz_plot_miamiplot2 import plot_miami2
|
|
51
|
+
from gwaslab.viz.viz_plot_compare_af import plotdaf
|
|
52
|
+
|
|
35
53
|
from gwaslab.g_headers import _get_headers
|
|
36
|
-
from gwaslab.util_ex_match_ldmatrix import tofinemapping_m
|
|
37
|
-
from gwaslab.util_ex_run_mesusie import _run_mesusie
|
|
38
|
-
from gwaslab.util_in_meta import meta_analyze_multi
|
|
39
|
-
from gwaslab.util_ex_run_hyprcoloc import _run_hyprcoloc
|
|
40
|
-
from gwaslab.util_in_get_sig import getsig
|
|
41
|
-
from gwaslab.util_in_fill_data import _get_multi_min
|
|
42
54
|
from gwaslab.g_meta import _init_meta
|
|
43
55
|
from gwaslab.g_meta_update import _update_meta
|
|
44
|
-
from gwaslab.qc_fix_sumstats import _process_build
|
|
45
|
-
from gwaslab.util_ex_run_mtag import _run_mtag
|
|
46
|
-
|
|
47
56
|
|
|
57
|
+
from gwaslab.io.io_to_pickle import _offload
|
|
58
|
+
from gwaslab.io.io_to_pickle import _reload
|
|
48
59
|
|
|
49
60
|
class SumstatsMulti( ):
|
|
50
61
|
def __init__(self,
|
|
@@ -63,6 +74,10 @@ class SumstatsMulti( ):
|
|
|
63
74
|
|
|
64
75
|
self.log = Log()
|
|
65
76
|
self.meta = _init_meta(object="SumstatsMulti")
|
|
77
|
+
self.id = id(self)
|
|
78
|
+
self.tmp_path = _path(pid=self.id,
|
|
79
|
+
log = self.log,
|
|
80
|
+
verbose=verbose)
|
|
66
81
|
|
|
67
82
|
if engine=="polars":
|
|
68
83
|
import polars as pl
|
|
@@ -94,10 +109,17 @@ class SumstatsMulti( ):
|
|
|
94
109
|
|
|
95
110
|
for i,sumstatsObject in enumerate(sumstatsObjects):
|
|
96
111
|
self.log.write( " -Checking sumstats Object #{}...".format(i+1), verbose=verbose)
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
112
|
+
|
|
113
|
+
if engine=="polars":
|
|
114
|
+
check_datatype_polars(sumstatsObject.data, log=self.log, verbose=verbose)
|
|
115
|
+
check_dataframe_shape_polars(sumstats=sumstatsObject.data,
|
|
116
|
+
log=self.log,
|
|
117
|
+
verbose=verbose)
|
|
118
|
+
else:
|
|
119
|
+
check_datatype(sumstatsObject.data, log=self.log, verbose=verbose)
|
|
120
|
+
check_dataframe_shape(sumstats=sumstatsObject.data,
|
|
121
|
+
log=self.log,
|
|
122
|
+
verbose=verbose)
|
|
101
123
|
|
|
102
124
|
if sumstatsObject.meta["gwaslab"]["study_name"] in self.names:
|
|
103
125
|
new_study_name = "{}_{}".format(sumstatsObject.meta["gwaslab"]["study_name"],i+1)
|
|
@@ -249,7 +271,7 @@ class SumstatsMulti( ):
|
|
|
249
271
|
self.hyprcoloc = hyprcoloc_res_combined
|
|
250
272
|
|
|
251
273
|
def run_mtag(self,**kwargs):
|
|
252
|
-
_run_mtag( self
|
|
274
|
+
_run_mtag( self,
|
|
253
275
|
nstudy = self.meta["gwaslab"]["number_of_studies"],
|
|
254
276
|
study= self.meta["gwaslab"]["group_name"],
|
|
255
277
|
traits=self.names,
|
|
@@ -288,3 +310,10 @@ class SumstatsMulti( ):
|
|
|
288
310
|
|
|
289
311
|
return output
|
|
290
312
|
|
|
313
|
+
def offload(self):
|
|
314
|
+
_offload(self.data, self.tmp_path, self.log)
|
|
315
|
+
del self.data
|
|
316
|
+
gc.collect()
|
|
317
|
+
|
|
318
|
+
def reload(self):
|
|
319
|
+
self.data = _reload(self.tmp_path, self.log)
|
gwaslab/g_SumstatsPair.py
CHANGED
|
@@ -2,34 +2,42 @@ import pandas as pd
|
|
|
2
2
|
import numpy as np
|
|
3
3
|
import copy
|
|
4
4
|
import gc
|
|
5
|
-
from gwaslab.util_in_filter_value import filtervalues
|
|
6
|
-
from gwaslab.g_Log import Log
|
|
7
5
|
from math import floor
|
|
8
|
-
|
|
9
|
-
from gwaslab.hm_casting import _merge_mold_with_sumstats_by_chrpos
|
|
10
|
-
from gwaslab.hm_casting import _align_with_mold
|
|
11
|
-
from gwaslab.hm_casting import _fill_missing_columns
|
|
12
|
-
from gwaslab.hm_casting import _check_daf
|
|
13
|
-
from gwaslab.hm_casting import _assign_warning_code
|
|
14
|
-
from gwaslab.qc_fix_sumstats import flipallelestats
|
|
15
|
-
from gwaslab.qc_check_datatype import check_datatype
|
|
16
|
-
from gwaslab.qc_check_datatype import check_dataframe_shape
|
|
17
|
-
from gwaslab.hm_casting import _renaming_cols
|
|
18
|
-
from gwaslab.hm_casting import _sort_pair_cols
|
|
19
|
-
from gwaslab.util_ex_calculate_ldmatrix import tofinemapping
|
|
20
|
-
from gwaslab.util_ex_run_coloc import _run_coloc_susie
|
|
21
|
-
from gwaslab.viz_plot_miamiplot2 import plot_miami2
|
|
22
|
-
from gwaslab.viz_plot_compare_af import plotdaf
|
|
23
|
-
from gwaslab.util_ex_run_2samplemr import _run_two_sample_mr
|
|
24
|
-
from gwaslab.util_ex_run_clumping import _clump
|
|
25
|
-
from gwaslab.util_ex_ldproxyfinder import _extract_with_ld_proxy
|
|
26
|
-
from gwaslab.g_headers import _get_headers
|
|
27
|
-
from gwaslab.util_ex_match_ldmatrix import tofinemapping_m
|
|
28
|
-
from gwaslab.util_ex_run_mesusie import _run_mesusie
|
|
29
|
-
from gwaslab.io_read_pipcs import _read_pipcs
|
|
6
|
+
|
|
30
7
|
from gwaslab.g_meta import _init_meta
|
|
31
|
-
from gwaslab.
|
|
32
|
-
from gwaslab.
|
|
8
|
+
from gwaslab.g_headers import _get_headers
|
|
9
|
+
from gwaslab.g_Log import Log
|
|
10
|
+
from gwaslab.g_Sumstats import Sumstats
|
|
11
|
+
|
|
12
|
+
from gwaslab.hm.hm_casting import _merge_mold_with_sumstats_by_chrpos
|
|
13
|
+
from gwaslab.hm.hm_casting import _align_with_mold
|
|
14
|
+
from gwaslab.hm.hm_casting import _fill_missing_columns
|
|
15
|
+
from gwaslab.hm.hm_casting import _check_daf
|
|
16
|
+
from gwaslab.hm.hm_casting import _assign_warning_code
|
|
17
|
+
from gwaslab.hm.hm_casting import _renaming_cols
|
|
18
|
+
from gwaslab.hm.hm_casting import _sort_pair_cols
|
|
19
|
+
|
|
20
|
+
from gwaslab.qc.qc_fix_sumstats import flipallelestats
|
|
21
|
+
from gwaslab.qc.qc_check_datatype import check_datatype
|
|
22
|
+
from gwaslab.qc.qc_check_datatype import check_dataframe_shape
|
|
23
|
+
|
|
24
|
+
from gwaslab.util.util_ex_calculate_ldmatrix import tofinemapping
|
|
25
|
+
from gwaslab.util.util_ex_run_coloc import _run_coloc_susie
|
|
26
|
+
from gwaslab.util.util_ex_run_ccgwas import _run_ccgwas
|
|
27
|
+
from gwaslab.util.util_ex_run_2samplemr import _run_two_sample_mr
|
|
28
|
+
from gwaslab.util.util_ex_run_clumping import _clump
|
|
29
|
+
from gwaslab.util.util_ex_ldproxyfinder import _extract_with_ld_proxy
|
|
30
|
+
from gwaslab.util.util_ex_match_ldmatrix import tofinemapping_m
|
|
31
|
+
from gwaslab.util.util_ex_run_mesusie import _run_mesusie
|
|
32
|
+
from gwaslab.util.util_in_filter_value import filtervalues
|
|
33
|
+
|
|
34
|
+
from gwaslab.viz.viz_plot_stackedregional import plot_stacked_mqq
|
|
35
|
+
from gwaslab.viz.viz_plot_miamiplot2 import plot_miami2
|
|
36
|
+
from gwaslab.viz.viz_plot_compare_af import plotdaf
|
|
37
|
+
|
|
38
|
+
from gwaslab.io.io_to_pickle import _offload
|
|
39
|
+
from gwaslab.io.io_to_pickle import _reload
|
|
40
|
+
from gwaslab.io.io_read_pipcs import _read_pipcs
|
|
33
41
|
|
|
34
42
|
class SumstatsPair( ):
|
|
35
43
|
def __init__(self, sumstatsObject1, sumstatsObject2, study=None, suffixes = ("_1","_2") ,verbose=True ):
|
|
@@ -40,6 +48,8 @@ class SumstatsPair( ):
|
|
|
40
48
|
raise ValueError("Please provide GWASLab Sumstats Object #2.")
|
|
41
49
|
|
|
42
50
|
self.meta = _init_meta(object="SumstatsPair")
|
|
51
|
+
self.id = id(self)
|
|
52
|
+
self.tmp_path = f"./{self.id}"
|
|
43
53
|
|
|
44
54
|
if sumstatsObject1.meta["gwaslab"]["study_name"]!=sumstatsObject2.meta["gwaslab"]["study_name"]:
|
|
45
55
|
self.study_name = "{}_{}".format(sumstatsObject1.meta["gwaslab"]["study_name"], sumstatsObject2.meta["gwaslab"]["study_name"])
|
|
@@ -186,18 +196,18 @@ class SumstatsPair( ):
|
|
|
186
196
|
|
|
187
197
|
|
|
188
198
|
def clump(self,**kwargs):
|
|
189
|
-
self.clumps["clumps"],self.clumps["clumps_raw"],self.clumps["plink_log"] = _clump(self
|
|
199
|
+
self.clumps["clumps"],self.clumps["clumps_raw"],self.clumps["plink_log"] = _clump(self, log=self.log, p="P_1",mlog10p="MLOG10P_1", study = self.meta["gwaslab"]["group_name"], **kwargs)
|
|
190
200
|
|
|
191
201
|
def to_coloc(self,**kwargs):
|
|
192
|
-
self.coloc["path"],self.coloc["file"],self.coloc["plink_log"] = tofinemapping(self
|
|
202
|
+
self.coloc["path"],self.coloc["file"],self.coloc["plink_log"] = tofinemapping(self,study=self.meta["gwaslab"]["group_name"],suffixes=self.suffixes,log=self.log,**kwargs)
|
|
193
203
|
|
|
194
204
|
def to_mesusie(self,**kwargs):
|
|
195
205
|
self.mesusie["path"],self.mesusie["file"],self.mesusie["plink_log"] = tofinemapping_m(self.data,
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
206
|
+
studies = self.study_names,
|
|
207
|
+
group = self.meta["gwaslab"]["group_name"],
|
|
208
|
+
suffixes=self.suffixes,
|
|
209
|
+
log=self.log,
|
|
210
|
+
**kwargs)
|
|
201
211
|
|
|
202
212
|
def run_mesusie(self,**kwargs):
|
|
203
213
|
prefix = _run_mesusie(self.mesusie["path"],log=self.log,ncols=self.ns,**kwargs)
|
|
@@ -224,11 +234,11 @@ class SumstatsPair( ):
|
|
|
224
234
|
**kwargs)
|
|
225
235
|
|
|
226
236
|
def run_coloc_susie(self,**kwargs):
|
|
227
|
-
self.coloc_susie_res = _run_coloc_susie(self.coloc["path"],log=self.log,ncols=self.ns,**kwargs)
|
|
237
|
+
self.coloc_susie_res = _run_coloc_susie(self, self.coloc["path"],log=self.log,ncols=self.ns,**kwargs)
|
|
228
238
|
|
|
229
239
|
def run_two_sample_mr(self, clump=False, **kwargs):
|
|
230
|
-
exposure1 = self.
|
|
231
|
-
outcome2 = self.
|
|
240
|
+
exposure1 = self.study_names[0]
|
|
241
|
+
outcome2 = self.study_names[1]
|
|
232
242
|
_run_two_sample_mr(self,exposure1=exposure1,outcome2=outcome2, clump=clump,**kwargs)
|
|
233
243
|
|
|
234
244
|
def extract_with_ld_proxy(self,**arg):
|
|
@@ -266,4 +276,11 @@ class SumstatsPair( ):
|
|
|
266
276
|
xlabel="Effect Allele Frequency in Sumstats 1",
|
|
267
277
|
ylabel="Effect Allele Frequency in Sumstats 2",
|
|
268
278
|
**kwargs)
|
|
269
|
-
|
|
279
|
+
|
|
280
|
+
def offload(self):
|
|
281
|
+
_offload(self.data, self.tmp_path, self.log)
|
|
282
|
+
del self.data
|
|
283
|
+
gc.collect()
|
|
284
|
+
|
|
285
|
+
def reload(self):
|
|
286
|
+
self.data = _reload(self.tmp_path, self.log)
|