gwaslab 3.5.5__py3-none-any.whl → 3.5.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 +2 -1
- gwaslab/g_Sumstats.py +27 -1
- gwaslab/g_SumstatsSet.py +663 -0
- gwaslab/g_version.py +2 -2
- gwaslab/hm_harmonize_sumstats.py +91 -1
- gwaslab/qc_fix_sumstats.py +1 -1
- gwaslab/util_ex_ldproxyfinder.py +162 -3
- gwaslab/util_in_fill_data.py +19 -2
- gwaslab/util_in_filter_value.py +52 -1
- gwaslab/util_in_merge.py +51 -0
- gwaslab/viz_aux_save_figure.py +2 -1
- gwaslab/viz_plot_effect.py +283 -0
- gwaslab/viz_plot_miamiplot2.py +1 -1
- gwaslab/viz_plot_mqqplot.py +103 -65
- gwaslab/viz_plot_regional2.py +136 -44
- gwaslab/viz_plot_rg_heatmap.py +6 -1
- gwaslab/viz_plot_stackedregional.py +17 -6
- {gwaslab-3.5.5.dist-info → gwaslab-3.5.7.dist-info}/METADATA +3 -3
- {gwaslab-3.5.5.dist-info → gwaslab-3.5.7.dist-info}/RECORD +23 -20
- {gwaslab-3.5.5.dist-info → gwaslab-3.5.7.dist-info}/WHEEL +1 -1
- {gwaslab-3.5.5.dist-info → gwaslab-3.5.7.dist-info}/LICENSE +0 -0
- {gwaslab-3.5.5.dist-info → gwaslab-3.5.7.dist-info}/LICENSE_before_v3.4.39 +0 -0
- {gwaslab-3.5.5.dist-info → gwaslab-3.5.7.dist-info}/top_level.txt +0 -0
gwaslab/viz_plot_regional2.py
CHANGED
|
@@ -36,12 +36,8 @@ def _plot_regional(
|
|
|
36
36
|
region,
|
|
37
37
|
vcf_path,
|
|
38
38
|
marker_size,
|
|
39
|
-
fontsize,
|
|
40
39
|
build,
|
|
41
|
-
chrom_df,
|
|
42
|
-
xtick_chr_dict,
|
|
43
40
|
cut_line_color,
|
|
44
|
-
vcf_chr_dict = None,
|
|
45
41
|
gtf_path="default",
|
|
46
42
|
gtf_chr_dict = get_number_to_chr(),
|
|
47
43
|
gtf_gene_name=None,
|
|
@@ -50,23 +46,29 @@ def _plot_regional(
|
|
|
50
46
|
rr_chr_dict = get_number_to_chr(),
|
|
51
47
|
rr_lim = (0,100),
|
|
52
48
|
rr_ylabel = True,
|
|
53
|
-
rr_title=None,
|
|
54
49
|
region_ld_legend=True,
|
|
55
50
|
region_title=None,
|
|
56
51
|
mode="mqq",
|
|
57
52
|
region_step = 21,
|
|
58
53
|
region_ref=None,
|
|
59
54
|
region_ref_index_dic = None,
|
|
55
|
+
region_ref_alias = None,
|
|
60
56
|
#region_ref_second=None,
|
|
61
57
|
region_grid = False,
|
|
62
58
|
region_grid_line = {"linewidth": 2,"linestyle":"--"},
|
|
63
59
|
region_lead_grid = True,
|
|
64
60
|
region_lead_grid_line = {"alpha":0.5,"linewidth" : 2,"linestyle":"--","color":"#FF0000"},
|
|
65
61
|
region_title_args = None,
|
|
66
|
-
region_hspace=0.02,
|
|
67
62
|
region_ld_threshold = [0.2,0.4,0.6,0.8],
|
|
68
|
-
region_ld_colors = ["#E4E4E4","#020080","#86CEF9","#24FF02","#FDA400","#FF0000","#FF0000"],
|
|
69
63
|
region_marker_shapes=None,
|
|
64
|
+
cbar_fontsize=None,
|
|
65
|
+
cbar_scale=False,
|
|
66
|
+
cbar_bbox_to_anchor=None,
|
|
67
|
+
cbar_w_scale=1,
|
|
68
|
+
cbar_h_scale=1,
|
|
69
|
+
cbar_downward_offset =1.3,
|
|
70
|
+
cbar_borderpad=None,
|
|
71
|
+
cbar_equal_aspect=False,
|
|
70
72
|
palette=None,
|
|
71
73
|
region_recombination = True,
|
|
72
74
|
region_protein_coding=True,
|
|
@@ -75,8 +77,6 @@ def _plot_regional(
|
|
|
75
77
|
track_font_family="Arial",
|
|
76
78
|
taf=[4,0,0.95,1,1],
|
|
77
79
|
# track_n, track_n_offset,font_ratio,exon_ratio,text_offset
|
|
78
|
-
tabix=None,
|
|
79
|
-
chrom="CHR",
|
|
80
80
|
pos="POS",
|
|
81
81
|
verbose=True,
|
|
82
82
|
log=Log()
|
|
@@ -132,7 +132,16 @@ def _plot_regional(
|
|
|
132
132
|
region_ref=region_ref,
|
|
133
133
|
region_ld_threshold=region_ld_threshold,
|
|
134
134
|
region_ref_index_dic=region_ref_index_dic,
|
|
135
|
+
region_ref_alias=region_ref_alias,
|
|
135
136
|
region_marker_shapes=region_marker_shapes,
|
|
137
|
+
cbar_fontsize= cbar_fontsize,
|
|
138
|
+
cbar_scale=cbar_scale,
|
|
139
|
+
cbar_equal_aspect=cbar_equal_aspect,
|
|
140
|
+
cbar_bbox_to_anchor=cbar_bbox_to_anchor,
|
|
141
|
+
cbar_w_scale=cbar_w_scale,
|
|
142
|
+
cbar_h_scale=cbar_h_scale,
|
|
143
|
+
cbar_downward_offset =cbar_downward_offset,
|
|
144
|
+
cbar_borderpad=cbar_borderpad,
|
|
136
145
|
palette=palette,
|
|
137
146
|
region_legend_marker=region_legend_marker,
|
|
138
147
|
fig=fig)
|
|
@@ -154,6 +163,8 @@ def _plot_regional(
|
|
|
154
163
|
build= build,
|
|
155
164
|
rr_lim=rr_lim,
|
|
156
165
|
rr_ylabel=rr_ylabel)
|
|
166
|
+
else:
|
|
167
|
+
ax4 = None
|
|
157
168
|
|
|
158
169
|
## regional plot : gene track ######################################################################
|
|
159
170
|
# calculate offset
|
|
@@ -205,7 +216,7 @@ def _plot_regional(
|
|
|
205
216
|
if "r" in mode:
|
|
206
217
|
if gtf_path is not None:
|
|
207
218
|
ax3.set_xticks(np.linspace(gene_track_start_i+region[1], gene_track_start_i+region[2], num=region_step))
|
|
208
|
-
ax3.set_xticklabels(region_ticks,rotation=45
|
|
219
|
+
ax3.set_xticklabels(region_ticks,rotation=45)
|
|
209
220
|
|
|
210
221
|
if region_grid==True:
|
|
211
222
|
for i in np.linspace(gene_track_start_i+region[1], gene_track_start_i+region[2], num=region_step):
|
|
@@ -221,7 +232,7 @@ def _plot_regional(
|
|
|
221
232
|
else:
|
|
222
233
|
# set x ticks m plot
|
|
223
234
|
ax1.set_xticks(np.linspace(gene_track_start_i+region[1], gene_track_start_i+region[2], num=region_step))
|
|
224
|
-
ax1.set_xticklabels(region_ticks,rotation=45
|
|
235
|
+
ax1.set_xticklabels(region_ticks,rotation=45)
|
|
225
236
|
|
|
226
237
|
ax1.set_xlim([gene_track_start_i+region[1], gene_track_start_i+region[2]])
|
|
227
238
|
|
|
@@ -345,25 +356,52 @@ def _add_region_title(region_title, ax1,region_title_args):
|
|
|
345
356
|
ax1.text(0.015,0.97, region_title, transform=ax1.transAxes, va="top", ha="left", region_ref=None, **region_title_args )
|
|
346
357
|
return ax1
|
|
347
358
|
|
|
348
|
-
def _add_ld_legend(sumstats, ax1, region_ld_threshold, region_ref,region_ref_index_dic,region_marker_shapes,fig, region_legend_marker=True,
|
|
359
|
+
def _add_ld_legend(sumstats, ax1, region_ld_threshold, region_ref,region_ref_index_dic,region_marker_shapes,fig, region_legend_marker=True,
|
|
360
|
+
cbar_fontsize= None,cbar_scale=False,cbar_equal_aspect=True,cbar_w_scale=1,cbar_h_scale=1,palette =None,
|
|
361
|
+
cbar_downward_offset =1.2, cbar_borderpad=None,
|
|
362
|
+
cbar_bbox_to_anchor=(0, 0, 1, 1),region_ref_alias=None):
|
|
363
|
+
|
|
364
|
+
scale = 1
|
|
365
|
+
if cbar_scale:
|
|
366
|
+
base_fontsize = 9
|
|
367
|
+
scale = cbar_fontsize / base_fontsize
|
|
368
|
+
scale = max(1,scale)
|
|
369
|
+
else:
|
|
370
|
+
scale = 1
|
|
371
|
+
|
|
372
|
+
width_raw= 11 * (scale)*cbar_w_scale
|
|
373
|
+
height_raw=(7 + 7 * len(region_ref))*(scale)*cbar_h_scale
|
|
374
|
+
|
|
375
|
+
width_pct = "{}%".format(width_raw)
|
|
376
|
+
height_pct = "{}%".format( height_raw)
|
|
377
|
+
|
|
378
|
+
total_y_pixels =(ax1.bbox.get_points()[1][1]-ax1.bbox.get_points()[0][1])
|
|
379
|
+
downwards_offset = cbar_fontsize / (total_y_pixels/ fig.dpi * 72) * cbar_downward_offset
|
|
380
|
+
bbox_to_anchor = (cbar_bbox_to_anchor[0],cbar_bbox_to_anchor[1]-downwards_offset,cbar_bbox_to_anchor[2],cbar_bbox_to_anchor[3])
|
|
349
381
|
|
|
350
|
-
|
|
351
|
-
|
|
382
|
+
if cbar_borderpad is None:
|
|
383
|
+
borderpad=0.5*(scale)
|
|
384
|
+
else:
|
|
385
|
+
borderpad=cbar_borderpad
|
|
386
|
+
|
|
352
387
|
axins1 = inset_axes(ax1,
|
|
353
388
|
width=width_pct, # width = 50% of parent_bbox width
|
|
354
389
|
height=height_pct, # height : 5%
|
|
390
|
+
bbox_to_anchor=bbox_to_anchor,
|
|
391
|
+
bbox_transform=ax1.transAxes,
|
|
392
|
+
borderpad=borderpad,
|
|
355
393
|
loc='upper right',
|
|
356
|
-
axes_kwargs={"frameon":True,"facecolor":"white","zorder":999999})
|
|
357
|
-
|
|
394
|
+
axes_kwargs={"frameon":True,"facecolor":"white","zorder":999999,"anchor":"NE"})
|
|
395
|
+
|
|
358
396
|
ld_ticks = [0]+region_ld_threshold+[1]
|
|
359
397
|
|
|
360
398
|
for index, ld_threshold in enumerate(ld_ticks):
|
|
361
399
|
for group_index in range(len(region_ref)):
|
|
362
400
|
if index < len(ld_ticks)-1:
|
|
363
401
|
x=ld_threshold
|
|
364
|
-
y=0.2*group_index
|
|
402
|
+
y=0.2*group_index
|
|
365
403
|
width=0.2
|
|
366
|
-
height=ld_ticks[index+1]-ld_ticks[index]
|
|
404
|
+
height=(ld_ticks[index+1]-ld_ticks[index])
|
|
367
405
|
hex_color = palette[(region_ref_index_dic[region_ref[group_index]]+1)*100 + index+1] # consistent color
|
|
368
406
|
|
|
369
407
|
a = Rectangle((x,y),width, height, fill = True, color = hex_color , linewidth = 2)
|
|
@@ -371,22 +409,46 @@ def _add_ld_legend(sumstats, ax1, region_ld_threshold, region_ref,region_ref_ind
|
|
|
371
409
|
axins1.add_patch(a)
|
|
372
410
|
|
|
373
411
|
# y snpid
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
412
|
+
if region_ref_alias is None:
|
|
413
|
+
region_ref_name = region_ref
|
|
414
|
+
else:
|
|
415
|
+
region_ref_name = [region_ref_alias[i] for i in region_ref]
|
|
416
|
+
|
|
417
|
+
yticks_position = (0.1 + 0.2 *np.arange(0,len(region_ref_name)))
|
|
418
|
+
axins1.set_yticks(yticks_position, ["{}".format(x) for x in region_ref_name])
|
|
419
|
+
axins1.set_ylim(0,0.2*len(region_ref_name))
|
|
420
|
+
ymin, ymax=0,0.2*len(region_ref_name)
|
|
378
421
|
# x ld thresholds
|
|
422
|
+
|
|
379
423
|
axins1.set_xticks(ticks=ld_ticks)
|
|
380
424
|
axins1.set_xticklabels([str(i) for i in ld_ticks])
|
|
381
|
-
|
|
382
425
|
xmin, xmax = 0, 1
|
|
383
|
-
axins1.set_xlim(xmin,xmax)
|
|
426
|
+
axins1.set_xlim(xmin,xmax)
|
|
427
|
+
|
|
428
|
+
if cbar_equal_aspect==True:
|
|
429
|
+
axins1.set_aspect('equal', adjustable='box',anchor="NE")
|
|
384
430
|
|
|
385
431
|
############### ##############plot marker ############## ##############
|
|
386
432
|
if region_legend_marker==True:
|
|
387
433
|
for group_index, ref in enumerate(region_ref):
|
|
388
|
-
|
|
389
|
-
|
|
434
|
+
|
|
435
|
+
data_to_point_y =((axins1.bbox.get_points()[1][1]-axins1.bbox.get_points()[0][1])*height_raw/(ymax -ymin))
|
|
436
|
+
data_to_point_x =((axins1.bbox.get_points()[1][0]-axins1.bbox.get_points()[0][0])*width_raw/(xmax -xmin))
|
|
437
|
+
y_to_x = data_to_point_y/data_to_point_x
|
|
438
|
+
x_to_y = 1/y_to_x
|
|
439
|
+
xyratio = min(y_to_x, x_to_y)
|
|
440
|
+
|
|
441
|
+
marker_side_in_data = 0.075
|
|
442
|
+
if cbar_equal_aspect==True:
|
|
443
|
+
xyratio=1
|
|
444
|
+
|
|
445
|
+
## change markersize
|
|
446
|
+
|
|
447
|
+
if xyratio <1 :
|
|
448
|
+
x = 0 - (marker_side_in_data +0.03) * xyratio
|
|
449
|
+
else:
|
|
450
|
+
x = 0 - (marker_side_in_data +0.03)
|
|
451
|
+
y= (0.1 + 0.2 * group_index)
|
|
390
452
|
|
|
391
453
|
if len(region_ref) <2:
|
|
392
454
|
# single-ref mode
|
|
@@ -398,21 +460,36 @@ def _add_ld_legend(sumstats, ax1, region_ld_threshold, region_ref,region_ref_ind
|
|
|
398
460
|
c = palette[(region_ref_index_dic[region_ref[group_index]]+1)*100 + len(ld_ticks)-1]
|
|
399
461
|
|
|
400
462
|
# ([x0,y0][x1,y1])
|
|
401
|
-
|
|
402
|
-
|
|
463
|
+
# y pixels / per data 1
|
|
464
|
+
|
|
465
|
+
data_to_point_y =((axins1.bbox.get_points()[1][1]-axins1.bbox.get_points()[0][1])*height_raw/(ymax -ymin))
|
|
466
|
+
data_to_point_x =((axins1.bbox.get_points()[1][0]-axins1.bbox.get_points()[0][0])*width_raw/(xmax -xmin))
|
|
467
|
+
|
|
468
|
+
if data_to_point_y < data_to_point_x:
|
|
469
|
+
length_raw = 1 #height_raw
|
|
470
|
+
data_to_point = data_to_point_y
|
|
471
|
+
else:
|
|
472
|
+
length_raw = 1 #width_raw
|
|
473
|
+
data_to_point = data_to_point_x
|
|
474
|
+
|
|
475
|
+
# pixels/data 1 -> font points/data 1
|
|
476
|
+
# (dpi / 72) = point_per_pixel
|
|
477
|
+
# y pixels / per data 1 / (dpi / 72) -> y font points/data 1
|
|
478
|
+
|
|
479
|
+
font_points_per_data_1 = data_to_point/(fig.dpi/72)
|
|
480
|
+
s = ((marker_side_in_data*2)* font_points_per_data_1 * length_raw/100 )**2
|
|
403
481
|
|
|
404
482
|
axins1.scatter(x, y, s=s, marker=marker,c=c, edgecolors="black", linewidths = 1, clip_on=False, zorder=100)
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
axins1.set_title('LD $r^{2}$ with variant',loc="center",y=-0.2)
|
|
483
|
+
|
|
484
|
+
pad = ((marker_side_in_data*2+0.02)* font_points_per_data_1 * length_raw/100)
|
|
485
|
+
tick_length=(abs(x)* font_points_per_data_1 * length_raw/100)
|
|
486
|
+
axins1.tick_params(axis="y", pad=pad-0.5*tick_length, length=tick_length)
|
|
487
|
+
|
|
411
488
|
cbar = axins1
|
|
412
489
|
return ax1, cbar
|
|
413
490
|
|
|
414
491
|
# -############################################################################################################################################################################
|
|
415
|
-
def _plot_recombination_rate(sumstats,pos, region, ax1, rr_path, rr_chr_dict, rr_header_dict, build,rr_lim,rr_ylabel=True):
|
|
492
|
+
def _plot_recombination_rate(sumstats,pos, region, ax1, rr_path, rr_chr_dict, rr_header_dict, build,rr_lim, rr_ylabel=True):
|
|
416
493
|
ax4 = ax1.twinx()
|
|
417
494
|
most_left_snp = sumstats["i"].idxmin()
|
|
418
495
|
|
|
@@ -479,12 +556,15 @@ def _plot_gene_track(
|
|
|
479
556
|
stack_num_to_plot = max(taf[0],n_uniq_stack)
|
|
480
557
|
ax3.set_ylim((-stack_num_to_plot*2-taf[1]*2,2+taf[1]*2))
|
|
481
558
|
ax3.set_yticks([])
|
|
482
|
-
|
|
559
|
+
point_per_pixels = 72/fig.dpi
|
|
560
|
+
pixels_per_point = fig.dpi/72
|
|
561
|
+
|
|
483
562
|
pixels_per_track = np.abs(ax3.transData.transform([0,0])[1] - ax3.transData.transform([0,1])[1])
|
|
484
563
|
font_size_in_pixels= taf[2] * pixels_per_track
|
|
485
|
-
font_size_in_points = font_size_in_pixels *
|
|
486
|
-
linewidth_in_points= pixels_per_track * pixels_per_point
|
|
564
|
+
font_size_in_points = font_size_in_pixels * point_per_pixels
|
|
487
565
|
|
|
566
|
+
linewidth_in_points_per_track= pixels_per_track * point_per_pixels
|
|
567
|
+
|
|
488
568
|
log.write(" -plotting gene track..", verbose=verbose)
|
|
489
569
|
|
|
490
570
|
sig_gene_name = "Undefined"
|
|
@@ -517,8 +597,11 @@ def _plot_gene_track(
|
|
|
517
597
|
sig_gene_rights.append(gene_track_start_i+row["end"])
|
|
518
598
|
|
|
519
599
|
# plot gene line
|
|
600
|
+
## minimum width = 2 pixel
|
|
601
|
+
gene_line_width = max(linewidth_in_points_per_track/10, 2/pixels_per_point)
|
|
602
|
+
|
|
520
603
|
ax3.plot((gene_track_start_i+row["start"],gene_track_start_i+row["end"]),
|
|
521
|
-
(row["stack"]*2,row["stack"]*2),color=gene_color,linewidth=
|
|
604
|
+
(row["stack"]*2,row["stack"]*2),color=gene_color,linewidth=gene_line_width,solid_capstyle="butt")
|
|
522
605
|
|
|
523
606
|
# plot gene name
|
|
524
607
|
if row["end"] >= region[2]:
|
|
@@ -549,9 +632,12 @@ def _plot_gene_track(
|
|
|
549
632
|
exon_color = region_lead_grid_line["color"]
|
|
550
633
|
else:
|
|
551
634
|
exon_color="#020080"
|
|
552
|
-
|
|
635
|
+
|
|
636
|
+
## minimum width = 8 pixel
|
|
637
|
+
exon_line_width = max(linewidth_in_points_per_track * taf[3], 8/pixels_per_point)
|
|
638
|
+
|
|
553
639
|
ax3.plot((gene_track_start_i+row["start"],gene_track_start_i+row["end"]),
|
|
554
|
-
(row["stack"]*2,row["stack"]*2),linewidth=
|
|
640
|
+
(row["stack"]*2,row["stack"]*2),linewidth=exon_line_width,color=exon_color,solid_capstyle="butt")
|
|
555
641
|
|
|
556
642
|
log.write(" -Finished plotting gene track..", verbose=verbose)
|
|
557
643
|
|
|
@@ -573,7 +659,6 @@ def process_vcf(sumstats,
|
|
|
573
659
|
region_ld_threshold,
|
|
574
660
|
vcf_chr_dict,
|
|
575
661
|
tabix):
|
|
576
|
-
|
|
577
662
|
log.write("Start to load reference genotype...", verbose=verbose)
|
|
578
663
|
log.write(" -reference vcf path : "+ vcf_path, verbose=verbose)
|
|
579
664
|
|
|
@@ -631,7 +716,6 @@ def process_vcf(sumstats,
|
|
|
631
716
|
# figure out lead variant
|
|
632
717
|
lead_id = _get_lead_id(sumstats, region_ref_single, log, verbose)
|
|
633
718
|
|
|
634
|
-
|
|
635
719
|
lead_series = None
|
|
636
720
|
if lead_id is None:
|
|
637
721
|
|
|
@@ -685,6 +769,12 @@ def process_vcf(sumstats,
|
|
|
685
769
|
else:
|
|
686
770
|
log.write(" -Lead SNP not found in reference...", verbose=verbose)
|
|
687
771
|
sumstats[rsq]=None
|
|
772
|
+
|
|
773
|
+
#
|
|
774
|
+
try:
|
|
775
|
+
sumstats.loc[lead_id,rsq]=1
|
|
776
|
+
except KeyError:
|
|
777
|
+
pass
|
|
688
778
|
|
|
689
779
|
sumstats[rsq] = sumstats[rsq].astype("float")
|
|
690
780
|
sumstats[ld_single] = 0
|
|
@@ -716,7 +806,7 @@ def process_vcf(sumstats,
|
|
|
716
806
|
sumstats[final_ld_col] = 0
|
|
717
807
|
sumstats[final_shape_col] = 1
|
|
718
808
|
sumstats[final_rsq_col] = 0.0
|
|
719
|
-
|
|
809
|
+
|
|
720
810
|
if len(region_ref)==1:
|
|
721
811
|
if lead_id is not None:
|
|
722
812
|
sumstats.loc[lead_id, final_shape_col] +=1
|
|
@@ -729,6 +819,8 @@ def process_vcf(sumstats,
|
|
|
729
819
|
sumstats.loc[a_ngt_b, final_ld_col] = 100 * (i+1) + sumstats.loc[a_ngt_b, ld_single]
|
|
730
820
|
sumstats.loc[a_ngt_b, final_rsq_col] = sumstats.loc[a_ngt_b, current_rsq]
|
|
731
821
|
sumstats.loc[a_ngt_b, final_shape_col] = i + 1
|
|
822
|
+
|
|
823
|
+
sumstats = sumstats.dropna(subset=[pos,nea,ea])
|
|
732
824
|
####################################################################################################
|
|
733
825
|
log.write("Finished loading reference genotype successfully!", verbose=verbose)
|
|
734
826
|
return sumstats
|
gwaslab/viz_plot_rg_heatmap.py
CHANGED
|
@@ -37,7 +37,7 @@ def plot_rg(ldscrg,
|
|
|
37
37
|
corrections=None,
|
|
38
38
|
panno_texts=None,
|
|
39
39
|
equal_aspect=True,
|
|
40
|
-
cmap =
|
|
40
|
+
cmap = None,
|
|
41
41
|
full_cell =None,
|
|
42
42
|
log=Log(),
|
|
43
43
|
panno_args=None,
|
|
@@ -57,6 +57,11 @@ def plot_rg(ldscrg,
|
|
|
57
57
|
|
|
58
58
|
log.write("Start to create ldsc genetic correlation heatmap..." ,verbose=verbose)
|
|
59
59
|
# configure arguments
|
|
60
|
+
if cmap is None:
|
|
61
|
+
try: #matplotlib <3.9
|
|
62
|
+
cmap = matplotlib.cm.get_cmap('RdBu')
|
|
63
|
+
except:
|
|
64
|
+
cmap = matplotlib.colormaps.get_cmap('RdBu')
|
|
60
65
|
if fig_args is None:
|
|
61
66
|
fig_args = {"dpi":300}
|
|
62
67
|
if colorbar_args is None:
|
|
@@ -56,7 +56,7 @@ def plot_stacked_mqq( objects,
|
|
|
56
56
|
gtf=None,
|
|
57
57
|
gene_track_height=0.5,
|
|
58
58
|
fig_args=None,
|
|
59
|
-
region_hspace=0.
|
|
59
|
+
region_hspace=0.07,
|
|
60
60
|
subplot_height=4,
|
|
61
61
|
region_lead_grids = None,
|
|
62
62
|
region_lead_grid_line=None,
|
|
@@ -113,10 +113,10 @@ def plot_stacked_mqq( objects,
|
|
|
113
113
|
if region_ld_legends is None:
|
|
114
114
|
region_ld_legends = [0]
|
|
115
115
|
if title_args is None:
|
|
116
|
-
title_args = {"family":
|
|
116
|
+
title_args = {"family":font_family}
|
|
117
117
|
else:
|
|
118
118
|
if "family" not in title_args.keys():
|
|
119
|
-
title_args["family"] =
|
|
119
|
+
title_args["family"] = font_family
|
|
120
120
|
|
|
121
121
|
if save is not None:
|
|
122
122
|
if type(save) is not bool:
|
|
@@ -124,10 +124,17 @@ def plot_stacked_mqq( objects,
|
|
|
124
124
|
if save[-3:]=="pdf" or save[-3:]=="svg":
|
|
125
125
|
log.write(" -Adjusting options for saving as pdf/svg...",verbose=verbose)
|
|
126
126
|
fig_args["dpi"]=72
|
|
127
|
+
|
|
127
128
|
if "scatter_args" not in mqq_args.keys():
|
|
128
129
|
mqq_args["scatter_args"]={"rasterized":True}
|
|
129
130
|
else:
|
|
130
131
|
mqq_args["scatter_args"]["rasterized"] = True
|
|
132
|
+
|
|
133
|
+
if mode=="r":
|
|
134
|
+
if "scatter_args" not in mqq_args.keys():
|
|
135
|
+
mqq_args["scatter_args"]={"rasterized":False}
|
|
136
|
+
else:
|
|
137
|
+
mqq_args["scatter_args"]["rasterized"] = False
|
|
131
138
|
else:
|
|
132
139
|
fig_args["dpi"] = save_args["dpi"]
|
|
133
140
|
# create figure and axes ##################################################################################################################
|
|
@@ -178,7 +185,6 @@ def plot_stacked_mqq( objects,
|
|
|
178
185
|
##########################################################################################################################################
|
|
179
186
|
mqq_args_for_each_plot = _sort_args(mqq_args, n_plot)
|
|
180
187
|
|
|
181
|
-
|
|
182
188
|
##########################################################################################################################################
|
|
183
189
|
# get x axis dict
|
|
184
190
|
if mode=="m" or mode=="r":
|
|
@@ -364,10 +370,15 @@ def _add_new_y_label(mode, fig, gene_track_height,n_plot,subplot_height ,fontsiz
|
|
|
364
370
|
gene_track_height_ratio = gene_track_height/(gene_track_height + n_plot*subplot_height)
|
|
365
371
|
ylabel_height = (1 - gene_track_height_ratio)*0.5 + gene_track_height_ratio
|
|
366
372
|
if mode=="r":
|
|
367
|
-
fig.text(0.08, ylabel_height , "
|
|
373
|
+
fig.text(0.08, ylabel_height , "$\mathregular{-log_{10}(P)}$", va='center', rotation='vertical',
|
|
374
|
+
fontsize=fontsize,
|
|
375
|
+
family=font_family)
|
|
376
|
+
|
|
368
377
|
fig.text(0.93, ylabel_height, "Recombination rate(cM/Mb)", va='center', rotation=-90,fontsize=fontsize,family=font_family)
|
|
369
378
|
elif mode=="m":
|
|
370
|
-
fig.text(0.08, ylabel_height , "
|
|
379
|
+
fig.text(0.08, ylabel_height , "$\mathregular{-log_{10}(P)}$", va='center', rotation='vertical',
|
|
380
|
+
fontsize=fontsize,
|
|
381
|
+
family=font_family)
|
|
371
382
|
|
|
372
383
|
def _sort_args(mqq_args, n_plot):
|
|
373
384
|
mqq_args_for_each_plot={i:{} for i in range(n_plot)}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: gwaslab
|
|
3
|
-
Version: 3.5.
|
|
3
|
+
Version: 3.5.7
|
|
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/
|
|
@@ -8,7 +8,7 @@ Project-URL: Github, https://github.com/Cloufield/gwaslab
|
|
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
|
9
9
|
Classifier: License :: OSI Approved :: MIT License
|
|
10
10
|
Classifier: Operating System :: OS Independent
|
|
11
|
-
Requires-Python: <3.
|
|
11
|
+
Requires-Python: <3.13,>=3.9
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
License-File: LICENSE
|
|
14
14
|
License-File: LICENSE_before_v3.4.39
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
gwaslab/__init__.py,sha256=
|
|
1
|
+
gwaslab/__init__.py,sha256=2pIyLhHrPeyBYlcs3QsWElmUWPGIxoCf68awTk05YQk,2585
|
|
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
|
|
@@ -6,16 +6,17 @@ gwaslab/bd_get_hapmap3.py,sha256=FQpwbhWUPFT152QtiLevEkkN4YcVDIeKzoK0Uz1NlRo,410
|
|
|
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=QwXIqnjEd5v1jFRBFmeVlWJr3fO6Hx5hudLOgEf5fmc,39321
|
|
10
10
|
gwaslab/g_SumstatsPair.py,sha256=71fPfwhr9pdH9pdyX17bSEu8ah_WVpTVU0nc_4uln4Y,8766
|
|
11
|
+
gwaslab/g_SumstatsSet.py,sha256=AiTISWPfmu8NTGa8j9Yuts8DNw1pEUENYyPoS0HXp5I,29866
|
|
11
12
|
gwaslab/g_SumstatsT.py,sha256=u_DighLMnMxwTLnqm-B58pA0G6WXRj6pudPyKMVKjSU,2133
|
|
12
13
|
gwaslab/g_Sumstats_summary.py,sha256=FECvvFXJVKaCX5dggBvvk9YvJ6AbdbcLfjltysX7wEE,6380
|
|
13
14
|
gwaslab/g_headers.py,sha256=Q37MZgc2G1bMzzJX94Kq6GoRYJyfUxQX50CvyIerXww,6524
|
|
14
15
|
gwaslab/g_meta.py,sha256=Orj8WhFvbylDmaAp9Px_GRUoyEBVML8MLa9829sNM0o,2588
|
|
15
16
|
gwaslab/g_vchange_status.py,sha256=w3zsYYOcCaI3PTeboonvkQjudzUAfVIgATzRdiPViZs,1939
|
|
16
|
-
gwaslab/g_version.py,sha256=
|
|
17
|
+
gwaslab/g_version.py,sha256=AdCrtpOcYXhFe4LFCH2xi4r0VT1oQG7Coqhyl842u8w,1889
|
|
17
18
|
gwaslab/hm_casting.py,sha256=FqP4EQl83Q2OKLw004OgLIvUH795TVCGwziLk5jsHqY,11368
|
|
18
|
-
gwaslab/hm_harmonize_sumstats.py,sha256=
|
|
19
|
+
gwaslab/hm_harmonize_sumstats.py,sha256=ymM33bwOOkLteiLXUuSSzURudgCrkVMTR7wUwXf1jQs,84381
|
|
19
20
|
gwaslab/hm_rsid_to_chrpos.py,sha256=ODWREO0jPN0RAfNzL5fRzSRANfhiksOvUVPuEsFZQqA,6552
|
|
20
21
|
gwaslab/io_preformat_input.py,sha256=cfoywijnk1z1QeTMOXL_lqcheI3GA_Ff4uOUNxAqCq4,25331
|
|
21
22
|
gwaslab/io_process_args.py,sha256=0ljJOVGsD7qPuBLvdfvR7Vrh7zXPlvfPg-rhOw8xRpQ,1366
|
|
@@ -31,13 +32,13 @@ gwaslab/ldsc_parse.py,sha256=MBnfgcWlV4oHp9MoDRh1mpilaHhAR15Af77hMFn4-5k,10564
|
|
|
31
32
|
gwaslab/ldsc_regressions.py,sha256=yzbGjgNV7u-SWXNPsh9S8y9mK97Bim_Nmad9G9V18ZU,30078
|
|
32
33
|
gwaslab/ldsc_sumstats.py,sha256=O0olsDxKlh1MJ1gAuEN1t40rxhajOEwOQ20ak7xoDrI,26245
|
|
33
34
|
gwaslab/qc_check_datatype.py,sha256=mAM0LCMf9LseX44oeELG0croPlxfp7U8A8TH-Y5F6kQ,4453
|
|
34
|
-
gwaslab/qc_fix_sumstats.py,sha256=
|
|
35
|
+
gwaslab/qc_fix_sumstats.py,sha256=4lXedhYGsd6BAoApBr7kEly_GbVdcXgBQXMB5X2iN70,98262
|
|
35
36
|
gwaslab/run_script.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
36
37
|
gwaslab/util_abf_finemapping.py,sha256=LRcopjtkT-iXtKPAJIzR4qjPdhD7nrS_BGit4EW89FM,3054
|
|
37
38
|
gwaslab/util_ex_calculate_ldmatrix.py,sha256=Z_spxbq6SHDS0v84I59YTTF40iyLQIOZbt0dmEcNJjw,15417
|
|
38
39
|
gwaslab/util_ex_calculate_prs.py,sha256=9uJ588Sdj4V0vw3OZ9NeLECwOvW67f0IdLandVPS5RY,9442
|
|
39
40
|
gwaslab/util_ex_gwascatalog.py,sha256=--Gde9HrsikfYTeFqSaYz0gUODr9wmv_gV6GZGNlElg,7688
|
|
40
|
-
gwaslab/util_ex_ldproxyfinder.py,sha256=
|
|
41
|
+
gwaslab/util_ex_ldproxyfinder.py,sha256=HadmnjEv5EvZCHR5SFSAbqxZWJryEErJftCS0WhZUbs,16898
|
|
41
42
|
gwaslab/util_ex_ldsc.py,sha256=dMfL7hej0JzTOafPk6VYl5HUxB3eSp28wUKVWliIhlE,18937
|
|
42
43
|
gwaslab/util_ex_plink_filter.py,sha256=pK1Yxtv9-J4rMOdVAG7VU9PktvI6-y4FxBiVEH0QuRs,1673
|
|
43
44
|
gwaslab/util_ex_process_h5.py,sha256=ynFvo3zxgvOxWYL565v2IQf8P6iEuq7UlKQ_ULxrd6Y,2831
|
|
@@ -50,10 +51,11 @@ gwaslab/util_in_calculate_gc.py,sha256=MWOXVzJv7SZx4i2_ncRiqsiEOADc7EfghaUzgGy4j
|
|
|
50
51
|
gwaslab/util_in_calculate_power.py,sha256=JfHJFg3tNF0f4NHgWlzVW2mSxCiP07mAHIyEfVfxTak,10360
|
|
51
52
|
gwaslab/util_in_convert_h2.py,sha256=a8Cbudt3xn9WP2bPc-7ysuowB-LYub8j8GeDXl7Lk7Q,6483
|
|
52
53
|
gwaslab/util_in_correct_winnerscurse.py,sha256=Gp--yAQ8MMzdkWIvXP9C1BHVjZc-YzqHfYWhAj19w9w,2110
|
|
53
|
-
gwaslab/util_in_fill_data.py,sha256=
|
|
54
|
-
gwaslab/util_in_filter_value.py,sha256=
|
|
54
|
+
gwaslab/util_in_fill_data.py,sha256=ZXdxRD7oUpQ-uG_5EVsS994rA1n3PqLbZ2TxOKz379w,15762
|
|
55
|
+
gwaslab/util_in_filter_value.py,sha256=KnHazy2Z3wSLULFRfp-Sm7TQ2gGLqU6kxnkhETgVPPg,26501
|
|
55
56
|
gwaslab/util_in_get_density.py,sha256=kpKXH69acMkeYVG5vs-VbJC3COhmuLBfYco-wuOxgjc,3934
|
|
56
57
|
gwaslab/util_in_get_sig.py,sha256=53NOh7KueLY3vJPTNhhb37KPAIgLEfcP3k2zIV61lc4,39845
|
|
58
|
+
gwaslab/util_in_merge.py,sha256=KB5VKRTUUZ1XGYUxgCP_l3cWYanjthMdwiZ_DincCZQ,2020
|
|
57
59
|
gwaslab/util_in_meta.py,sha256=5K9lIZcIgUy0AERqHy1GvMN2X6dp45JUUgopuDLgt4o,11284
|
|
58
60
|
gwaslab/util_in_snphwe.py,sha256=-KpIDx6vn_nah6H55IkV2OyjXQVXV13XyBL069WE1wM,1751
|
|
59
61
|
gwaslab/viz_aux_annotate_plot.py,sha256=3PyBioC-3ZBzqKT2JRv6vp-hZUXSqTTePIT5cblEvnQ,25334
|
|
@@ -61,21 +63,22 @@ gwaslab/viz_aux_chromatin.py,sha256=aWZaXOSvGyZY7wQcoFDaqHRYCSHZbi_K4Q70HruN9ts,
|
|
|
61
63
|
gwaslab/viz_aux_property.py,sha256=UIaivghnLXYpTwkKnXRK0F28Jbn9L6OaICk3K73WZaU,33
|
|
62
64
|
gwaslab/viz_aux_quickfix.py,sha256=cGX5i3WBmvKIiqck8V00caDg-pvKOO709Ux3DBXsUrM,18693
|
|
63
65
|
gwaslab/viz_aux_reposition_text.py,sha256=iRIP-Rkltlei068HekJcVubiqPrunBqvAoSQ1eHk04M,4304
|
|
64
|
-
gwaslab/viz_aux_save_figure.py,sha256=
|
|
66
|
+
gwaslab/viz_aux_save_figure.py,sha256=HwIRDMYpeXfkBgb7mqzLN7OVPMz163U-ZVOlQJABzeg,2811
|
|
65
67
|
gwaslab/viz_plot_compare_af.py,sha256=qtXW45-Sq_ugK8ZfqBYMpmf58SKi3lB3YyHnzn_akcE,5344
|
|
66
68
|
gwaslab/viz_plot_compare_effect.py,sha256=kq-rVWygHEeTBMOtd_jk8nK85ClZHU-ADSf4nI2gTKo,66604
|
|
67
69
|
gwaslab/viz_plot_credible_sets.py,sha256=KxB7_bkDrLMgs6sk8HAnZWkllIRH-lEDCz5n5_Jnw68,3550
|
|
70
|
+
gwaslab/viz_plot_effect.py,sha256=7p3YnGcgIG0ajwQSNCiHlmX9BvEeClwvQ-DhPe5LzSI,9750
|
|
68
71
|
gwaslab/viz_plot_forestplot.py,sha256=xgOnefh737CgdQxu5naVyRNBX1NQXPFKzf51fbh6afs,6771
|
|
69
72
|
gwaslab/viz_plot_miamiplot.py,sha256=rCFEp7VNuVqeBBG3WRkmFAtFklbF79BvIQQYiSY70VY,31238
|
|
70
|
-
gwaslab/viz_plot_miamiplot2.py,sha256=
|
|
71
|
-
gwaslab/viz_plot_mqqplot.py,sha256=
|
|
73
|
+
gwaslab/viz_plot_miamiplot2.py,sha256=tr3vRq6NLmoVoOSYbUkvXMHRONLLrvqjkRYN1iSX5-I,16214
|
|
74
|
+
gwaslab/viz_plot_mqqplot.py,sha256=VIlAFL0lq4nEzqMh17I9d9u6HjCX3Jku69XHwIm1Fmw,69836
|
|
72
75
|
gwaslab/viz_plot_phe_heatmap.py,sha256=qoXVeFTIm-n8IinNbDdPFVBSz2yGCGK6QzTstXv6aj4,9532
|
|
73
76
|
gwaslab/viz_plot_qqplot.py,sha256=psQgVpP29686CEZkzQz0iRbApzqy7aE3GGiBcazVvNw,7247
|
|
74
|
-
gwaslab/viz_plot_regional2.py,sha256=
|
|
77
|
+
gwaslab/viz_plot_regional2.py,sha256=EcLHhdWMj3YPtN-YOkXG9W6qf-lktTFlRMFRRQvY9kA,43106
|
|
75
78
|
gwaslab/viz_plot_regionalplot.py,sha256=8u-5-yfy-UaXhaxVVz3Y5k2kBAoqzczUw1hyyD450iI,37983
|
|
76
|
-
gwaslab/viz_plot_rg_heatmap.py,sha256=
|
|
79
|
+
gwaslab/viz_plot_rg_heatmap.py,sha256=z-G4gxK5-H_e13jV8RQnNzXPrKSQ0c7q41-KpMrA-cs,13861
|
|
77
80
|
gwaslab/viz_plot_scatter_with_reg.py,sha256=PmUZDQl2q4Dme3HLPXEwf_TrMjwJADA-uFXNDBWUEa4,8333
|
|
78
|
-
gwaslab/viz_plot_stackedregional.py,sha256=
|
|
81
|
+
gwaslab/viz_plot_stackedregional.py,sha256=gt-pj4c4AMgmlNgOCKlpCWJN1iU_Z5NYljITRc-OyI4,19032
|
|
79
82
|
gwaslab/viz_plot_trumpetplot.py,sha256=y4sAFjzMaSLuWrdr9_ao-wPYCK5DlP2ykiqulWsoN_k,42680
|
|
80
83
|
gwaslab/data/formatbook.json,sha256=N2nJs80HH98Rsu9FxaSvIQO9J5yIV97WEtAKjRqYwiY,38207
|
|
81
84
|
gwaslab/data/reference.json,sha256=IrjwFnXjrpVUp3zYfcYClpibJE9Y-94gtrC1Aw8sXxg,12332
|
|
@@ -85,9 +88,9 @@ gwaslab/data/hapmap3_SNPs/hapmap3_db150_hg19.snplist.gz,sha256=qD9RsC5S2h6l-OdpW
|
|
|
85
88
|
gwaslab/data/hapmap3_SNPs/hapmap3_db151_hg38.snplist.gz,sha256=Y8ZT2FIAhbhlgCJdE9qQVAiwnV_fcsPt72usBa7RSBM,10225828
|
|
86
89
|
gwaslab/data/high_ld/high_ld_hla_hg19.bed.gz,sha256=R7IkssKu0L4WwkU9SrS84xCMdrkkKL0gnTNO_OKbG0Y,219
|
|
87
90
|
gwaslab/data/high_ld/high_ld_hla_hg38.bed.gz,sha256=76CIU0pibDJ72Y6UY-TbIKE9gEPwTELAaIbCXyjm80Q,470
|
|
88
|
-
gwaslab-3.5.
|
|
89
|
-
gwaslab-3.5.
|
|
90
|
-
gwaslab-3.5.
|
|
91
|
-
gwaslab-3.5.
|
|
92
|
-
gwaslab-3.5.
|
|
93
|
-
gwaslab-3.5.
|
|
91
|
+
gwaslab-3.5.7.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
92
|
+
gwaslab-3.5.7.dist-info/LICENSE_before_v3.4.39,sha256=GhLOU_1UDEKeOacYhsRN_m9u-eIuVTazSndZPeNcTZA,1066
|
|
93
|
+
gwaslab-3.5.7.dist-info/METADATA,sha256=QKvLYkpRCauJ2uiVpd7xfO_w9DEKg4qsM_CiSRfcUkQ,7750
|
|
94
|
+
gwaslab-3.5.7.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
|
|
95
|
+
gwaslab-3.5.7.dist-info/top_level.txt,sha256=PyY6hWtrALpv2MAN3kjkIAzJNmmBTH5a2risz9KwH08,8
|
|
96
|
+
gwaslab-3.5.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|