gwaslab 3.4.49__py3-none-any.whl → 3.5.1__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/bd_get_hapmap3.py +3 -1
- gwaslab/g_Sumstats.py +22 -10
- gwaslab/g_version.py +2 -2
- gwaslab/io_process_args.py +23 -0
- gwaslab/qc_fix_sumstats.py +9 -5
- gwaslab/util_in_get_sig.py +18 -2
- gwaslab/vis_plot_credible sets.py +0 -0
- gwaslab/viz_aux_annotate_plot.py +83 -242
- gwaslab/viz_aux_property.py +2 -0
- gwaslab/viz_aux_quickfix.py +9 -2
- gwaslab/viz_aux_save_figure.py +2 -1
- gwaslab/viz_plot_compare_effect.py +870 -523
- gwaslab/viz_plot_mqqplot.py +74 -21
- gwaslab/viz_plot_phe_heatmap.py +260 -0
- gwaslab/viz_plot_stackedregional.py +1 -1
- {gwaslab-3.4.49.dist-info → gwaslab-3.5.1.dist-info}/METADATA +3 -3
- {gwaslab-3.4.49.dist-info → gwaslab-3.5.1.dist-info}/RECORD +21 -17
- {gwaslab-3.4.49.dist-info → gwaslab-3.5.1.dist-info}/WHEEL +1 -1
- {gwaslab-3.4.49.dist-info → gwaslab-3.5.1.dist-info}/LICENSE +0 -0
- {gwaslab-3.4.49.dist-info → gwaslab-3.5.1.dist-info}/LICENSE_before_v3.4.39 +0 -0
- {gwaslab-3.4.49.dist-info → gwaslab-3.5.1.dist-info}/top_level.txt +0 -0
gwaslab/viz_plot_mqqplot.py
CHANGED
|
@@ -139,7 +139,8 @@ def mqqplot(insumstats,
|
|
|
139
139
|
anno_gtf_path=None,
|
|
140
140
|
anno_adjust=False,
|
|
141
141
|
anno_max_iter=100,
|
|
142
|
-
|
|
142
|
+
arrow_kwargs=None,
|
|
143
|
+
arm_offset=None,
|
|
143
144
|
arm_scale=1,
|
|
144
145
|
anno_height=1,
|
|
145
146
|
arm_scale_d=None,
|
|
@@ -243,7 +244,8 @@ def mqqplot(insumstats,
|
|
|
243
244
|
anno_args=dict()
|
|
244
245
|
if colors is None:
|
|
245
246
|
colors=["#597FBD","#74BAD3"]
|
|
246
|
-
|
|
247
|
+
if arrow_kwargs is None:
|
|
248
|
+
arrow_kwargs=dict()
|
|
247
249
|
if region is not None:
|
|
248
250
|
if marker_size == (5,20):
|
|
249
251
|
marker_size=(45,65)
|
|
@@ -291,7 +293,7 @@ def mqqplot(insumstats,
|
|
|
291
293
|
if maf_bin_colors is None:
|
|
292
294
|
maf_bin_colors = ["#f0ad4e","#5cb85c", "#5bc0de","#000042"]
|
|
293
295
|
if save_args is None:
|
|
294
|
-
save_args = {"dpi":
|
|
296
|
+
save_args = {"dpi":400,"facecolor":"white"}
|
|
295
297
|
if highlight is None:
|
|
296
298
|
highlight = list()
|
|
297
299
|
if highlight_anno_args is None:
|
|
@@ -329,6 +331,20 @@ def mqqplot(insumstats,
|
|
|
329
331
|
fig_args["dpi"]=72
|
|
330
332
|
scatter_args["rasterized"]=True
|
|
331
333
|
qq_scatter_args["rasterized"]=True
|
|
334
|
+
else:
|
|
335
|
+
fig_args["dpi"] = save_args["dpi"]
|
|
336
|
+
|
|
337
|
+
# configure dpi if saving the plot
|
|
338
|
+
fig_args, scatter_args, qq_scatter_args, save_args = _configure_fig_save_kwargs(save = save,
|
|
339
|
+
fig_args = fig_args,
|
|
340
|
+
scatter_args = scatter_args,
|
|
341
|
+
qq_scatter_args = qq_scatter_args,
|
|
342
|
+
save_args = save_args)
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
if len(anno_d) > 0 and arm_offset is None:
|
|
346
|
+
# in pixels
|
|
347
|
+
arm_offset = fig_args["dpi"] * repel_force * fig_args["figsize"][0]*0.5
|
|
332
348
|
|
|
333
349
|
log.write("Start to create MQQ plot...{}:".format(_get_version()),verbose=verbose)
|
|
334
350
|
log.write(" -Genomic coordinates version: {}...".format(build),verbose=verbose)
|
|
@@ -401,7 +417,7 @@ def mqqplot(insumstats,
|
|
|
401
417
|
if mode=="b":
|
|
402
418
|
sig_level=1,
|
|
403
419
|
sig_line=False,
|
|
404
|
-
windowsizekb = 100000000
|
|
420
|
+
#windowsizekb = 100000000
|
|
405
421
|
mode="mb"
|
|
406
422
|
scatter_args={"marker":"s"}
|
|
407
423
|
marker_size= (marker_size[1],marker_size[1])
|
|
@@ -522,8 +538,12 @@ def mqqplot(insumstats,
|
|
|
522
538
|
pos=pos,
|
|
523
539
|
verbose=verbose,
|
|
524
540
|
log=log)
|
|
541
|
+
|
|
542
|
+
lines_to_plot = pd.Series(lines_to_plot.to_list() + [bmean, bmedian])
|
|
543
|
+
|
|
525
544
|
else:
|
|
526
545
|
bmean, bmedian=0,0
|
|
546
|
+
|
|
527
547
|
# P value conversion #####################################################################################################
|
|
528
548
|
|
|
529
549
|
# add raw_P and scaled_P
|
|
@@ -956,7 +976,7 @@ def mqqplot(insumstats,
|
|
|
956
976
|
ax1.set_title(mtitle,fontsize=title_fontsize,family=font_family)
|
|
957
977
|
log.write("Finished processing figure arts.",verbose=verbose)
|
|
958
978
|
|
|
959
|
-
|
|
979
|
+
## Add annotation arrows and texts
|
|
960
980
|
log.write("Start to annotate variants...",verbose=verbose)
|
|
961
981
|
ax1 = annotate_single(
|
|
962
982
|
sumstats=sumstats,
|
|
@@ -984,6 +1004,7 @@ def mqqplot(insumstats,
|
|
|
984
1004
|
region_anno_bbox_args=region_anno_bbox_args,
|
|
985
1005
|
skip=skip,
|
|
986
1006
|
anno_height=anno_height,
|
|
1007
|
+
arrow_kwargs=arrow_kwargs,
|
|
987
1008
|
snpid=snpid,
|
|
988
1009
|
chrom=chrom,
|
|
989
1010
|
pos=pos,
|
|
@@ -1055,7 +1076,8 @@ def mqqplot(insumstats,
|
|
|
1055
1076
|
fig.suptitle(title , fontsize = title_fontsize ,x=0.5, y=1.05)
|
|
1056
1077
|
else:
|
|
1057
1078
|
fig.suptitle(title , fontsize = title_fontsize, x=0.5,y=1)
|
|
1058
|
-
|
|
1079
|
+
## Add annotation arrows and texts
|
|
1080
|
+
|
|
1059
1081
|
# Saving figure
|
|
1060
1082
|
save_figure(fig = fig, save = save, keyword=mode, save_args=save_args, log = log, verbose=verbose)
|
|
1061
1083
|
|
|
@@ -1069,7 +1091,31 @@ def mqqplot(insumstats,
|
|
|
1069
1091
|
|
|
1070
1092
|
##############################################################################################################################################################################
|
|
1071
1093
|
|
|
1094
|
+
def _configure_fig_save_kwargs(save=None,
|
|
1095
|
+
fig_args=None,
|
|
1096
|
+
scatter_args=None,
|
|
1097
|
+
qq_scatter_args=None,
|
|
1098
|
+
save_args=None):
|
|
1099
|
+
if fig_args is None:
|
|
1100
|
+
fig_args = dict()
|
|
1101
|
+
if scatter_args is None:
|
|
1102
|
+
scatter_args = dict()
|
|
1103
|
+
if qq_scatter_args is None:
|
|
1104
|
+
qq_scatter_args = dict()
|
|
1105
|
+
if save_args is None:
|
|
1106
|
+
save_args = dict()
|
|
1072
1107
|
|
|
1108
|
+
if save is not None:
|
|
1109
|
+
if type(save) is not bool:
|
|
1110
|
+
if len(save)>3:
|
|
1111
|
+
if save[-3:]=="pdf" or save[-3:]=="svg":
|
|
1112
|
+
# to save as vectorized plot
|
|
1113
|
+
fig_args["dpi"]=72
|
|
1114
|
+
scatter_args["rasterized"]=True
|
|
1115
|
+
qq_scatter_args["rasterized"]=True
|
|
1116
|
+
else:
|
|
1117
|
+
fig_args["dpi"] = save_args["dpi"]
|
|
1118
|
+
return fig_args, scatter_args, qq_scatter_args, save_args
|
|
1073
1119
|
|
|
1074
1120
|
|
|
1075
1121
|
def _add_pad_to_x_axis(ax1, xpad, xpadl, xpadr, sumstats, pos, chrpad, xtight, log, verbose):
|
|
@@ -1104,12 +1150,6 @@ def _add_pad_to_x_axis(ax1, xpad, xpadl, xpadr, sumstats, pos, chrpad, xtight, l
|
|
|
1104
1150
|
return ax1
|
|
1105
1151
|
|
|
1106
1152
|
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
1153
|
##############################################################################################################################################################################
|
|
1114
1154
|
def _configure_cols_to_use(insumstats, snpid, chrom, pos, ea, nea, eaf, p, mlog10p,scaled, mode,stratified,anno, anno_set, anno_alias,_chrom_df_for_i,highlight ,pinpoint,density_color):
|
|
1115
1155
|
usecols=[]
|
|
@@ -1287,9 +1327,10 @@ def _process_density(sumstats, mode, bwindowsizekb, chrom, pos, verbose, log):
|
|
|
1287
1327
|
else:
|
|
1288
1328
|
break
|
|
1289
1329
|
df = pd.DataFrame(stack,columns=["SNPID","TCHR+POS","DENSITY"])
|
|
1290
|
-
sumstats["DENSITY"] = df["DENSITY"].values
|
|
1291
|
-
|
|
1292
|
-
|
|
1330
|
+
sumstats["DENSITY"] = df["DENSITY"].astype("Float64").values
|
|
1331
|
+
|
|
1332
|
+
bmean=sumstats.drop_duplicates(subset="SNPID")["DENSITY"].mean()
|
|
1333
|
+
bmedian=sumstats.drop_duplicates(subset="SNPID")["DENSITY"].median()
|
|
1293
1334
|
elif "b" in mode and "DENSITY" in sumstats.columns:
|
|
1294
1335
|
bmean=sumstats["DENSITY"].mean()
|
|
1295
1336
|
bmedian=sumstats["DENSITY"].median()
|
|
@@ -1305,6 +1346,7 @@ def _process_line(ax1, sig_line, suggestive_sig_line, additional_line, lines_to_
|
|
|
1305
1346
|
linestyle="--",
|
|
1306
1347
|
color=sig_line_color,
|
|
1307
1348
|
zorder=1)
|
|
1349
|
+
|
|
1308
1350
|
if suggestive_sig_line is True:
|
|
1309
1351
|
suggestive_sig_line = ax1.axhline(y=lines_to_plot[1],
|
|
1310
1352
|
linewidth = sc_linewidth,
|
|
@@ -1312,15 +1354,20 @@ def _process_line(ax1, sig_line, suggestive_sig_line, additional_line, lines_to_
|
|
|
1312
1354
|
color=suggestive_sig_line_color,
|
|
1313
1355
|
zorder=1)
|
|
1314
1356
|
if additional_line is not None:
|
|
1315
|
-
for index, level in enumerate(lines_to_plot[2:].values):
|
|
1357
|
+
for index, level in enumerate(lines_to_plot[2:2+len(additional_line)].values):
|
|
1316
1358
|
ax1.axhline(y=level,
|
|
1317
1359
|
linewidth = sc_linewidth,
|
|
1318
1360
|
linestyle="--",
|
|
1319
1361
|
color=additional_line_color[index%len(additional_line_color)],
|
|
1320
1362
|
zorder=1)
|
|
1321
|
-
if "b" in mode:
|
|
1363
|
+
if "b" in mode:
|
|
1364
|
+
bmean = lines_to_plot.iat[-2]
|
|
1365
|
+
bmedian = lines_to_plot.iat[-1]
|
|
1322
1366
|
# for brisbane plot, add median and mean line
|
|
1367
|
+
log.write(" -Plotting horizontal line ( mean DENISTY): y = {}".format(bmean),verbose=verbose)
|
|
1323
1368
|
meanline = ax1.axhline(y=bmean, linewidth = sc_linewidth,linestyle="-",color=sig_line_color,zorder=1000)
|
|
1369
|
+
|
|
1370
|
+
log.write(" -Plotting horizontal line ( median DENISTY): y = {}".format(bmedian),verbose=verbose)
|
|
1324
1371
|
medianline = ax1.axhline(y=bmedian, linewidth = sc_linewidth,linestyle="--",color=sig_line_color,zorder=1000)
|
|
1325
1372
|
return ax1
|
|
1326
1373
|
|
|
@@ -1441,10 +1488,16 @@ def _process_layout(mode, figax, fig_args, mqqratio, region_hspace):
|
|
|
1441
1488
|
ax2 = None
|
|
1442
1489
|
plt.subplots_adjust(hspace=region_hspace)
|
|
1443
1490
|
elif mode =="b" :
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1491
|
+
if figax is not None:
|
|
1492
|
+
fig = figax[0]
|
|
1493
|
+
ax1 = figax[1]
|
|
1494
|
+
ax3 = None
|
|
1495
|
+
ax2 = None
|
|
1496
|
+
else:
|
|
1497
|
+
fig_args["figsize"] = (15,5)
|
|
1498
|
+
fig, ax1 = plt.subplots(1, 1,**fig_args)
|
|
1499
|
+
ax2 = None
|
|
1500
|
+
ax3 = None
|
|
1448
1501
|
else:
|
|
1449
1502
|
raise ValueError("Please select one from the 5 modes: mqq/qqm/m/qq/r/b")
|
|
1450
1503
|
ax4=None
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import pandas as pd
|
|
2
|
+
import matplotlib.pyplot as plt
|
|
3
|
+
import seaborn as sns
|
|
4
|
+
import numpy as np
|
|
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
|
+
import copy
|
|
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.g_version import _get_version
|
|
23
|
+
|
|
24
|
+
def _gwheatmap(
|
|
25
|
+
insumstats,
|
|
26
|
+
chrom="CHR",
|
|
27
|
+
pos="POS",
|
|
28
|
+
ref_chrom="REF_CHR",
|
|
29
|
+
ref_pos="REF_START",
|
|
30
|
+
p="P",
|
|
31
|
+
scaled=False,
|
|
32
|
+
sizes = (10,50),
|
|
33
|
+
alpha=0.5,
|
|
34
|
+
mlog10p="MLOG10P",
|
|
35
|
+
snpid="SNPID",
|
|
36
|
+
eaf=None,
|
|
37
|
+
group="CIS/TRANS",
|
|
38
|
+
ea="EA",
|
|
39
|
+
nea="NEA",
|
|
40
|
+
colors=None,
|
|
41
|
+
check = True,
|
|
42
|
+
chr_dict = None,
|
|
43
|
+
xchrpad = 0,
|
|
44
|
+
ychrpad=0,
|
|
45
|
+
use_rank = False,
|
|
46
|
+
xtick_chr_dict=None,
|
|
47
|
+
ytick_chr_dict=None,
|
|
48
|
+
fontsize=10,
|
|
49
|
+
add_b =False,
|
|
50
|
+
log=Log(),
|
|
51
|
+
fig_kwargs=None,
|
|
52
|
+
scatter_kwargs=None,
|
|
53
|
+
height_ratios=None,
|
|
54
|
+
hspace = 0.1,
|
|
55
|
+
font_family="Arial",
|
|
56
|
+
cis_windowsizekb=100,
|
|
57
|
+
verbose=True,
|
|
58
|
+
save=True,
|
|
59
|
+
save_kwargs=None,
|
|
60
|
+
grid_linewidth=1,
|
|
61
|
+
grid_linecolor="grey",
|
|
62
|
+
**mqq_kwargs
|
|
63
|
+
):
|
|
64
|
+
log.write("Start to create genome-wide scatter plot...{}:".format(_get_version()),verbose=verbose)
|
|
65
|
+
if height_ratios is None:
|
|
66
|
+
height_ratios = [1, 2]
|
|
67
|
+
if xtick_chr_dict is None:
|
|
68
|
+
xtick_chr_dict = get_number_to_chr()
|
|
69
|
+
if ytick_chr_dict is None:
|
|
70
|
+
ytick_chr_dict = get_number_to_chr()
|
|
71
|
+
if chr_dict is None:
|
|
72
|
+
chr_dict = get_chr_to_number()
|
|
73
|
+
if colors is None:
|
|
74
|
+
colors=["#CB132D","#597FBD"]
|
|
75
|
+
if fig_kwargs is None:
|
|
76
|
+
fig_kwargs= dict(figsize=(15,15))
|
|
77
|
+
if save_kwargs is None:
|
|
78
|
+
save_kwargs = {"dpi":300,"facecolor":"white"}
|
|
79
|
+
if scatter_kwargs is None:
|
|
80
|
+
scatter_kwargs = {}
|
|
81
|
+
|
|
82
|
+
fig_kwargs, scatter_kwargs, qq_scatter_args, save_kwargs = _configure_fig_save_kwargs(save=save,
|
|
83
|
+
fig_args = fig_kwargs,
|
|
84
|
+
scatter_args = scatter_kwargs,
|
|
85
|
+
qq_scatter_args = dict(),
|
|
86
|
+
save_args = save_kwargs)
|
|
87
|
+
|
|
88
|
+
sumstats = insumstats.copy()
|
|
89
|
+
|
|
90
|
+
# Data QC and format
|
|
91
|
+
if check ==True:
|
|
92
|
+
sumstats[pos] = _quick_fix_pos(sumstats[pos])
|
|
93
|
+
sumstats[chrom] = _quick_fix_chr(sumstats[chrom], chr_dict=chr_dict)
|
|
94
|
+
sumstats[ref_pos] = _quick_fix_pos(sumstats[ref_pos])
|
|
95
|
+
sumstats[ref_chrom] = _quick_fix_chr(sumstats[ref_chrom], chr_dict=chr_dict)
|
|
96
|
+
sumstats = _dropna_in_cols(sumstats, [pos, chrom, ref_pos, ref_chrom], log=log, verbose=verbose)
|
|
97
|
+
|
|
98
|
+
# dropna
|
|
99
|
+
sumstats = sumstats.sort_values(by=group)
|
|
100
|
+
|
|
101
|
+
if scaled is True:
|
|
102
|
+
sumstats["raw_P"] = pd.to_numeric(sumstats[mlog10p], errors='coerce')
|
|
103
|
+
else:
|
|
104
|
+
sumstats["raw_P"] = sumstats[p].astype("float64")
|
|
105
|
+
|
|
106
|
+
sumstats = _process_p_value(sumstats=sumstats,
|
|
107
|
+
mode="m",
|
|
108
|
+
p=p,
|
|
109
|
+
mlog10p=mlog10p,
|
|
110
|
+
scaled=scaled,
|
|
111
|
+
log=log,
|
|
112
|
+
verbose=verbose )
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
if add_b ==False:
|
|
117
|
+
fig, ax1 = plt.subplots(**fig_kwargs)
|
|
118
|
+
else:
|
|
119
|
+
fig, (ax2, ax1) = plt.subplots( nrows=2 ,sharex=True, gridspec_kw={'height_ratios': height_ratios }, **fig_kwargs)
|
|
120
|
+
plt.subplots_adjust(hspace=hspace)
|
|
121
|
+
|
|
122
|
+
## assign i for variants
|
|
123
|
+
sumstats, chrom_df_x = _quick_assign_i_with_rank(sumstats,
|
|
124
|
+
chrpad=xchrpad,
|
|
125
|
+
use_rank=use_rank,
|
|
126
|
+
chrom=chrom,
|
|
127
|
+
pos=pos,
|
|
128
|
+
verbose=verbose)
|
|
129
|
+
chrom_df_b = chrom_df_x
|
|
130
|
+
sumstats = sumstats.rename(columns={"i":"i_x"})
|
|
131
|
+
add_x_unique = list(sumstats["_ADD"].unique())
|
|
132
|
+
|
|
133
|
+
## determine grouping methods for Y
|
|
134
|
+
## assign i for Y group
|
|
135
|
+
sumstats, chrom_df_y = _quick_assign_i_with_rank(sumstats,
|
|
136
|
+
chrpad=ychrpad,
|
|
137
|
+
use_rank=use_rank,
|
|
138
|
+
chrom=ref_chrom,
|
|
139
|
+
pos=ref_pos,
|
|
140
|
+
verbose=verbose)
|
|
141
|
+
|
|
142
|
+
sumstats = sumstats.rename(columns={"i":"i_y"})
|
|
143
|
+
add_y_unique = list(sumstats["_ADD"].unique())
|
|
144
|
+
|
|
145
|
+
if add_b == True:
|
|
146
|
+
sumstats["i"] = sumstats["i_x"]
|
|
147
|
+
fig,log = mqqplot(sumstats,
|
|
148
|
+
chrom=chrom,
|
|
149
|
+
pos=pos,
|
|
150
|
+
p=p,
|
|
151
|
+
mlog10p=mlog10p,
|
|
152
|
+
snpid=snpid,
|
|
153
|
+
scaled=scaled,
|
|
154
|
+
log=log,
|
|
155
|
+
mode="b",
|
|
156
|
+
figax=(fig,ax2),
|
|
157
|
+
_chrom_df_for_i = chrom_df_b,
|
|
158
|
+
_invert=False,
|
|
159
|
+
_if_quick_qc=False,
|
|
160
|
+
**mqq_kwargs
|
|
161
|
+
)
|
|
162
|
+
##
|
|
163
|
+
#min_xy = min(min(sumstats["i_x"]),min(sumstats["i_y"]))
|
|
164
|
+
#max_xy = max(max(sumstats["i_x"]),max(sumstats["i_y"]))
|
|
165
|
+
|
|
166
|
+
## determine color
|
|
167
|
+
|
|
168
|
+
## determine dot size
|
|
169
|
+
|
|
170
|
+
## plot
|
|
171
|
+
legend = True
|
|
172
|
+
style=None
|
|
173
|
+
linewidth=0
|
|
174
|
+
edgecolor="black"
|
|
175
|
+
|
|
176
|
+
palette = sns.color_palette(colors,n_colors=sumstats[group].nunique())
|
|
177
|
+
|
|
178
|
+
#for index,g in enumerate(sumstats[group].unique()):
|
|
179
|
+
#
|
|
180
|
+
# palette = sns.color_palette("dark:{}".format(colors[index]), as_cmap=True)
|
|
181
|
+
#
|
|
182
|
+
# plot = sns.scatterplot(data=sumstats.loc[sumstats[group]==g,:], x='i_x', y='i_y',
|
|
183
|
+
# hue="scaled_P",
|
|
184
|
+
# palette=palette,
|
|
185
|
+
# size="scaled_P",
|
|
186
|
+
# alpha=alpha,
|
|
187
|
+
# sizes=sizes,
|
|
188
|
+
# legend=legend,
|
|
189
|
+
# style=style,
|
|
190
|
+
# linewidth=linewidth,
|
|
191
|
+
# edgecolor = edgecolor,
|
|
192
|
+
# zorder=2,
|
|
193
|
+
# ax=ax1)
|
|
194
|
+
|
|
195
|
+
plot = sns.scatterplot(data=sumstats, x='i_x', y='i_y',
|
|
196
|
+
hue=group,
|
|
197
|
+
palette=palette,
|
|
198
|
+
size="scaled_P",
|
|
199
|
+
alpha=alpha,
|
|
200
|
+
sizes=sizes,
|
|
201
|
+
legend=legend,
|
|
202
|
+
style=style,
|
|
203
|
+
linewidth=linewidth,
|
|
204
|
+
edgecolor = edgecolor,
|
|
205
|
+
zorder=2,
|
|
206
|
+
ax=ax1, **scatter_kwargs)
|
|
207
|
+
|
|
208
|
+
handles, labels = ax1.get_legend_handles_labels()
|
|
209
|
+
new_labels = []
|
|
210
|
+
ncol = len(labels)
|
|
211
|
+
for i in labels:
|
|
212
|
+
if i==group:
|
|
213
|
+
new_labels.append("Group")
|
|
214
|
+
elif i=="scaled_P":
|
|
215
|
+
new_labels.append("$-log_{10}(P)$")
|
|
216
|
+
else:
|
|
217
|
+
new_labels.append(i)
|
|
218
|
+
|
|
219
|
+
ax1.legend(labels = new_labels, handles=handles, loc="lower center", bbox_to_anchor=(.45, -0.17),
|
|
220
|
+
ncol=ncol, scatterpoints=2, title=None, frameon=False)
|
|
221
|
+
|
|
222
|
+
## add vertical line
|
|
223
|
+
for i in add_x_unique:
|
|
224
|
+
ax1.axvline(x = i+0.5, linewidth = grid_linewidth,color=grid_linecolor,zorder=1000 )
|
|
225
|
+
for i in add_y_unique:
|
|
226
|
+
ax1.axhline(y = i+0.5, linewidth = grid_linewidth,color=grid_linecolor,zorder=1000 )
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
## add X tick label
|
|
230
|
+
ax1 = _process_xtick(ax1, chrom_df_x, xtick_chr_dict, fontsize, font_family, log=log,verbose=True)
|
|
231
|
+
## add Y tick label
|
|
232
|
+
ax1 = _process_ytick(ax1, chrom_df_y, ytick_chr_dict, fontsize, font_family, log=log,verbose=True)
|
|
233
|
+
|
|
234
|
+
## set x y lim
|
|
235
|
+
ax1.set_ylim([0.5,sumstats["i_y"].max()+1])
|
|
236
|
+
ax1.set_xlim([0.5,sumstats["i_x"].max()+1])
|
|
237
|
+
|
|
238
|
+
## set x y label
|
|
239
|
+
|
|
240
|
+
xlabel = "pQTL position"
|
|
241
|
+
ax1.set_xlabel(xlabel,fontsize=fontsize,family=font_family)
|
|
242
|
+
ylabel = "location of the gene encoding the target protein"
|
|
243
|
+
ax1.set_ylabel(ylabel,fontsize=fontsize,family=font_family)
|
|
244
|
+
|
|
245
|
+
save_figure(fig = fig, save = save, keyword="gwheatmap", save_args=save_kwargs, log = log, verbose=verbose)
|
|
246
|
+
|
|
247
|
+
return fig, log
|
|
248
|
+
|
|
249
|
+
################################################################################################################
|
|
250
|
+
def _process_xtick(ax1, chrom_df, xtick_chr_dict, fontsize, font_family, log=Log(),verbose=True):
|
|
251
|
+
log.write(" -Processing X ticks...",verbose=verbose)
|
|
252
|
+
ax1.set_xticks(chrom_df.astype("float64"))
|
|
253
|
+
ax1.set_xticklabels(chrom_df.index.astype("Int64").map(xtick_chr_dict),fontsize=fontsize,family=font_family)
|
|
254
|
+
return ax1
|
|
255
|
+
|
|
256
|
+
def _process_ytick(ax1, chrom_df, ytick_chr_dict, fontsize, font_family, log=Log(),verbose=True):
|
|
257
|
+
log.write(" -Processing Y ticks...",verbose=verbose)
|
|
258
|
+
ax1.set_yticks(chrom_df.astype("float64"))
|
|
259
|
+
ax1.set_yticklabels(chrom_df.index.astype("Int64").map(ytick_chr_dict),fontsize=fontsize,family=font_family)
|
|
260
|
+
return ax1
|
|
@@ -143,7 +143,7 @@ def plot_stacked_mqq(objects,
|
|
|
143
143
|
mqq_args_for_each_plot = _sort_args(mqq_args, n_plot)
|
|
144
144
|
##########################################################################################################################################
|
|
145
145
|
# get x axis dict
|
|
146
|
-
if mode=="m":
|
|
146
|
+
if mode=="m" or mode=="r":
|
|
147
147
|
_posdiccul = _get_chrom_dic(sumstats_list,chrom="CHR",pos="POS",chrpad=0.02)
|
|
148
148
|
else:
|
|
149
149
|
_posdiccul=None
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: gwaslab
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.5.1
|
|
4
4
|
Summary: A collection of handy tools for GWAS SumStats
|
|
5
5
|
Author-email: Yunye <yunye@gwaslab.com>
|
|
6
6
|
Project-URL: Homepage, https://cloufield.github.io/gwaslab/
|
|
@@ -20,7 +20,7 @@ Requires-Dist: scipy>=1.12
|
|
|
20
20
|
Requires-Dist: pySAM==0.22.1
|
|
21
21
|
Requires-Dist: Biopython>=1.79
|
|
22
22
|
Requires-Dist: adjustText<=0.8,>=0.7.3
|
|
23
|
-
Requires-Dist: liftover
|
|
23
|
+
Requires-Dist: liftover<=1.3.1,>=1.1.13
|
|
24
24
|
Requires-Dist: scikit-allel>=1.3.5
|
|
25
25
|
Requires-Dist: pyensembl==2.2.3
|
|
26
26
|
Requires-Dist: gtfparse==1.3.0
|
|
@@ -51,7 +51,7 @@ Warning: Known issues of GWASLab are summarized in [https://cloufield.github.io/
|
|
|
51
51
|
### install via pip
|
|
52
52
|
|
|
53
53
|
```
|
|
54
|
-
pip install gwaslab==3.
|
|
54
|
+
pip install gwaslab==3.5.0
|
|
55
55
|
```
|
|
56
56
|
|
|
57
57
|
```python
|
|
@@ -2,21 +2,22 @@ gwaslab/__init__.py,sha256=7TKJaODdpeuQKibL7gIEa4MtyQ0pmrU-vIHQ-Et27lQ,2433
|
|
|
2
2
|
gwaslab/bd_common_data.py,sha256=2voBqMrIsII1TN5T6uvyDax90fWcJK1Stmo1ZHNGGsE,13898
|
|
3
3
|
gwaslab/bd_config.py,sha256=TP-r-DPhJD3XnRYZbw9bQHXaDIkiRgK8bG9HCt-UaLc,580
|
|
4
4
|
gwaslab/bd_download.py,sha256=cDDk2C5IvjeAzvPvVYGTkI4Ss33DUtEDjGo8eAbQRvY,15663
|
|
5
|
-
gwaslab/bd_get_hapmap3.py,sha256=
|
|
5
|
+
gwaslab/bd_get_hapmap3.py,sha256=FQpwbhWUPFT152QtiLevEkkN4YcVDIeKzoK0Uz1NlRo,4108
|
|
6
6
|
gwaslab/cache_manager.py,sha256=HOTnSkCOyGEPLRl90WT8D_6pAdI8d8AzenMIDGuCeWc,28113
|
|
7
7
|
gwaslab/g_Log.py,sha256=C3Zv-_6c3C9ms8bgQ-ytplz22sjk7euqXYkWr9zNeAs,1573
|
|
8
8
|
gwaslab/g_Phenotypes.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
-
gwaslab/g_Sumstats.py,sha256=
|
|
9
|
+
gwaslab/g_Sumstats.py,sha256=c_qYY2H-nf-JtGepzafoHuYwnWxmOOBf9CDytPZc60Q,36704
|
|
10
10
|
gwaslab/g_SumstatsPair.py,sha256=20snPb4SlI6ftMGVjgxAuyxsxYRQF-GzzlBSnoB-3Lo,8851
|
|
11
11
|
gwaslab/g_SumstatsT.py,sha256=u_DighLMnMxwTLnqm-B58pA0G6WXRj6pudPyKMVKjSU,2133
|
|
12
12
|
gwaslab/g_Sumstats_summary.py,sha256=FECvvFXJVKaCX5dggBvvk9YvJ6AbdbcLfjltysX7wEE,6380
|
|
13
13
|
gwaslab/g_meta.py,sha256=htWlgURWclm9R6UqFcX1a93WN27xny7lGUeyJZOtszQ,2583
|
|
14
14
|
gwaslab/g_vchange_status.py,sha256=w3zsYYOcCaI3PTeboonvkQjudzUAfVIgATzRdiPViZs,1939
|
|
15
|
-
gwaslab/g_version.py,sha256=
|
|
15
|
+
gwaslab/g_version.py,sha256=Wpfo8Y_fjYS4ajalombaHrLezBO7BOr070GnjQHhOGw,1885
|
|
16
16
|
gwaslab/hm_casting.py,sha256=FqP4EQl83Q2OKLw004OgLIvUH795TVCGwziLk5jsHqY,11368
|
|
17
17
|
gwaslab/hm_harmonize_sumstats.py,sha256=_sZ8soikAxDokw-dcr_CLguBB8OmTmPPS04MfmsJc_Q,79509
|
|
18
18
|
gwaslab/hm_rsid_to_chrpos.py,sha256=ODWREO0jPN0RAfNzL5fRzSRANfhiksOvUVPuEsFZQqA,6552
|
|
19
19
|
gwaslab/io_preformat_input.py,sha256=J8Ny4OPMaLVdo2nP8lTM-c5A8LSdqphSrp9G4i9JjDQ,24097
|
|
20
|
+
gwaslab/io_process_args.py,sha256=bF7oHBtMnxJgksIit0O0_U94dZFh8r5YblgDqEEsqoM,806
|
|
20
21
|
gwaslab/io_read_ldsc.py,sha256=wsYXpH50IchBKd2dhYloSqc4YgnDkiwMsAweaCoN5Eo,12471
|
|
21
22
|
gwaslab/io_read_tabular.py,sha256=EG-C6KhCutt4J4LlOMgXnqzJvU-EZXzVhMvaDFnHrMM,2380
|
|
22
23
|
gwaslab/io_to_formats.py,sha256=8FmbQjWUIsz_V1Lb80TuwRIXKBgs5t42j25Znougk1Y,29401
|
|
@@ -28,7 +29,7 @@ gwaslab/ldsc_parse.py,sha256=MBnfgcWlV4oHp9MoDRh1mpilaHhAR15Af77hMFn4-5k,10564
|
|
|
28
29
|
gwaslab/ldsc_regressions.py,sha256=yzbGjgNV7u-SWXNPsh9S8y9mK97Bim_Nmad9G9V18ZU,30078
|
|
29
30
|
gwaslab/ldsc_sumstats.py,sha256=O0olsDxKlh1MJ1gAuEN1t40rxhajOEwOQ20ak7xoDrI,26245
|
|
30
31
|
gwaslab/qc_check_datatype.py,sha256=kW68uk4dTLOU2b1dHoVat6n0loundDysAjIqxsXW28Q,3379
|
|
31
|
-
gwaslab/qc_fix_sumstats.py,sha256=
|
|
32
|
+
gwaslab/qc_fix_sumstats.py,sha256=u0YfC70zop2roUfq6mLMNL49m8AHPF2G-j8dKqW25yY,98261
|
|
32
33
|
gwaslab/run_script.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
33
34
|
gwaslab/util_abf_finemapping.py,sha256=LRcopjtkT-iXtKPAJIzR4qjPdhD7nrS_BGit4EW89FM,3054
|
|
34
35
|
gwaslab/util_ex_calculate_ldmatrix.py,sha256=Z_spxbq6SHDS0v84I59YTTF40iyLQIOZbt0dmEcNJjw,15417
|
|
@@ -50,25 +51,28 @@ gwaslab/util_in_correct_winnerscurse.py,sha256=Gp--yAQ8MMzdkWIvXP9C1BHVjZc-YzqHf
|
|
|
50
51
|
gwaslab/util_in_fill_data.py,sha256=iVq5WLWwFI03v9HyvBanu5si3j2p-oyPFTl8jsX69xM,14693
|
|
51
52
|
gwaslab/util_in_filter_value.py,sha256=dY4X66N9A4MHCRHjPqLYFufMM91ggLRwUBf_nJYh8Lg,23605
|
|
52
53
|
gwaslab/util_in_get_density.py,sha256=kpKXH69acMkeYVG5vs-VbJC3COhmuLBfYco-wuOxgjc,3934
|
|
53
|
-
gwaslab/util_in_get_sig.py,sha256=
|
|
54
|
+
gwaslab/util_in_get_sig.py,sha256=53NOh7KueLY3vJPTNhhb37KPAIgLEfcP3k2zIV61lc4,39845
|
|
54
55
|
gwaslab/util_in_meta.py,sha256=5K9lIZcIgUy0AERqHy1GvMN2X6dp45JUUgopuDLgt4o,11284
|
|
55
56
|
gwaslab/util_in_snphwe.py,sha256=-KpIDx6vn_nah6H55IkV2OyjXQVXV13XyBL069WE1wM,1751
|
|
56
|
-
gwaslab/
|
|
57
|
+
gwaslab/vis_plot_credible sets.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
58
|
+
gwaslab/viz_aux_annotate_plot.py,sha256=gA-s8a90dsl3MB5CIapdI_DecD9h2FmuqMgy07kMYJI,25207
|
|
57
59
|
gwaslab/viz_aux_chromatin.py,sha256=7cGmej5EkKO7fxR1b5w8r1oRRl9ofVzFRG52SCYWtz0,4109
|
|
58
|
-
gwaslab/
|
|
60
|
+
gwaslab/viz_aux_property.py,sha256=UIaivghnLXYpTwkKnXRK0F28Jbn9L6OaICk3K73WZaU,33
|
|
61
|
+
gwaslab/viz_aux_quickfix.py,sha256=HnhVvY0GP0EN0gLJ-B11OYiE5PWDcdKGUpQ3QZeu0lE,18592
|
|
59
62
|
gwaslab/viz_aux_reposition_text.py,sha256=iRIP-Rkltlei068HekJcVubiqPrunBqvAoSQ1eHk04M,4304
|
|
60
|
-
gwaslab/viz_aux_save_figure.py,sha256=
|
|
63
|
+
gwaslab/viz_aux_save_figure.py,sha256=GdUXNBOelsWqtTXm8pEZzeGGwDxHYnBkyrGwLOK16ew,2723
|
|
61
64
|
gwaslab/viz_plot_compare_af.py,sha256=qtXW45-Sq_ugK8ZfqBYMpmf58SKi3lB3YyHnzn_akcE,5344
|
|
62
|
-
gwaslab/viz_plot_compare_effect.py,sha256=
|
|
65
|
+
gwaslab/viz_plot_compare_effect.py,sha256=kq-rVWygHEeTBMOtd_jk8nK85ClZHU-ADSf4nI2gTKo,66604
|
|
63
66
|
gwaslab/viz_plot_forestplot.py,sha256=xgOnefh737CgdQxu5naVyRNBX1NQXPFKzf51fbh6afs,6771
|
|
64
67
|
gwaslab/viz_plot_miamiplot.py,sha256=rCFEp7VNuVqeBBG3WRkmFAtFklbF79BvIQQYiSY70VY,31238
|
|
65
68
|
gwaslab/viz_plot_miamiplot2.py,sha256=xiFCgFX8hEySmCJORpEurMVER9eEXQyy_Ik7mLkbi9g,16015
|
|
66
|
-
gwaslab/viz_plot_mqqplot.py,sha256=
|
|
69
|
+
gwaslab/viz_plot_mqqplot.py,sha256=emyEXZZenzm8eh3XFCkTWI8sz0fEnL5QJxohOZMxWZc,67189
|
|
70
|
+
gwaslab/viz_plot_phe_heatmap.py,sha256=qoXVeFTIm-n8IinNbDdPFVBSz2yGCGK6QzTstXv6aj4,9532
|
|
67
71
|
gwaslab/viz_plot_qqplot.py,sha256=psQgVpP29686CEZkzQz0iRbApzqy7aE3GGiBcazVvNw,7247
|
|
68
72
|
gwaslab/viz_plot_regional2.py,sha256=tBoGox-4ngL5o_twdIjk_VW6Iam3JDyrPKuttm6_4Sg,36862
|
|
69
73
|
gwaslab/viz_plot_regionalplot.py,sha256=8u-5-yfy-UaXhaxVVz3Y5k2kBAoqzczUw1hyyD450iI,37983
|
|
70
74
|
gwaslab/viz_plot_rg_heatmap.py,sha256=PidUsgOiEVt6MfBPCF3_yDhOEytZ-I1q-ZD6_0pFrV4,13713
|
|
71
|
-
gwaslab/viz_plot_stackedregional.py,sha256=
|
|
75
|
+
gwaslab/viz_plot_stackedregional.py,sha256=HfNUhwxevbwSoauE0ysG020U7YFVy4111nkIWdaJ4Q8,16664
|
|
72
76
|
gwaslab/viz_plot_trumpetplot.py,sha256=ZHdc6WcVx0-oKoj88yglRkmB4bS9pOiEMcuwKW35Yvo,42672
|
|
73
77
|
gwaslab/data/formatbook.json,sha256=N2nJs80HH98Rsu9FxaSvIQO9J5yIV97WEtAKjRqYwiY,38207
|
|
74
78
|
gwaslab/data/reference.json,sha256=IrjwFnXjrpVUp3zYfcYClpibJE9Y-94gtrC1Aw8sXxg,12332
|
|
@@ -78,9 +82,9 @@ gwaslab/data/hapmap3_SNPs/hapmap3_db150_hg19.snplist.gz,sha256=qD9RsC5S2h6l-OdpW
|
|
|
78
82
|
gwaslab/data/hapmap3_SNPs/hapmap3_db151_hg38.snplist.gz,sha256=Y8ZT2FIAhbhlgCJdE9qQVAiwnV_fcsPt72usBa7RSBM,10225828
|
|
79
83
|
gwaslab/data/high_ld/high_ld_hla_hg19.bed.gz,sha256=R7IkssKu0L4WwkU9SrS84xCMdrkkKL0gnTNO_OKbG0Y,219
|
|
80
84
|
gwaslab/data/high_ld/high_ld_hla_hg38.bed.gz,sha256=76CIU0pibDJ72Y6UY-TbIKE9gEPwTELAaIbCXyjm80Q,470
|
|
81
|
-
gwaslab-3.
|
|
82
|
-
gwaslab-3.
|
|
83
|
-
gwaslab-3.
|
|
84
|
-
gwaslab-3.
|
|
85
|
-
gwaslab-3.
|
|
86
|
-
gwaslab-3.
|
|
85
|
+
gwaslab-3.5.1.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
86
|
+
gwaslab-3.5.1.dist-info/LICENSE_before_v3.4.39,sha256=GhLOU_1UDEKeOacYhsRN_m9u-eIuVTazSndZPeNcTZA,1066
|
|
87
|
+
gwaslab-3.5.1.dist-info/METADATA,sha256=Dqj65vurvDR3JCwlyCVnnfUS64cmN1vMJJjUTCm3xLI,7758
|
|
88
|
+
gwaslab-3.5.1.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
|
|
89
|
+
gwaslab-3.5.1.dist-info/top_level.txt,sha256=PyY6hWtrALpv2MAN3kjkIAzJNmmBTH5a2risz9KwH08,8
|
|
90
|
+
gwaslab-3.5.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|