gwaslab 3.6.5__py3-none-any.whl → 3.6.7__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} +6 -5
- gwaslab/{io_read_tabular.py → io/io_read_tabular.py} +2 -2
- gwaslab/{io_to_formats.py → io/io_to_formats.py} +13 -9
- 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 +117 -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} +48 -38
- gwaslab/{viz_plot_phe_heatmap.py → viz/viz_plot_phe_heatmap.py} +18 -15
- gwaslab/{viz_plot_qqplot.py → viz/viz_plot_qqplot.py} +4 -2
- 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} +11 -9
- {gwaslab-3.6.5.dist-info → gwaslab-3.6.7.dist-info}/METADATA +1 -1
- gwaslab-3.6.7.dist-info/RECORD +123 -0
- gwaslab/bd_config.py +0 -18
- gwaslab-3.6.5.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.5.dist-info → gwaslab-3.6.7.dist-info}/WHEEL +0 -0
- {gwaslab-3.6.5.dist-info → gwaslab-3.6.7.dist-info}/licenses/LICENSE +0 -0
- {gwaslab-3.6.5.dist-info → gwaslab-3.6.7.dist-info}/licenses/LICENSE_before_v3.4.39 +0 -0
- {gwaslab-3.6.5.dist-info → gwaslab-3.6.7.dist-info}/top_level.txt +0 -0
gwaslab/__init__.py
CHANGED
|
@@ -3,51 +3,61 @@ from gwaslab.g_Sumstats_polars import Sumstatsp
|
|
|
3
3
|
from gwaslab.g_SumstatsT import SumstatsT
|
|
4
4
|
from gwaslab.g_SumstatsPair import SumstatsPair
|
|
5
5
|
from gwaslab.g_SumstatsMulti import SumstatsMulti
|
|
6
|
-
from gwaslab.
|
|
7
|
-
from gwaslab.util_in_convert_h2 import _get_per_snp_r2
|
|
8
|
-
from gwaslab.util_in_convert_h2 import h2_se_to_p
|
|
9
|
-
from gwaslab.viz_plot_compare_effect import compare_effect
|
|
10
|
-
from gwaslab.io_read_ldsc import read_ldsc
|
|
11
|
-
from gwaslab.io_read_ldsc import read_popcorn
|
|
12
|
-
from gwaslab.viz_plot_forestplot import plot_forest
|
|
13
|
-
from gwaslab.viz_plot_miamiplot import plot_miami
|
|
14
|
-
from gwaslab.viz_plot_miamiplot2 import plot_miami2
|
|
15
|
-
from gwaslab.viz_plot_rg_heatmap import plot_rg
|
|
16
|
-
from gwaslab.viz_plot_stackedregional import plot_stacked_mqq
|
|
17
|
-
from gwaslab.util_ex_gwascatalog import gwascatalog_trait
|
|
18
|
-
from gwaslab.bd_common_data import get_NC_to_chr
|
|
19
|
-
from gwaslab.bd_common_data import get_NC_to_number
|
|
20
|
-
from gwaslab.bd_common_data import get_chr_to_NC
|
|
21
|
-
from gwaslab.bd_common_data import get_number_to_NC
|
|
22
|
-
from gwaslab.bd_common_data import get_chr_list
|
|
23
|
-
from gwaslab.bd_common_data import get_number_to_chr
|
|
24
|
-
from gwaslab.bd_common_data import get_chr_to_number
|
|
25
|
-
from gwaslab.bd_common_data import get_high_ld
|
|
26
|
-
from gwaslab.bd_common_data import get_format_dict
|
|
27
|
-
from gwaslab.bd_common_data import get_formats_list
|
|
28
|
-
from gwaslab.bd_download import update_formatbook
|
|
29
|
-
from gwaslab.bd_download import list_formats
|
|
30
|
-
from gwaslab.bd_download import check_format
|
|
31
|
-
from gwaslab.bd_download import check_available_ref
|
|
32
|
-
from gwaslab.bd_download import update_available_ref
|
|
33
|
-
from gwaslab.bd_download import check_downloaded_ref
|
|
34
|
-
from gwaslab.bd_download import download_ref
|
|
35
|
-
from gwaslab.bd_download import check_available_ref
|
|
36
|
-
from gwaslab.bd_download import remove_file
|
|
37
|
-
from gwaslab.bd_download import get_path
|
|
38
|
-
from gwaslab.bd_download import update_record
|
|
39
|
-
from gwaslab.io_to_pickle import dump_pickle
|
|
40
|
-
from gwaslab.io_to_pickle import load_pickle
|
|
41
|
-
from gwaslab.bd_config import options
|
|
6
|
+
from gwaslab.g_SumstatsSet import SumstatsSet
|
|
42
7
|
from gwaslab.g_version import _show_version as show_version
|
|
43
|
-
|
|
44
|
-
from gwaslab.
|
|
45
|
-
from gwaslab.
|
|
46
|
-
from gwaslab.
|
|
47
|
-
from gwaslab.
|
|
48
|
-
from gwaslab.
|
|
49
|
-
from gwaslab.
|
|
50
|
-
from gwaslab.
|
|
51
|
-
from gwaslab.
|
|
52
|
-
from gwaslab.
|
|
53
|
-
from gwaslab.
|
|
8
|
+
|
|
9
|
+
from gwaslab.util.util_in_convert_h2 import h2_obs_to_liab
|
|
10
|
+
from gwaslab.util.util_in_convert_h2 import _get_per_snp_r2
|
|
11
|
+
from gwaslab.util.util_in_convert_h2 import h2_se_to_p
|
|
12
|
+
from gwaslab.util.util_in_calculate_power import get_power
|
|
13
|
+
from gwaslab.util.util_in_calculate_power import get_beta
|
|
14
|
+
from gwaslab.util.util_ex_gwascatalog import gwascatalog_trait
|
|
15
|
+
from gwaslab.util.util_ex_process_h5 import process_vcf_to_hfd5
|
|
16
|
+
from gwaslab.util.util_ex_run_susie import _run_susie_rss as run_susie_rss
|
|
17
|
+
from gwaslab.util.util_in_meta import meta_analyze
|
|
18
|
+
from gwaslab.util.util_in_fill_data import rank_based_int
|
|
19
|
+
|
|
20
|
+
from gwaslab.io.io_read_ldsc import read_ldsc
|
|
21
|
+
from gwaslab.io.io_read_ldsc import read_popcorn
|
|
22
|
+
from gwaslab.io.io_to_pickle import dump_pickle
|
|
23
|
+
from gwaslab.io.io_to_pickle import load_pickle
|
|
24
|
+
from gwaslab.io.io_read_tabular import _read_tabular as read_tabular
|
|
25
|
+
|
|
26
|
+
from gwaslab.viz.viz_plot_compare_effect import compare_effect
|
|
27
|
+
from gwaslab.viz.viz_plot_forestplot import plot_forest
|
|
28
|
+
from gwaslab.viz.viz_plot_miamiplot import plot_miami
|
|
29
|
+
from gwaslab.viz.viz_plot_miamiplot2 import plot_miami2
|
|
30
|
+
from gwaslab.viz.viz_plot_rg_heatmap import plot_rg
|
|
31
|
+
from gwaslab.viz.viz_plot_stackedregional import plot_stacked_mqq
|
|
32
|
+
from gwaslab.viz.viz_plot_trumpetplot import plot_power
|
|
33
|
+
from gwaslab.viz.viz_plot_trumpetplot import plot_power_x
|
|
34
|
+
from gwaslab.viz.viz_plot_scatter_with_reg import scatter
|
|
35
|
+
|
|
36
|
+
from gwaslab.bd.bd_common_data import get_NC_to_chr
|
|
37
|
+
from gwaslab.bd.bd_common_data import get_NC_to_number
|
|
38
|
+
from gwaslab.bd.bd_common_data import get_chr_to_NC
|
|
39
|
+
from gwaslab.bd.bd_common_data import get_number_to_NC
|
|
40
|
+
from gwaslab.bd.bd_common_data import get_chr_list
|
|
41
|
+
from gwaslab.bd.bd_common_data import get_number_to_chr
|
|
42
|
+
from gwaslab.bd.bd_common_data import get_chr_to_number
|
|
43
|
+
from gwaslab.bd.bd_common_data import get_high_ld
|
|
44
|
+
from gwaslab.bd.bd_common_data import get_format_dict
|
|
45
|
+
from gwaslab.bd.bd_common_data import get_formats_list
|
|
46
|
+
from gwaslab.bd.bd_download import update_formatbook
|
|
47
|
+
from gwaslab.bd.bd_download import list_formats
|
|
48
|
+
from gwaslab.bd.bd_download import check_format
|
|
49
|
+
from gwaslab.bd.bd_download import check_available_ref
|
|
50
|
+
from gwaslab.bd.bd_download import update_available_ref
|
|
51
|
+
from gwaslab.bd.bd_download import check_downloaded_ref
|
|
52
|
+
from gwaslab.bd.bd_download import download_ref
|
|
53
|
+
from gwaslab.bd.bd_download import check_available_ref
|
|
54
|
+
from gwaslab.bd.bd_download import remove_file
|
|
55
|
+
from gwaslab.bd.bd_download import get_path
|
|
56
|
+
from gwaslab.bd.bd_download import update_record
|
|
57
|
+
from gwaslab.bd.bd_config import options
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
@@ -4,14 +4,15 @@ import tarfile
|
|
|
4
4
|
import requests
|
|
5
5
|
import pandas as pd
|
|
6
6
|
from os import path
|
|
7
|
+
from pathlib import Path
|
|
7
8
|
from pyensembl import Genome
|
|
8
9
|
from gtfparse import read_gtf
|
|
9
10
|
# read_gtf -> v1.3.0
|
|
10
11
|
from gwaslab.g_Log import Log
|
|
11
|
-
from gwaslab.bd_download import download_ref
|
|
12
|
-
from gwaslab.bd_download import check_and_download
|
|
13
|
-
from gwaslab.bd_download import update_formatbook
|
|
14
|
-
from gwaslab.bd_config import options
|
|
12
|
+
from gwaslab.bd.bd_download import download_ref
|
|
13
|
+
from gwaslab.bd.bd_download import check_and_download
|
|
14
|
+
from gwaslab.bd.bd_download import update_formatbook
|
|
15
|
+
from gwaslab.bd.bd_config import options
|
|
15
16
|
|
|
16
17
|
#hard-coded data
|
|
17
18
|
def get_chr_to_NC(build,inverse=False):
|
|
@@ -188,9 +189,11 @@ def get_number_to_chr(in_chr=False,xymt=["X","Y","MT"],xymt_num=[23,24,25],prefi
|
|
|
188
189
|
###################################################################################################################
|
|
189
190
|
def get_high_ld(build="19"):
|
|
190
191
|
if build=="19":
|
|
191
|
-
data_path = path.dirname(__file__) + '/data/high_ld/high_ld_hla_hg19.bed.gz'
|
|
192
|
+
#data_path = path.dirname(__file__) + '/data/high_ld/high_ld_hla_hg19.bed.gz'
|
|
193
|
+
data_path = path.join( Path(__file__).parents[1], "data","high_ld","high_ld_hla_hg19.bed.gz")
|
|
192
194
|
elif build=="38":
|
|
193
|
-
data_path = path.dirname(__file__) + '/data/high_ld/high_ld_hla_hg38.bed.gz'
|
|
195
|
+
#data_path = path.dirname(__file__) + '/data/high_ld/high_ld_hla_hg38.bed.gz'
|
|
196
|
+
data_path = path.join( Path(__file__).parents[1], "data","high_ld","high_ld_hla_hg38.bed.gz")
|
|
194
197
|
return data_path
|
|
195
198
|
|
|
196
199
|
def get_format_dict(fmt,inverse=False):
|
|
@@ -347,9 +350,7 @@ def _inch_to_point(inch):
|
|
|
347
350
|
#points: 1/72 inch
|
|
348
351
|
return inch*72
|
|
349
352
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
+
NA_STRINGS=["na","NA","Na","Nan","NaN","<NA>","null","NULL","#N/A","#VALUE!","N/A","n/a","missing",""]
|
|
353
354
|
|
|
354
355
|
|
|
355
356
|
|
gwaslab/bd/bd_config.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
from os import path
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
class Options_dic:
|
|
5
|
+
def __init__(self,path_dic):
|
|
6
|
+
self.paths = path_dic
|
|
7
|
+
self.default = path_dic.copy()
|
|
8
|
+
def set_option(self,key,path):
|
|
9
|
+
self.paths[key] = path
|
|
10
|
+
def reset_option(self):
|
|
11
|
+
self.paths = self.default.copy()
|
|
12
|
+
|
|
13
|
+
#default_dic={
|
|
14
|
+
# "config": path.dirname(__file__) + "/data/config.json",
|
|
15
|
+
# "reference": path.dirname(__file__) + "/data/reference.json",
|
|
16
|
+
# "formatbook": path.dirname(__file__) + "/data/formatbook.json",
|
|
17
|
+
# "data_directory": path.expanduser('~') + "/.gwaslab/"
|
|
18
|
+
#}
|
|
19
|
+
|
|
20
|
+
default_dic={
|
|
21
|
+
"config": path.join(Path(__file__).parents[1], "data","config.json"),
|
|
22
|
+
"reference": path.join(Path(__file__).parents[1], "data","reference.json"),
|
|
23
|
+
"formatbook": path.join(Path(__file__).parents[1], "data","formatbook.json"),
|
|
24
|
+
"data_directory": path.expanduser('~') + "/.gwaslab/"
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
options = Options_dic(default_dic)
|
|
@@ -6,7 +6,7 @@ import requests
|
|
|
6
6
|
import shutil
|
|
7
7
|
import hashlib
|
|
8
8
|
from gwaslab.g_Log import Log
|
|
9
|
-
from gwaslab.bd_config import options
|
|
9
|
+
from gwaslab.bd.bd_config import options
|
|
10
10
|
import re
|
|
11
11
|
from gwaslab.g_version import _get_version
|
|
12
12
|
#### config ##############################################################################################
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import pandas as pd
|
|
2
2
|
from os import path
|
|
3
3
|
from gwaslab.g_Log import Log
|
|
4
|
-
from gwaslab.qc_fix_sumstats import start_to
|
|
5
|
-
from gwaslab.qc_fix_sumstats import skipped
|
|
6
|
-
from gwaslab.qc_fix_sumstats import finished
|
|
4
|
+
from gwaslab.qc.qc_fix_sumstats import start_to
|
|
5
|
+
from gwaslab.qc.qc_fix_sumstats import skipped
|
|
6
|
+
from gwaslab.qc.qc_fix_sumstats import finished
|
|
7
|
+
from pathlib import Path
|
|
7
8
|
|
|
8
9
|
#A unique identifier (e.g., the rs number)
|
|
9
10
|
#Allele 1 (effect allele)
|
|
@@ -32,10 +33,12 @@ def gethapmap3(sumstats,rsid="rsID",chrom="CHR", pos="POS", ea="EA", nea="NEA",b
|
|
|
32
33
|
|
|
33
34
|
############################################################################################
|
|
34
35
|
if build=="19":
|
|
35
|
-
data_path = path.dirname(__file__) + '/data/hapmap3_SNPs/hapmap3_db150_hg19.snplist.gz'
|
|
36
|
+
#data_path = path.dirname(__file__) + '/data/hapmap3_SNPs/hapmap3_db150_hg19.snplist.gz'
|
|
37
|
+
data_path = path.join( Path(__file__).parents[1], "data","hapmap3_SNPs","hapmap3_db150_hg19.snplist.gz")
|
|
36
38
|
elif build=="38":
|
|
37
|
-
data_path = path.dirname(__file__) + '/data/hapmap3_SNPs/hapmap3_db151_hg38.snplist.gz'
|
|
38
|
-
|
|
39
|
+
#data_path = path.dirname(__file__) + '/data/hapmap3_SNPs/hapmap3_db151_hg38.snplist.gz'
|
|
40
|
+
data_path = path.join( Path(__file__).parents[1], "data","hapmap3_SNPs","hapmap3_db151_hg38.snplist.gz")
|
|
41
|
+
|
|
39
42
|
log.write(" -Loading Hapmap3 variants from built-in datasets...", verbose=verbose)
|
|
40
43
|
|
|
41
44
|
if match_allele:
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from gwaslab.g_Log import Log
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def _path( *args,
|
|
6
|
+
out = None,
|
|
7
|
+
directory = None,
|
|
8
|
+
tmp = False,
|
|
9
|
+
prefix=None,
|
|
10
|
+
study = None,
|
|
11
|
+
nstudy=None,
|
|
12
|
+
trait = None,
|
|
13
|
+
exposure = None,
|
|
14
|
+
outcome = None,
|
|
15
|
+
chrom = None,
|
|
16
|
+
rsid = None,
|
|
17
|
+
snpid = None,
|
|
18
|
+
locus = None,
|
|
19
|
+
loci = None,
|
|
20
|
+
analysis = None,
|
|
21
|
+
mode = None,
|
|
22
|
+
method = None,
|
|
23
|
+
ancestry = None,
|
|
24
|
+
population = None,
|
|
25
|
+
sample_size = None,
|
|
26
|
+
genotyping = None,
|
|
27
|
+
pid = None,
|
|
28
|
+
build = None,
|
|
29
|
+
suffix = None,
|
|
30
|
+
log = Log(),
|
|
31
|
+
verbose=True
|
|
32
|
+
):
|
|
33
|
+
'''
|
|
34
|
+
Create path for files generated by gwaslab.
|
|
35
|
+
|
|
36
|
+
If out is provided, out will be checked if it is a dir.
|
|
37
|
+
If not, out will be parsed into dirname and basename.
|
|
38
|
+
|
|
39
|
+
'''
|
|
40
|
+
out_basename = ""
|
|
41
|
+
|
|
42
|
+
if out is not None:
|
|
43
|
+
if os.path.isdir(out):
|
|
44
|
+
directory = out
|
|
45
|
+
log.write( "Directory detected: {}".format(directory), verbose=verbose)
|
|
46
|
+
else:
|
|
47
|
+
directory = os.path.dirname(out)
|
|
48
|
+
log.write( "Directory detected: {}".format(directory), verbose=verbose)
|
|
49
|
+
out_basename = os.path.basename(out)
|
|
50
|
+
log.write( "Basename detected: {}".format(out_basename), verbose=verbose)
|
|
51
|
+
|
|
52
|
+
if out_basename == "":
|
|
53
|
+
# create default path
|
|
54
|
+
###############################################################################################################################################
|
|
55
|
+
path_list = []
|
|
56
|
+
|
|
57
|
+
# ordered components excluding directory, suffix
|
|
58
|
+
path_order = [
|
|
59
|
+
"prefix", "study", "nstudy", "trait", "exposure", "outcome",
|
|
60
|
+
"chrom", "rsid", "snpid", "locus", "loci", "analysis", "mode_methods",
|
|
61
|
+
"ancestry", "population","sample_size", "genotyping", "pid", "build"
|
|
62
|
+
]
|
|
63
|
+
|
|
64
|
+
# create default path
|
|
65
|
+
###############################################################################################################################################
|
|
66
|
+
if tmp == True:
|
|
67
|
+
pid = id(path_list)
|
|
68
|
+
|
|
69
|
+
###############################################################################################################################################
|
|
70
|
+
all_args = locals()
|
|
71
|
+
for key,value in all_args.items():
|
|
72
|
+
if key in path_order:
|
|
73
|
+
if value is not None:
|
|
74
|
+
if value !=False:
|
|
75
|
+
path_list.append(value)
|
|
76
|
+
|
|
77
|
+
# merge path components
|
|
78
|
+
path_list = list(map(str, path_list)) + list(map(str, args))
|
|
79
|
+
path_list = list(map(lambda x: x.replace("_","-") , path_list))
|
|
80
|
+
|
|
81
|
+
if tmp == True:
|
|
82
|
+
path_list.insert(0, "_gwaslab")
|
|
83
|
+
|
|
84
|
+
log.write( "Path component detected: {}".format(path_list), verbose=verbose)
|
|
85
|
+
|
|
86
|
+
path = "_".join(path_list)
|
|
87
|
+
else:
|
|
88
|
+
# use user-provided path
|
|
89
|
+
path = out_basename
|
|
90
|
+
###############################################################################################################################################
|
|
91
|
+
|
|
92
|
+
# add directory
|
|
93
|
+
if directory is not None:
|
|
94
|
+
path = os.path.join(directory, path)
|
|
95
|
+
else:
|
|
96
|
+
path = os.path.join("./", path)
|
|
97
|
+
###############################################################################################################################################
|
|
98
|
+
|
|
99
|
+
# add file extension
|
|
100
|
+
if suffix is not None:
|
|
101
|
+
path = ".".join([path, suffix])
|
|
102
|
+
###############################################################################################################################################
|
|
103
|
+
|
|
104
|
+
log.write( "Creating path: {}".format(path), verbose=verbose)
|
|
105
|
+
|
|
106
|
+
return path
|
|
107
|
+
|
|
108
|
+
def _process_out(out):
|
|
109
|
+
out_dirname = os.path.dirname(out)
|
|
110
|
+
out_basename = os.path.base_name(out)
|