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
|
@@ -1,62 +1,8 @@
|
|
|
1
1
|
import pandas as pd
|
|
2
2
|
import matplotlib.pyplot as plt
|
|
3
|
-
|
|
4
|
-
import matplotlib.patches as patches
|
|
5
|
-
import seaborn as sns
|
|
6
|
-
import numpy as np
|
|
7
|
-
import scipy as sp
|
|
8
|
-
import copy
|
|
9
|
-
from math import ceil
|
|
10
|
-
from shutil import which
|
|
11
|
-
from pyensembl import EnsemblRelease
|
|
12
|
-
from allel import GenotypeArray
|
|
13
|
-
from allel import read_vcf
|
|
14
|
-
from allel import rogers_huff_r_between
|
|
15
|
-
import matplotlib as mpl
|
|
16
|
-
from scipy import stats
|
|
17
|
-
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
|
|
18
|
-
from mpl_toolkits.axes_grid1.inset_locator import mark_inset
|
|
19
|
-
from matplotlib.ticker import MaxNLocator
|
|
20
|
-
import gc as garbage_collect
|
|
21
|
-
from adjustText import adjust_text
|
|
22
|
-
from gwaslab.viz_aux_reposition_text import adjust_text_position
|
|
23
|
-
from gwaslab.viz_aux_annotate_plot import annotate_single
|
|
24
|
-
from gwaslab.viz_plot_qqplot import _plot_qq
|
|
25
|
-
from gwaslab.hm_harmonize_sumstats import auto_check_vcf_chr_dict
|
|
26
|
-
from gwaslab.viz_plot_regional2 import _plot_regional
|
|
27
|
-
from gwaslab.viz_plot_regional2 import process_vcf
|
|
28
|
-
from gwaslab.viz_plot_regional2 import _get_lead_id
|
|
29
|
-
from gwaslab.viz_aux_quickfix import _get_largenumber
|
|
30
|
-
from gwaslab.viz_aux_quickfix import _quick_fix_p_value
|
|
31
|
-
from gwaslab.viz_aux_quickfix import _quick_fix_pos
|
|
32
|
-
from gwaslab.viz_aux_quickfix import _quick_fix_chr
|
|
33
|
-
from gwaslab.viz_aux_quickfix import _quick_fix_eaf
|
|
34
|
-
from gwaslab.viz_aux_quickfix import _quick_fix_mlog10p
|
|
35
|
-
from gwaslab.viz_aux_quickfix import _quick_add_tchrpos
|
|
36
|
-
from gwaslab.viz_aux_quickfix import _quick_merge_sumstats
|
|
37
|
-
from gwaslab.viz_aux_quickfix import _quick_assign_i
|
|
38
|
-
from gwaslab.viz_aux_quickfix import _quick_assign_i_with_rank
|
|
39
|
-
from gwaslab.viz_aux_quickfix import _quick_extract_snp_in_region
|
|
40
|
-
from gwaslab.viz_aux_quickfix import _quick_assign_highlight_hue_pair
|
|
41
|
-
from gwaslab.viz_aux_quickfix import _quick_assign_marker_relative_size
|
|
42
|
-
from gwaslab.viz_aux_quickfix import _cut
|
|
43
|
-
from gwaslab.viz_aux_quickfix import _set_yticklabels
|
|
44
|
-
from gwaslab.viz_aux_quickfix import _jagged_y
|
|
45
|
-
from gwaslab.viz_aux_save_figure import save_figure
|
|
3
|
+
from gwaslab.viz.viz_aux_save_figure import save_figure
|
|
46
4
|
from gwaslab.g_Log import Log
|
|
47
|
-
from gwaslab.
|
|
48
|
-
from gwaslab.util_in_get_sig import getsig
|
|
49
|
-
from gwaslab.util_in_get_sig import annogene
|
|
50
|
-
from gwaslab.bd_common_data import get_chr_to_number
|
|
51
|
-
from gwaslab.bd_common_data import get_number_to_chr
|
|
52
|
-
from gwaslab.bd_common_data import get_recombination_rate
|
|
53
|
-
from gwaslab.bd_common_data import get_gtf
|
|
54
|
-
from gwaslab.util_in_filter_value import _filter_region
|
|
55
|
-
from gwaslab.g_version import _get_version
|
|
56
|
-
from matplotlib.colors import ListedColormap
|
|
57
|
-
from matplotlib.colors import LinearSegmentedColormap
|
|
58
|
-
from matplotlib.colors import to_hex
|
|
59
|
-
from gwaslab.io_process_args import _extract_kwargs
|
|
5
|
+
from gwaslab.io.io_process_args import _extract_kwargs
|
|
60
6
|
|
|
61
7
|
def _plot_effect(to_plot,
|
|
62
8
|
y=None,
|
|
@@ -82,15 +28,19 @@ def _plot_effect(to_plot,
|
|
|
82
28
|
effect_label=None,
|
|
83
29
|
eaf_label=None,
|
|
84
30
|
snpr2_label=None,
|
|
31
|
+
xlim_eaf=None,
|
|
32
|
+
xlim_snpr2 = None,
|
|
85
33
|
log=Log(),
|
|
86
34
|
verbose=True,
|
|
87
35
|
legend_mode=1,
|
|
88
36
|
ncol=2,
|
|
37
|
+
gap=1,
|
|
89
38
|
fontsize=12,
|
|
90
39
|
font_family="Arial",
|
|
91
40
|
size=None,
|
|
92
41
|
hue=None,
|
|
93
42
|
style=None,
|
|
43
|
+
sort_args=None,
|
|
94
44
|
**args):
|
|
95
45
|
|
|
96
46
|
if err_args is None:
|
|
@@ -108,7 +58,8 @@ def _plot_effect(to_plot,
|
|
|
108
58
|
fig_args={"figsize":(8,8),"dpi":300}
|
|
109
59
|
if scatter_args is None:
|
|
110
60
|
scatter_args={"s":20}
|
|
111
|
-
|
|
61
|
+
if sort_args is None:
|
|
62
|
+
sort_args={}
|
|
112
63
|
|
|
113
64
|
legend_titles=[]
|
|
114
65
|
if hue is not None:
|
|
@@ -142,17 +93,24 @@ def _plot_effect(to_plot,
|
|
|
142
93
|
if y_sort is None:
|
|
143
94
|
y_sort = ["CHR","POS","STUDY"]
|
|
144
95
|
|
|
145
|
-
to_plot = to_plot.sort_values(by=y_sort)
|
|
96
|
+
#to_plot = to_plot.sort_values(by=y_sort)
|
|
146
97
|
|
|
147
98
|
if group is None:
|
|
148
|
-
group = ["CHR","POS"]
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
to_plot['_VAR_GROUP'] = to_plot.groupby(group).ngroup() + 1
|
|
99
|
+
group = ["CHR","POS"] + y_sort
|
|
100
|
+
|
|
101
|
+
sort_columns= group + y_sort
|
|
153
102
|
|
|
154
|
-
to_plot
|
|
155
|
-
|
|
103
|
+
to_plot = to_plot.sort_values(by=sort_columns,**sort_args)
|
|
104
|
+
|
|
105
|
+
# calculate cum sum
|
|
106
|
+
cum_sizes = to_plot.groupby(group).size()
|
|
107
|
+
cum_sizes = cum_sizes + gap
|
|
108
|
+
cum_sizes = cum_sizes.cumsum()
|
|
109
|
+
|
|
110
|
+
# create index for y axis
|
|
111
|
+
to_plot['_GROUP_CUMSUM'] = to_plot.set_index(group).index.map(cum_sizes)
|
|
112
|
+
to_plot['_VAR_INDEX'] = to_plot.groupby(group).cumcount()
|
|
113
|
+
to_plot["_VAR_INDEX"]= to_plot['_GROUP_CUMSUM'] - to_plot['_VAR_INDEX']
|
|
156
114
|
|
|
157
115
|
y="_VAR_INDEX"
|
|
158
116
|
|
|
@@ -171,15 +129,15 @@ def _plot_effect(to_plot,
|
|
|
171
129
|
fig,ax1 = plt.subplots(ncols=ncols, **fig_args)
|
|
172
130
|
elif ncols==2:
|
|
173
131
|
if eaf_panel==True:
|
|
174
|
-
fig,axes = plt.subplots(ncols=ncols, dpi=400,sharey=True)
|
|
132
|
+
fig,axes = plt.subplots(ncols=ncols, dpi=400,sharey=True, **fig_args)
|
|
175
133
|
ax1=axes[0]
|
|
176
134
|
ax2=axes[1]
|
|
177
135
|
else:
|
|
178
|
-
fig,axes = plt.subplots(ncols=ncols, dpi=400,sharey=True)
|
|
136
|
+
fig,axes = plt.subplots(ncols=ncols, dpi=400,sharey=True, **fig_args)
|
|
179
137
|
ax1=axes[0]
|
|
180
138
|
ax3=axes[1]
|
|
181
139
|
else:
|
|
182
|
-
fig,axes = plt.subplots(ncols=ncols, dpi=400,sharey=True)
|
|
140
|
+
fig,axes = plt.subplots(ncols=ncols, dpi=400,sharey=True, **fig_args)
|
|
183
141
|
ax1=axes[0]
|
|
184
142
|
ax2=axes[1]
|
|
185
143
|
ax3=axes[2]
|
|
@@ -192,6 +150,7 @@ def _plot_effect(to_plot,
|
|
|
192
150
|
ax1.axvline(x=0,linestyle="dashed",c="grey")
|
|
193
151
|
ax1.set_yticks(to_plot[y], labels = to_plot[y_name], fontsize=fontsize, family=font_family)
|
|
194
152
|
ax1.set_ylabel(ylabel, fontsize=fontsize, family=font_family)
|
|
153
|
+
ax1.set_xlabel(x, fontsize=fontsize, family=font_family)
|
|
195
154
|
|
|
196
155
|
if title is not None:
|
|
197
156
|
ax1.set_title(title,fontsize=fontsize, family=font_family)
|
|
@@ -199,11 +158,14 @@ def _plot_effect(to_plot,
|
|
|
199
158
|
if eaf_panel==True:
|
|
200
159
|
ax2.barh(y=to_plot[y], width=to_plot[eaf], zorder=100, **eaf_args)
|
|
201
160
|
ax2.set_xlabel(eaf, fontsize=fontsize, family=font_family)
|
|
161
|
+
if xlim_eaf is not None:
|
|
162
|
+
ax3.set_xlim(xlim_eaf)
|
|
202
163
|
|
|
203
164
|
if snpvar_panel==True:
|
|
204
165
|
ax3.barh(y=to_plot[y], width=to_plot[snpr2], zorder=100,**snpr2_args)
|
|
205
166
|
ax3.set_xlabel(snpr2, fontsize=fontsize, family=font_family)
|
|
206
|
-
|
|
167
|
+
if xlim_snpr2 is not None:
|
|
168
|
+
ax3.set_xlim(xlim_snpr2)
|
|
207
169
|
#try:
|
|
208
170
|
if legend_mode==1:
|
|
209
171
|
#if ncols==1:
|
|
@@ -273,6 +235,12 @@ def _plot_effect(to_plot,
|
|
|
273
235
|
# for legend_row in legend_rows[:-1]:
|
|
274
236
|
# ax1.add_artist(legend_row)
|
|
275
237
|
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
ax1.tick_params(axis='x',
|
|
241
|
+
labelsize=fontsize,
|
|
242
|
+
labelfontfamily=font_family)
|
|
243
|
+
|
|
276
244
|
if effect_label is not None:
|
|
277
245
|
ax1.set_xlabel(effect_label, fontsize=fontsize, family=font_family)
|
|
278
246
|
ax1.tick_params(axis='x',
|
|
@@ -14,32 +14,40 @@ from scipy import stats
|
|
|
14
14
|
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
|
|
15
15
|
import gc as garbage_collect
|
|
16
16
|
from adjustText import adjust_text
|
|
17
|
+
|
|
18
|
+
from gwaslab.g_Sumstats import Sumstats
|
|
17
19
|
from gwaslab.g_Log import Log
|
|
18
|
-
|
|
19
|
-
from gwaslab.util_in_get_sig import
|
|
20
|
-
from gwaslab.
|
|
21
|
-
|
|
22
|
-
from gwaslab.bd_common_data import
|
|
23
|
-
from gwaslab.bd_common_data import
|
|
24
|
-
from gwaslab.
|
|
25
|
-
from gwaslab.
|
|
20
|
+
|
|
21
|
+
from gwaslab.util.util_in_get_sig import getsig
|
|
22
|
+
from gwaslab.util.util_in_get_sig import annogene
|
|
23
|
+
|
|
24
|
+
from gwaslab.bd.bd_common_data import get_chr_to_number
|
|
25
|
+
from gwaslab.bd.bd_common_data import get_number_to_chr
|
|
26
|
+
from gwaslab.bd.bd_common_data import get_recombination_rate
|
|
27
|
+
from gwaslab.bd.bd_common_data import get_gtf
|
|
28
|
+
|
|
29
|
+
|
|
26
30
|
#from gwaslab.quickfix import _quick_fix_p
|
|
27
31
|
#from gwaslab.quickfix import _quick_fix_mlog10p
|
|
28
32
|
#from gwaslab.quickfix import _quick_fix_chr
|
|
29
33
|
#from gwaslab.quickfix import _quick_fix_pos
|
|
30
34
|
#from gwaslab.quickfix import _quick_fix_eaf
|
|
31
|
-
from gwaslab.
|
|
32
|
-
from gwaslab.viz_aux_quickfix import
|
|
33
|
-
from gwaslab.viz_aux_quickfix import
|
|
34
|
-
from gwaslab.viz_aux_quickfix import
|
|
35
|
-
from gwaslab.viz_aux_quickfix import
|
|
36
|
-
from gwaslab.viz_aux_quickfix import
|
|
37
|
-
from gwaslab.viz_aux_quickfix import
|
|
38
|
-
from gwaslab.
|
|
39
|
-
from gwaslab.
|
|
40
|
-
from gwaslab.
|
|
41
|
-
from gwaslab.
|
|
42
|
-
|
|
35
|
+
from gwaslab.viz.viz_aux_reposition_text import adjust_text_position
|
|
36
|
+
from gwaslab.viz.viz_aux_quickfix import _quick_fix
|
|
37
|
+
from gwaslab.viz.viz_aux_quickfix import _get_largenumber
|
|
38
|
+
from gwaslab.viz.viz_aux_quickfix import _quick_add_tchrpos
|
|
39
|
+
from gwaslab.viz.viz_aux_quickfix import _quick_merge_sumstats
|
|
40
|
+
from gwaslab.viz.viz_aux_quickfix import _quick_assign_i
|
|
41
|
+
from gwaslab.viz.viz_aux_quickfix import _quick_extract_snp_in_region
|
|
42
|
+
from gwaslab.viz.viz_aux_quickfix import _quick_assign_highlight_hue_pair
|
|
43
|
+
from gwaslab.viz.viz_aux_quickfix import _quick_assign_marker_relative_size
|
|
44
|
+
from gwaslab.viz.viz_aux_annotate_plot import annotate_pair
|
|
45
|
+
from gwaslab.viz.viz_aux_save_figure import save_figure
|
|
46
|
+
|
|
47
|
+
from gwaslab.io.io_to_pickle import load_pickle
|
|
48
|
+
from gwaslab.io.io_to_pickle import load_data_from_pickle
|
|
49
|
+
|
|
50
|
+
|
|
43
51
|
|
|
44
52
|
def plot_miami(
|
|
45
53
|
path1,
|
|
@@ -14,30 +14,35 @@ from scipy import stats
|
|
|
14
14
|
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
|
|
15
15
|
import gc as garbage_collect
|
|
16
16
|
from adjustText import adjust_text
|
|
17
|
+
|
|
17
18
|
from gwaslab.g_Log import Log
|
|
18
|
-
from gwaslab.util_in_get_sig import getsig
|
|
19
|
-
from gwaslab.util_in_get_sig import annogene
|
|
20
|
-
from gwaslab.bd_common_data import get_chr_to_number
|
|
21
|
-
from gwaslab.bd_common_data import get_number_to_chr
|
|
22
|
-
from gwaslab.bd_common_data import get_recombination_rate
|
|
23
|
-
from gwaslab.bd_common_data import get_gtf
|
|
24
|
-
from gwaslab.viz_aux_reposition_text import adjust_text_position
|
|
25
|
-
from gwaslab.viz_aux_quickfix import _quick_fix
|
|
26
|
-
from gwaslab.viz_aux_quickfix import _get_largenumber
|
|
27
|
-
from gwaslab.viz_aux_quickfix import _quick_add_tchrpos
|
|
28
|
-
from gwaslab.viz_aux_quickfix import _quick_merge_sumstats
|
|
29
|
-
from gwaslab.viz_aux_quickfix import _quick_assign_i
|
|
30
|
-
from gwaslab.viz_aux_quickfix import _quick_assign_i_with_rank
|
|
31
|
-
from gwaslab.viz_aux_quickfix import _quick_extract_snp_in_region
|
|
32
|
-
from gwaslab.viz_aux_quickfix import _quick_assign_highlight_hue_pair
|
|
33
|
-
from gwaslab.viz_aux_quickfix import _quick_assign_marker_relative_size
|
|
34
|
-
from gwaslab.viz_aux_annotate_plot import annotate_pair
|
|
35
|
-
from gwaslab.io_to_pickle import load_pickle
|
|
36
|
-
from gwaslab.io_to_pickle import load_data_from_pickle
|
|
37
|
-
from gwaslab.g_Sumstats import Sumstats
|
|
38
|
-
from gwaslab.viz_aux_save_figure import save_figure
|
|
39
|
-
from gwaslab.viz_plot_mqqplot import mqqplot
|
|
40
19
|
from gwaslab.g_version import _get_version
|
|
20
|
+
from gwaslab.g_Sumstats import Sumstats
|
|
21
|
+
|
|
22
|
+
from gwaslab.util.util_in_get_sig import getsig
|
|
23
|
+
from gwaslab.util.util_in_get_sig import annogene
|
|
24
|
+
|
|
25
|
+
from gwaslab.bd.bd_common_data import get_chr_to_number
|
|
26
|
+
from gwaslab.bd.bd_common_data import get_number_to_chr
|
|
27
|
+
from gwaslab.bd.bd_common_data import get_recombination_rate
|
|
28
|
+
from gwaslab.bd.bd_common_data import get_gtf
|
|
29
|
+
|
|
30
|
+
from gwaslab.viz.viz_aux_reposition_text import adjust_text_position
|
|
31
|
+
from gwaslab.viz.viz_aux_quickfix import _quick_fix
|
|
32
|
+
from gwaslab.viz.viz_aux_quickfix import _get_largenumber
|
|
33
|
+
from gwaslab.viz.viz_aux_quickfix import _quick_add_tchrpos
|
|
34
|
+
from gwaslab.viz.viz_aux_quickfix import _quick_merge_sumstats
|
|
35
|
+
from gwaslab.viz.viz_aux_quickfix import _quick_assign_i
|
|
36
|
+
from gwaslab.viz.viz_aux_quickfix import _quick_assign_i_with_rank
|
|
37
|
+
from gwaslab.viz.viz_aux_quickfix import _quick_extract_snp_in_region
|
|
38
|
+
from gwaslab.viz.viz_aux_quickfix import _quick_assign_highlight_hue_pair
|
|
39
|
+
from gwaslab.viz.viz_aux_quickfix import _quick_assign_marker_relative_size
|
|
40
|
+
from gwaslab.viz.viz_aux_annotate_plot import annotate_pair
|
|
41
|
+
from gwaslab.viz.viz_aux_save_figure import save_figure
|
|
42
|
+
from gwaslab.viz.viz_plot_mqqplot import mqqplot
|
|
43
|
+
|
|
44
|
+
from gwaslab.io.io_to_pickle import load_pickle
|
|
45
|
+
from gwaslab.io.io_to_pickle import load_data_from_pickle
|
|
41
46
|
|
|
42
47
|
def plot_miami2(
|
|
43
48
|
path1=None,
|
|
@@ -2,6 +2,10 @@ import pandas as pd
|
|
|
2
2
|
import matplotlib.pyplot as plt
|
|
3
3
|
import matplotlib.ticker as ticker
|
|
4
4
|
import matplotlib.patches as patches
|
|
5
|
+
from matplotlib.colors import ListedColormap
|
|
6
|
+
from matplotlib.colors import LinearSegmentedColormap
|
|
7
|
+
from matplotlib.colors import to_hex
|
|
8
|
+
|
|
5
9
|
import seaborn as sns
|
|
6
10
|
import numpy as np
|
|
7
11
|
import scipy as sp
|
|
@@ -19,46 +23,52 @@ from mpl_toolkits.axes_grid1.inset_locator import mark_inset
|
|
|
19
23
|
from matplotlib.ticker import MaxNLocator
|
|
20
24
|
import gc as garbage_collect
|
|
21
25
|
from adjustText import adjust_text
|
|
22
|
-
|
|
23
|
-
from gwaslab.viz_aux_annotate_plot import annotate_single
|
|
24
|
-
from gwaslab.viz_plot_qqplot import _plot_qq
|
|
25
|
-
from gwaslab.hm_harmonize_sumstats import auto_check_vcf_chr_dict
|
|
26
|
-
from gwaslab.viz_plot_regional2 import _plot_regional
|
|
27
|
-
from gwaslab.viz_plot_regional2 import process_vcf
|
|
28
|
-
from gwaslab.io_load_ld import process_ld
|
|
29
|
-
from gwaslab.viz_plot_regional2 import _get_lead_id
|
|
30
|
-
from gwaslab.viz_aux_quickfix import _get_largenumber
|
|
31
|
-
from gwaslab.viz_aux_quickfix import _quick_fix_p_value
|
|
32
|
-
from gwaslab.viz_aux_quickfix import _quick_fix_pos
|
|
33
|
-
from gwaslab.viz_aux_quickfix import _quick_fix_chr
|
|
34
|
-
from gwaslab.viz_aux_quickfix import _quick_fix_eaf
|
|
35
|
-
from gwaslab.viz_aux_quickfix import _quick_fix_mlog10p
|
|
36
|
-
from gwaslab.viz_aux_quickfix import _quick_add_tchrpos
|
|
37
|
-
from gwaslab.viz_aux_quickfix import _quick_merge_sumstats
|
|
38
|
-
from gwaslab.viz_aux_quickfix import _quick_assign_i
|
|
39
|
-
from gwaslab.viz_aux_quickfix import _quick_assign_i_with_rank
|
|
40
|
-
from gwaslab.viz_aux_quickfix import _quick_extract_snp_in_region
|
|
41
|
-
from gwaslab.viz_aux_quickfix import _quick_assign_highlight_hue_pair
|
|
42
|
-
from gwaslab.viz_aux_quickfix import _quick_assign_marker_relative_size
|
|
43
|
-
from gwaslab.viz_aux_quickfix import _cut
|
|
44
|
-
from gwaslab.viz_aux_quickfix import _set_yticklabels
|
|
45
|
-
from gwaslab.viz_aux_quickfix import _jagged_y
|
|
46
|
-
from gwaslab.io_process_args import _update_args
|
|
47
|
-
from gwaslab.io_process_args import _update_arg
|
|
48
|
-
from gwaslab.viz_aux_save_figure import save_figure
|
|
26
|
+
|
|
49
27
|
from gwaslab.g_Log import Log
|
|
50
|
-
from gwaslab.util_in_calculate_gc import lambdaGC
|
|
51
|
-
from gwaslab.util_in_get_sig import getsig
|
|
52
|
-
from gwaslab.util_in_get_sig import annogene
|
|
53
|
-
from gwaslab.bd_common_data import get_chr_to_number
|
|
54
|
-
from gwaslab.bd_common_data import get_number_to_chr
|
|
55
|
-
from gwaslab.bd_common_data import get_recombination_rate
|
|
56
|
-
from gwaslab.bd_common_data import get_gtf
|
|
57
|
-
from gwaslab.util_in_filter_value import _filter_region
|
|
58
28
|
from gwaslab.g_version import _get_version
|
|
59
|
-
|
|
60
|
-
from
|
|
61
|
-
|
|
29
|
+
|
|
30
|
+
from gwaslab.hm.hm_harmonize_sumstats import auto_check_vcf_chr_dict
|
|
31
|
+
|
|
32
|
+
from gwaslab.viz.viz_aux_reposition_text import adjust_text_position
|
|
33
|
+
from gwaslab.viz.viz_aux_annotate_plot import annotate_single
|
|
34
|
+
from gwaslab.viz.viz_plot_qqplot import _plot_qq
|
|
35
|
+
from gwaslab.viz.viz_plot_regional2 import _plot_regional
|
|
36
|
+
from gwaslab.viz.viz_plot_regional2 import process_vcf
|
|
37
|
+
from gwaslab.viz.viz_plot_regional2 import _get_lead_id
|
|
38
|
+
from gwaslab.viz.viz_aux_quickfix import _get_largenumber
|
|
39
|
+
from gwaslab.viz.viz_aux_quickfix import _quick_fix_p_value
|
|
40
|
+
from gwaslab.viz.viz_aux_quickfix import _quick_fix_pos
|
|
41
|
+
from gwaslab.viz.viz_aux_quickfix import _quick_fix_chr
|
|
42
|
+
from gwaslab.viz.viz_aux_quickfix import _quick_fix_eaf
|
|
43
|
+
from gwaslab.viz.viz_aux_quickfix import _quick_fix_mlog10p
|
|
44
|
+
from gwaslab.viz.viz_aux_quickfix import _quick_add_tchrpos
|
|
45
|
+
from gwaslab.viz.viz_aux_quickfix import _quick_merge_sumstats
|
|
46
|
+
from gwaslab.viz.viz_aux_quickfix import _quick_assign_i
|
|
47
|
+
from gwaslab.viz.viz_aux_quickfix import _quick_assign_i_with_rank
|
|
48
|
+
from gwaslab.viz.viz_aux_quickfix import _quick_extract_snp_in_region
|
|
49
|
+
from gwaslab.viz.viz_aux_quickfix import _quick_assign_highlight_hue_pair
|
|
50
|
+
from gwaslab.viz.viz_aux_quickfix import _quick_assign_marker_relative_size
|
|
51
|
+
from gwaslab.viz.viz_aux_quickfix import _cut
|
|
52
|
+
from gwaslab.viz.viz_aux_quickfix import _set_yticklabels
|
|
53
|
+
from gwaslab.viz.viz_aux_quickfix import _jagged_y
|
|
54
|
+
from gwaslab.viz.viz_aux_save_figure import save_figure
|
|
55
|
+
|
|
56
|
+
from gwaslab.io.io_load_ld import process_ld
|
|
57
|
+
from gwaslab.io.io_process_args import _update_args
|
|
58
|
+
from gwaslab.io.io_process_args import _update_arg
|
|
59
|
+
|
|
60
|
+
from gwaslab.util.util_in_filter_value import _filter_region
|
|
61
|
+
from gwaslab.util.util_in_calculate_gc import lambdaGC
|
|
62
|
+
from gwaslab.util.util_in_get_sig import getsig
|
|
63
|
+
from gwaslab.util.util_in_get_sig import annogene
|
|
64
|
+
|
|
65
|
+
from gwaslab.bd.bd_common_data import get_chr_to_number
|
|
66
|
+
from gwaslab.bd.bd_common_data import get_number_to_chr
|
|
67
|
+
from gwaslab.bd.bd_common_data import get_recombination_rate
|
|
68
|
+
from gwaslab.bd.bd_common_data import get_gtf
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
62
72
|
# 20230202 ######################################################################################################
|
|
63
73
|
|
|
64
74
|
def mqqplot(insumstats,
|
|
@@ -90,6 +100,8 @@ def mqqplot(insumstats,
|
|
|
90
100
|
qq_scatter_args=None,
|
|
91
101
|
qqscatterargs=None,
|
|
92
102
|
qq_line_color = "grey",
|
|
103
|
+
qq_xlabels = None,
|
|
104
|
+
qq_xlim = None,
|
|
93
105
|
# region
|
|
94
106
|
region = None,
|
|
95
107
|
region_title=None,
|
|
@@ -194,6 +206,8 @@ def mqqplot(insumstats,
|
|
|
194
206
|
highlight_color="#CB132D",
|
|
195
207
|
highlight_windowkb = 500,
|
|
196
208
|
highlight_anno_args = None,
|
|
209
|
+
highlight_lim = None,
|
|
210
|
+
highlight_lim_mode = "absolute",
|
|
197
211
|
pinpoint= None,
|
|
198
212
|
pinpoint_color ="red",
|
|
199
213
|
stratified=False,
|
|
@@ -521,6 +535,8 @@ def mqqplot(insumstats,
|
|
|
521
535
|
highlight=highlight,
|
|
522
536
|
highlight_chrpos=highlight_chrpos,
|
|
523
537
|
highlight_windowkb=highlight_windowkb,
|
|
538
|
+
highlight_lim = highlight_lim,
|
|
539
|
+
highlight_lim_mode = highlight_lim_mode,
|
|
524
540
|
snpid=snpid,
|
|
525
541
|
chrom=chrom,
|
|
526
542
|
pos=pos)
|
|
@@ -1086,6 +1102,8 @@ def mqqplot(insumstats,
|
|
|
1086
1102
|
linewidth=sc_linewidth,
|
|
1087
1103
|
ytick3 = ytick3,
|
|
1088
1104
|
ylabels = ylabels,
|
|
1105
|
+
xlabels = qq_xlabels,
|
|
1106
|
+
xlim = qq_xlim,
|
|
1089
1107
|
ylabels_converted = ylabels_converted,
|
|
1090
1108
|
verbose=verbose,
|
|
1091
1109
|
qq_scatter_args=qq_scatter_args,
|
|
@@ -1325,19 +1343,38 @@ def _process_p_value(sumstats, mode,p, mlog10p, scaled, log, verbose ):
|
|
|
1325
1343
|
|
|
1326
1344
|
return sumstats
|
|
1327
1345
|
|
|
1328
|
-
def _process_highlight(sumstats, highlight, highlight_chrpos, highlight_windowkb, snpid, chrom, pos):
|
|
1346
|
+
def _process_highlight(sumstats, highlight, highlight_chrpos, highlight_windowkb, highlight_lim, highlight_lim_mode, snpid, chrom, pos):
|
|
1329
1347
|
if pd.api.types.is_list_like(highlight[0]):
|
|
1330
1348
|
if highlight_chrpos == False:
|
|
1331
1349
|
# highlight for multiple sets
|
|
1332
1350
|
for i, highlight_set in enumerate(highlight):
|
|
1333
1351
|
to_highlight = sumstats.loc[sumstats[snpid].isin(highlight_set),:]
|
|
1334
1352
|
#assign colors: 0 is hightlight color
|
|
1335
|
-
|
|
1353
|
+
#assign colors: i is highlight color
|
|
1354
|
+
for j, (index, row) in enumerate(to_highlight.iterrows()):
|
|
1336
1355
|
target_chr = int(row[chrom])
|
|
1337
1356
|
target_pos = int(row[pos])
|
|
1338
1357
|
right_chr=sumstats[chrom]==target_chr
|
|
1339
|
-
|
|
1340
|
-
|
|
1358
|
+
# Check if highlight_lim is provided for this group and SNP
|
|
1359
|
+
if (highlight_lim is not None and
|
|
1360
|
+
i < len(highlight_lim) and
|
|
1361
|
+
j < len(highlight_lim[i]) and
|
|
1362
|
+
highlight_lim[i][j] is not None):
|
|
1363
|
+
# Use custom limits for this SNP
|
|
1364
|
+
if highlight_lim_mode == "absolute":
|
|
1365
|
+
# Absolute positions: (start_pos, end_pos)
|
|
1366
|
+
start_pos, end_pos = highlight_lim[i][j]
|
|
1367
|
+
up_pos = sumstats[pos] >= start_pos
|
|
1368
|
+
low_pos = sumstats[pos] <= end_pos
|
|
1369
|
+
else:
|
|
1370
|
+
# Offset mode: (lower_kb, upper_kb) relative to SNP position
|
|
1371
|
+
lower_kb, upper_kb = highlight_lim[i][j]
|
|
1372
|
+
up_pos = sumstats[pos] > target_pos + lower_kb * 1000
|
|
1373
|
+
low_pos = sumstats[pos] < target_pos + upper_kb * 1000
|
|
1374
|
+
else:
|
|
1375
|
+
# Use default highlight_windowkb
|
|
1376
|
+
up_pos = sumstats[pos] > target_pos - highlight_windowkb * 1000
|
|
1377
|
+
low_pos = sumstats[pos] < target_pos + highlight_windowkb * 1000
|
|
1341
1378
|
sumstats.loc[right_chr&up_pos&low_pos,"HUE"]=i
|
|
1342
1379
|
else:
|
|
1343
1380
|
for i, highlight_chrpos_tuple in enumerate(highlight):
|
|
@@ -1361,13 +1398,30 @@ def _process_highlight(sumstats, highlight, highlight_chrpos, highlight_windowkb
|
|
|
1361
1398
|
else:
|
|
1362
1399
|
# highlight for one set
|
|
1363
1400
|
to_highlight = sumstats.loc[sumstats[snpid].isin(highlight),:]
|
|
1364
|
-
#assign colors: 0 is
|
|
1365
|
-
for index,row in to_highlight.iterrows():
|
|
1401
|
+
#assign colors: 0 is highlight color
|
|
1402
|
+
for j, (index, row) in enumerate(to_highlight.iterrows()):
|
|
1366
1403
|
target_chr = int(row[chrom])
|
|
1367
1404
|
target_pos = int(row[pos])
|
|
1368
1405
|
right_chr=sumstats[chrom]==target_chr
|
|
1369
|
-
|
|
1370
|
-
|
|
1406
|
+
# Check if highlight_lim is provided for this SNP
|
|
1407
|
+
if (highlight_lim is not None and
|
|
1408
|
+
j < len(highlight_lim) and
|
|
1409
|
+
highlight_lim[j] is not None):
|
|
1410
|
+
# Use custom limits for this SNP
|
|
1411
|
+
if highlight_lim_mode == "absolute":
|
|
1412
|
+
# Absolute positions: (start_pos, end_pos)
|
|
1413
|
+
start_pos, end_pos = highlight_lim[j]
|
|
1414
|
+
up_pos = sumstats[pos] >= start_pos
|
|
1415
|
+
low_pos = sumstats[pos] <= end_pos
|
|
1416
|
+
else:
|
|
1417
|
+
# Offset mode: (lower_kb, upper_kb) relative to SNP position
|
|
1418
|
+
lower_kb, upper_kb = highlight_lim[j]
|
|
1419
|
+
up_pos = sumstats[pos] > target_pos + lower_kb * 1000
|
|
1420
|
+
low_pos = sumstats[pos] < target_pos + upper_kb * 1000
|
|
1421
|
+
else:
|
|
1422
|
+
# Use default highlight_windowkb
|
|
1423
|
+
up_pos = sumstats[pos] > target_pos - highlight_windowkb * 1000
|
|
1424
|
+
low_pos = sumstats[pos] < target_pos + highlight_windowkb * 1000
|
|
1371
1425
|
sumstats.loc[right_chr&up_pos&low_pos,"HUE"]=0
|
|
1372
1426
|
return sumstats
|
|
1373
1427
|
|
|
@@ -3,24 +3,27 @@ import matplotlib.pyplot as plt
|
|
|
3
3
|
import seaborn as sns
|
|
4
4
|
import numpy as np
|
|
5
5
|
import scipy as sp
|
|
6
|
-
from gwaslab.viz_aux_quickfix import _quick_assign_i_with_rank
|
|
7
|
-
from gwaslab.viz_aux_quickfix import _get_largenumber
|
|
8
|
-
from gwaslab.viz_aux_quickfix import _quick_fix_p_value
|
|
9
|
-
from gwaslab.viz_aux_quickfix import _quick_fix_pos
|
|
10
|
-
from gwaslab.viz_aux_quickfix import _quick_fix_chr
|
|
11
|
-
from gwaslab.viz_aux_quickfix import _quick_fix_eaf
|
|
12
|
-
from gwaslab.viz_aux_quickfix import _quick_fix_mlog10p
|
|
13
|
-
from gwaslab.viz_aux_quickfix import _dropna_in_cols
|
|
14
|
-
from gwaslab.viz_plot_mqqplot import _process_p_value
|
|
15
|
-
from gwaslab.viz_plot_mqqplot import _configure_fig_save_kwargs
|
|
16
|
-
from gwaslab.viz_plot_mqqplot import mqqplot
|
|
17
|
-
from gwaslab.viz_aux_save_figure import save_figure
|
|
18
|
-
from gwaslab.g_Log import Log
|
|
19
6
|
import copy
|
|
20
|
-
from gwaslab.
|
|
21
|
-
from gwaslab.bd_common_data import get_number_to_chr
|
|
7
|
+
from gwaslab.g_Log import Log
|
|
22
8
|
from gwaslab.g_version import _get_version
|
|
23
9
|
|
|
10
|
+
from gwaslab.viz.viz_aux_quickfix import _quick_assign_i_with_rank
|
|
11
|
+
from gwaslab.viz.viz_aux_quickfix import _get_largenumber
|
|
12
|
+
from gwaslab.viz.viz_aux_quickfix import _quick_fix_p_value
|
|
13
|
+
from gwaslab.viz.viz_aux_quickfix import _quick_fix_pos
|
|
14
|
+
from gwaslab.viz.viz_aux_quickfix import _quick_fix_chr
|
|
15
|
+
from gwaslab.viz.viz_aux_quickfix import _quick_fix_eaf
|
|
16
|
+
from gwaslab.viz.viz_aux_quickfix import _quick_fix_mlog10p
|
|
17
|
+
from gwaslab.viz.viz_aux_quickfix import _dropna_in_cols
|
|
18
|
+
from gwaslab.viz.viz_plot_mqqplot import _process_p_value
|
|
19
|
+
from gwaslab.viz.viz_plot_mqqplot import _configure_fig_save_kwargs
|
|
20
|
+
from gwaslab.viz.viz_plot_mqqplot import mqqplot
|
|
21
|
+
from gwaslab.viz.viz_aux_save_figure import save_figure
|
|
22
|
+
|
|
23
|
+
from gwaslab.bd.bd_common_data import get_chr_to_number
|
|
24
|
+
from gwaslab.bd.bd_common_data import get_number_to_chr
|
|
25
|
+
|
|
26
|
+
|
|
24
27
|
def _gwheatmap(
|
|
25
28
|
insumstats,
|
|
26
29
|
chrom="CHR",
|
|
@@ -4,9 +4,11 @@ import seaborn as sns
|
|
|
4
4
|
import numpy as np
|
|
5
5
|
import scipy as sp
|
|
6
6
|
from math import ceil
|
|
7
|
-
from gwaslab.viz_aux_quickfix import _set_yticklabels
|
|
8
7
|
from gwaslab.g_Log import Log
|
|
9
|
-
|
|
8
|
+
|
|
9
|
+
from gwaslab.viz.viz_aux_quickfix import _set_yticklabels
|
|
10
|
+
from gwaslab.util.util_in_calculate_gc import lambdaGC
|
|
11
|
+
|
|
10
12
|
# qq plot module for mqqplot
|
|
11
13
|
def _plot_qq(
|
|
12
14
|
sumstats,
|
|
@@ -37,6 +39,8 @@ def _plot_qq(
|
|
|
37
39
|
linewidth,
|
|
38
40
|
ytick3,
|
|
39
41
|
ylabels,
|
|
42
|
+
xlabels,
|
|
43
|
+
xlim,
|
|
40
44
|
ylabels_converted,
|
|
41
45
|
qq_scatter_args,
|
|
42
46
|
expected_min_mlog10p,
|
|
@@ -153,32 +157,12 @@ def _plot_qq(
|
|
|
153
157
|
log=log,
|
|
154
158
|
verbose=verbose
|
|
155
159
|
)
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
# step=2
|
|
163
|
-
# if ((maxticker-cut)/cutfactor + cut) > cut:
|
|
164
|
-
# if ystep == 0:
|
|
165
|
-
# if (cut - skip ) // step > 10:
|
|
166
|
-
# step = (cut - skip ) // 10
|
|
167
|
-
# else:
|
|
168
|
-
# step = ystep
|
|
169
|
-
#
|
|
170
|
-
# ax2.set_yticks([x for x in range(skip,cut-step,step)]+[cut]+[(maxticker-cut)/cutfactor + cut])
|
|
171
|
-
# ax2.set_yticklabels([x for x in range(skip,cut-step,step)]+[cut]+[maxticker],fontsize=fontsize,family=font_family)
|
|
172
|
-
# else:
|
|
173
|
-
# if ystep == 0:
|
|
174
|
-
# if (cut - skip ) // step > 10:
|
|
175
|
-
# step = (cut - skip ) // 10
|
|
176
|
-
# else:
|
|
177
|
-
# step = ystep
|
|
178
|
-
#
|
|
179
|
-
# ax2.set_yticks([x for x in range(skip,cut-step,step)]+[cut])
|
|
180
|
-
# ax2.set_yticklabels([x for x in range(skip,cut-step,step)]+[cut],fontsize=fontsize,family=font_family)
|
|
181
|
-
# ax2.set_ylim(bottom = skip)
|
|
160
|
+
if xlim is not None:
|
|
161
|
+
ax2.set_xlim(xlim)
|
|
162
|
+
|
|
163
|
+
if xlabels is not None:
|
|
164
|
+
ax2.set_xticks(xlabels)
|
|
165
|
+
ax2.set_xticklabels(xlabels,fontsize=fontsize,family=font_family)
|
|
182
166
|
|
|
183
167
|
ax2.tick_params(axis='both', which='both', labelsize=fontsize,labelfontfamily=font_family)
|
|
184
168
|
#
|
|
@@ -2,6 +2,11 @@ import pandas as pd
|
|
|
2
2
|
import matplotlib.pyplot as plt
|
|
3
3
|
import matplotlib.ticker as ticker
|
|
4
4
|
import matplotlib.patches as patches
|
|
5
|
+
from matplotlib.colors import ListedColormap
|
|
6
|
+
from matplotlib.colors import LinearSegmentedColormap
|
|
7
|
+
import matplotlib.colors
|
|
8
|
+
from matplotlib.colors import Normalize
|
|
9
|
+
from matplotlib.patches import Rectangle
|
|
5
10
|
import seaborn as sns
|
|
6
11
|
import numpy as np
|
|
7
12
|
import copy
|
|
@@ -17,16 +22,13 @@ from mpl_toolkits.axes_grid1.inset_locator import inset_axes
|
|
|
17
22
|
from mpl_toolkits.axes_grid1.inset_locator import mark_inset
|
|
18
23
|
from adjustText import adjust_text
|
|
19
24
|
from gtfparse import read_gtf
|
|
25
|
+
|
|
20
26
|
from gwaslab.g_Log import Log
|
|
21
|
-
from gwaslab.bd_common_data import get_chr_to_number
|
|
22
|
-
from gwaslab.bd_common_data import get_number_to_chr
|
|
23
|
-
from gwaslab.bd_common_data import get_recombination_rate
|
|
24
|
-
from gwaslab.bd_common_data import get_gtf
|
|
25
|
-
|
|
26
|
-
from matplotlib.colors import LinearSegmentedColormap
|
|
27
|
-
import matplotlib.colors
|
|
28
|
-
from matplotlib.colors import Normalize
|
|
29
|
-
from matplotlib.patches import Rectangle
|
|
27
|
+
from gwaslab.bd.bd_common_data import get_chr_to_number
|
|
28
|
+
from gwaslab.bd.bd_common_data import get_number_to_chr
|
|
29
|
+
from gwaslab.bd.bd_common_data import get_recombination_rate
|
|
30
|
+
from gwaslab.bd.bd_common_data import get_gtf
|
|
31
|
+
|
|
30
32
|
|
|
31
33
|
def _plot_regional(
|
|
32
34
|
sumstats,
|
|
@@ -16,11 +16,12 @@ from mpl_toolkits.axes_grid1.inset_locator import inset_axes
|
|
|
16
16
|
from mpl_toolkits.axes_grid1.inset_locator import mark_inset
|
|
17
17
|
from adjustText import adjust_text
|
|
18
18
|
from gtfparse import read_gtf
|
|
19
|
+
|
|
19
20
|
from gwaslab.g_Log import Log
|
|
20
|
-
from gwaslab.bd_common_data import get_chr_to_number
|
|
21
|
-
from gwaslab.bd_common_data import get_number_to_chr
|
|
22
|
-
from gwaslab.bd_common_data import get_recombination_rate
|
|
23
|
-
from gwaslab.bd_common_data import get_gtf
|
|
21
|
+
from gwaslab.bd.bd_common_data import get_chr_to_number
|
|
22
|
+
from gwaslab.bd.bd_common_data import get_number_to_chr
|
|
23
|
+
from gwaslab.bd.bd_common_data import get_recombination_rate
|
|
24
|
+
from gwaslab.bd.bd_common_data import get_gtf
|
|
24
25
|
|
|
25
26
|
def _plot_regional(
|
|
26
27
|
sumstats,
|