gwaslab 3.4.24__tar.gz → 3.4.25__tar.gz
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-3.4.24/src/gwaslab.egg-info → gwaslab-3.4.25}/PKG-INFO +3 -3
- {gwaslab-3.4.24 → gwaslab-3.4.25}/README.md +1 -1
- {gwaslab-3.4.24 → gwaslab-3.4.25}/pyproject.toml +3 -3
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/Sumstats.py +2 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/compare_effect.py +2 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/download.py +7 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/fixdata.py +1 -1
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/mqqplot.py +86 -32
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/read_ldsc.py +46 -42
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/to_formats.py +7 -2
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/trumpetplot.py +9 -3
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/version.py +2 -2
- {gwaslab-3.4.24 → gwaslab-3.4.25/src/gwaslab.egg-info}/PKG-INFO +3 -3
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab.egg-info/requires.txt +1 -1
- {gwaslab-3.4.24 → gwaslab-3.4.25}/LICENSE +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/setup.cfg +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/CommonData.py +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/Log.py +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/Phenotypes.py +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/SumstatsMT.py +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/Sumstatssummary.py +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/__init__.py +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/annotategenename.py +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/annotateplot.py +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/calculate_gc.py +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/calculate_power.py +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/compare_af.py +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/config.py +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/data/chrx_par/chrx_par_hg19.bed.gz +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/data/chrx_par/chrx_par_hg38.bed.gz +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/data/formatbook.json +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/data/hapmap3_SNPs/hapmap3_db150_hg19.snplist.gz +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/data/hapmap3_SNPs/hapmap3_db151_hg38.snplist.gz +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/data/high_ld/high_ld_hla_hg19.bed.gz +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/data/high_ld/high_ld_hla_hg38.bed.gz +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/data/reference.json +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/datatype_check.py +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/figuresave.py +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/fill.py +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/filtervalue.py +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/get_hapmap3.py +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/getdensity.py +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/getsig.py +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/gwascatalog.py +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/h2_conversion.py +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/meta.py +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/metaanalysis.py +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/miamiplot.py +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/plotrg.py +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/preformat_input.py +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/processdata.py +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/qqplot.py +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/quickfix.py +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/regionalplot.py +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/retrievedata.py +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/rsID2chrpos.py +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/textreposition.py +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/to_pickle.py +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/vchangestatus.py +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/winnerscurse.py +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab.egg-info/SOURCES.txt +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab.egg-info/dependency_links.txt +0 -0
- {gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: gwaslab
|
|
3
|
-
Version: 3.4.
|
|
3
|
+
Version: 3.4.25
|
|
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:
|
|
11
|
+
Requires-Python: <=3.9,>=3.8
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
License-File: LICENSE
|
|
14
14
|
|
|
@@ -32,7 +32,7 @@ Note: GWASLab is being updated very frequently for now. I will release the first
|
|
|
32
32
|
## Install
|
|
33
33
|
|
|
34
34
|
```
|
|
35
|
-
pip install gwaslab==3.4.
|
|
35
|
+
pip install gwaslab==3.4.24
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
|
|
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
|
|
|
7
7
|
|
|
8
8
|
[project]
|
|
9
9
|
name = "gwaslab"
|
|
10
|
-
version = "3.4.
|
|
10
|
+
version = "3.4.25"
|
|
11
11
|
authors = [
|
|
12
12
|
{ name="Yunye", email="yunye@gwaslab.com" },
|
|
13
13
|
]
|
|
@@ -18,7 +18,7 @@ readme = "README.md"
|
|
|
18
18
|
dependencies = [
|
|
19
19
|
"pandas>=1.3,<1.5",
|
|
20
20
|
"numpy>=1.21.2",
|
|
21
|
-
"matplotlib>=3.5",
|
|
21
|
+
"matplotlib>=3.5,<=3.7.1",
|
|
22
22
|
"seaborn>=0.11.1",
|
|
23
23
|
"scipy>=1.6.2",
|
|
24
24
|
"pySAM>=0.18.1,<0.20",
|
|
@@ -31,7 +31,7 @@ dependencies = [
|
|
|
31
31
|
"gtfparse==1.3.0"
|
|
32
32
|
]
|
|
33
33
|
|
|
34
|
-
requires-python = ">=3.8"
|
|
34
|
+
requires-python = ">=3.8,<=3.9"
|
|
35
35
|
classifiers = [
|
|
36
36
|
"Programming Language :: Python :: 3",
|
|
37
37
|
"License :: OSI Approved :: MIT License",
|
|
@@ -605,6 +605,7 @@ class Sumstats():
|
|
|
605
605
|
build="19",
|
|
606
606
|
n=None,
|
|
607
607
|
verbose=True,
|
|
608
|
+
no_status=False,
|
|
608
609
|
output_log=True,
|
|
609
610
|
to_csvargs=None,
|
|
610
611
|
float_formats=None,
|
|
@@ -713,6 +714,7 @@ class Sumstats():
|
|
|
713
714
|
suffix=suffix,
|
|
714
715
|
build=build,
|
|
715
716
|
verbose=True,
|
|
717
|
+
no_status=no_status,
|
|
716
718
|
log=onetime_log,
|
|
717
719
|
to_csvargs=to_csvargs,
|
|
718
720
|
chr_prefix=chr_prefix,
|
|
@@ -728,6 +728,8 @@ def compare_effect(path1,
|
|
|
728
728
|
if verbose:log.write(" -Beta_se = ", reg[4])
|
|
729
729
|
#if verbose:log.write(" -H0 beta = ", null_beta, ", recalculated p = ", "{:.2e}".format(p))
|
|
730
730
|
if verbose:log.write(" -H0 beta = 0",", default p = ", "{:.2e}".format(reg[3]))
|
|
731
|
+
if verbose:log.write(" -Peason correlation coefficient = ", "{:.2f}".format(reg[2]))
|
|
732
|
+
if verbose:log.write(" -r2 = ", "{:.2f}".format(reg[2]**2))
|
|
731
733
|
if r_se==True:
|
|
732
734
|
if verbose:log.write(" -R se (jackknife) = {:.2e}".format(r_se_jackknife))
|
|
733
735
|
|
|
@@ -185,6 +185,7 @@ def get_path(name,log=Log(),verbose=True):
|
|
|
185
185
|
def download_ref(name,
|
|
186
186
|
directory=None,
|
|
187
187
|
local_filename=None,
|
|
188
|
+
overwrite=False,
|
|
188
189
|
log=Log()):
|
|
189
190
|
'''
|
|
190
191
|
Download the reference file for a given keyword. Url are retrieved from the reference.json file.
|
|
@@ -214,6 +215,9 @@ def download_ref(name,
|
|
|
214
215
|
# if existing in default path
|
|
215
216
|
if search_local(local_path) == True:
|
|
216
217
|
log.write(" -File {} exists.".format(local_path))
|
|
218
|
+
if overwrite == True:
|
|
219
|
+
log.write(" -Overwriting the existing file.")
|
|
220
|
+
download_file(url,local_path)
|
|
217
221
|
else:
|
|
218
222
|
download_file(url,local_path)
|
|
219
223
|
|
|
@@ -234,6 +238,9 @@ def download_ref(name,
|
|
|
234
238
|
try:
|
|
235
239
|
if search_local(local_path+".tbi") == True:
|
|
236
240
|
log.write(" -File {} exists.".format(local_path+".tbi"))
|
|
241
|
+
if overwrite == True:
|
|
242
|
+
log.write(" -Overwriting the existing file.")
|
|
243
|
+
download_file(tbi_url,local_path+".tbi")
|
|
237
244
|
else:
|
|
238
245
|
download_file(tbi_url,local_path+".tbi")
|
|
239
246
|
#download_file(tbi_url, local_path+".tbi")
|
|
@@ -229,7 +229,7 @@ def mqqplot(insumstats,
|
|
|
229
229
|
if highlight_anno_args is None:
|
|
230
230
|
highlight_anno_args = {}
|
|
231
231
|
if pinpoint is None:
|
|
232
|
-
pinpoint = list()
|
|
232
|
+
pinpoint = list()
|
|
233
233
|
if build is None:
|
|
234
234
|
build = "19"
|
|
235
235
|
if scatter_kwargs is None:
|
|
@@ -255,10 +255,25 @@ def mqqplot(insumstats,
|
|
|
255
255
|
if len(anno_set)>0 and ("m" in mode):
|
|
256
256
|
if verbose: log.write(" -Variants to annotate : "+",".join(anno_set))
|
|
257
257
|
if len(highlight)>0 and ("m" in mode):
|
|
258
|
-
if
|
|
259
|
-
|
|
258
|
+
if pd.api.types.is_list_like(highlight[0]):
|
|
259
|
+
if len(highlight[0]) == len(highlight_color):
|
|
260
|
+
log.write(" -WARNING: number of locus list does not match number of colors !!!")
|
|
261
|
+
for i, highlight_set in enumerate(highlight):
|
|
262
|
+
if verbose: log.write(" -Set {} loci to highlight ({}) : ".format(i+1, highlight_color[i%len(highlight_color)])+",".join(highlight_set))
|
|
263
|
+
if verbose: log.write(" -Highlight_window is set to: ", highlight_windowkb, " kb")
|
|
264
|
+
else:
|
|
265
|
+
if verbose: log.write(" -Loci to highlight ({}): ".format(highlight_color)+",".join(highlight))
|
|
266
|
+
if verbose: log.write(" -Highlight_window is set to: ", highlight_windowkb, " kb")
|
|
267
|
+
|
|
260
268
|
if len(pinpoint)>0 :
|
|
261
|
-
if
|
|
269
|
+
if pd.api.types.is_list_like(pinpoint[0]):
|
|
270
|
+
if len(pinpoint[0]) == len(pinpoint_color):
|
|
271
|
+
log.write(" -WARNING: number of variant list does not match number of colors !!!")
|
|
272
|
+
for i, pinpoint_set in enumerate(pinpoint):
|
|
273
|
+
if verbose: log.write(" -Set {} variants to pinpoint ({}) : ".format(i+1,pinpoint_color[i%len(pinpoint_color)])+",".join(pinpoint_set))
|
|
274
|
+
else:
|
|
275
|
+
if verbose: log.write(" -Variants to pinpoint ({}) : ".format(pinpoint_color)+",".join(pinpoint))
|
|
276
|
+
|
|
262
277
|
if region is not None:
|
|
263
278
|
if verbose: log.write(" -Region to plot : chr"+str(region[0])+":"+str(region[1])+"-"+str(region[2])+".")
|
|
264
279
|
|
|
@@ -425,8 +440,9 @@ def mqqplot(insumstats,
|
|
|
425
440
|
eaf_raw = sumstats["MAF"].copy()
|
|
426
441
|
|
|
427
442
|
if len(highlight)>0 and ("m" in mode):
|
|
428
|
-
sumstats["HUE"] =
|
|
429
|
-
|
|
443
|
+
sumstats["HUE"] = pd.NA
|
|
444
|
+
sumstats["HUE"] = sumstats["HUE"].astype("Int64")
|
|
445
|
+
|
|
430
446
|
if verbose: log.write("Finished loading specified columns from the sumstats.")
|
|
431
447
|
|
|
432
448
|
|
|
@@ -451,15 +467,27 @@ def mqqplot(insumstats,
|
|
|
451
467
|
|
|
452
468
|
## Highlight
|
|
453
469
|
if len(highlight)>0 and ("m" in mode or "r" in mode):
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
470
|
+
if pd.api.types.is_list_like(highlight[0]):
|
|
471
|
+
for i, highlight_set in enumerate(highlight):
|
|
472
|
+
to_highlight = sumstats.loc[sumstats[snpid].isin(highlight_set),:]
|
|
473
|
+
#assign colors: 0 is hightlight color
|
|
474
|
+
for index,row in to_highlight.iterrows():
|
|
475
|
+
target_chr = int(row[chrom])
|
|
476
|
+
target_pos = int(row[pos])
|
|
477
|
+
right_chr=sumstats[chrom]==target_chr
|
|
478
|
+
up_pos=sumstats[pos]>target_pos-highlight_windowkb*1000
|
|
479
|
+
low_pos=sumstats[pos]<target_pos+highlight_windowkb*1000
|
|
480
|
+
sumstats.loc[right_chr&up_pos&low_pos,"HUE"]=i
|
|
481
|
+
else:
|
|
482
|
+
to_highlight = sumstats.loc[sumstats[snpid].isin(highlight),:]
|
|
483
|
+
#assign colors: 0 is hightlight color
|
|
484
|
+
for index,row in to_highlight.iterrows():
|
|
485
|
+
target_chr = int(row[chrom])
|
|
486
|
+
target_pos = int(row[pos])
|
|
487
|
+
right_chr=sumstats[chrom]==target_chr
|
|
488
|
+
up_pos=sumstats[pos]>target_pos-highlight_windowkb*1000
|
|
489
|
+
low_pos=sumstats[pos]<target_pos+highlight_windowkb*1000
|
|
490
|
+
sumstats.loc[right_chr&up_pos&low_pos,"HUE"]=0
|
|
463
491
|
|
|
464
492
|
# Density #####################################################################################################
|
|
465
493
|
if "b" in mode and "DENSITY" not in sumstats.columns:
|
|
@@ -612,18 +640,33 @@ def mqqplot(insumstats,
|
|
|
612
640
|
sizes=marker_size,
|
|
613
641
|
linewidth=linewidth,
|
|
614
642
|
zorder=2,ax=ax1,edgecolor=edgecolor, **scatter_kwargs)
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
643
|
+
if pd.api.types.is_list_like(highlight[0]):
|
|
644
|
+
for i, highlight_set in enumerate(highlight):
|
|
645
|
+
if verbose: log.write(" -Highlighting set {} target loci...".format(i+1))
|
|
646
|
+
print(sumstats["HUE"].dtype)
|
|
647
|
+
sns.scatterplot(data=sumstats.loc[sumstats["HUE"]==i], x='i', y='scaled_P',
|
|
648
|
+
hue="HUE",
|
|
649
|
+
palette={i:highlight_color[i%len(highlight_color)]},
|
|
650
|
+
legend=legend,
|
|
651
|
+
style=style,
|
|
652
|
+
size="s",
|
|
653
|
+
sizes=(marker_size[0]+1,marker_size[1]+1),
|
|
654
|
+
linewidth=linewidth,
|
|
655
|
+
zorder=3+i,ax=ax1,edgecolor=edgecolor,**scatter_kwargs)
|
|
656
|
+
highlight_i = sumstats.loc[~sumstats["HUE"].isna(),"i"].values
|
|
657
|
+
else:
|
|
658
|
+
if verbose: log.write(" -Highlighting target loci...")
|
|
659
|
+
sns.scatterplot(data=sumstats.loc[sumstats["HUE"]==0], x='i', y='scaled_P',
|
|
660
|
+
hue="HUE",
|
|
661
|
+
palette={0:highlight_color},
|
|
662
|
+
legend=legend,
|
|
663
|
+
style=style,
|
|
664
|
+
size="s",
|
|
665
|
+
sizes=(marker_size[0]+1,marker_size[1]+1),
|
|
666
|
+
linewidth=linewidth,
|
|
667
|
+
zorder=3,ax=ax1,edgecolor=edgecolor,**scatter_kwargs)
|
|
668
|
+
# for annotate
|
|
669
|
+
highlight_i = sumstats.loc[sumstats[snpid].isin(highlight),"i"].values
|
|
627
670
|
|
|
628
671
|
## if not highlight
|
|
629
672
|
else:
|
|
@@ -673,12 +716,23 @@ def mqqplot(insumstats,
|
|
|
673
716
|
|
|
674
717
|
## if pinpoint variants
|
|
675
718
|
if (len(pinpoint)>0):
|
|
676
|
-
if
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
719
|
+
if pd.api.types.is_list_like(pinpoint[0]):
|
|
720
|
+
for i, pinpoint_set in enumerate(pinpoint):
|
|
721
|
+
if sum(sumstats[snpid].isin(pinpoint_set))>0:
|
|
722
|
+
to_pinpoint = sumstats.loc[sumstats[snpid].isin(pinpoint_set),:]
|
|
723
|
+
if verbose: log.write(" -Pinpointing set {} target vairants...".format(i+1))
|
|
724
|
+
ax1.scatter(to_pinpoint["i"],to_pinpoint["scaled_P"],color=pinpoint_color[i%len(pinpoint_color)],zorder=100,s=marker_size[1]+1)
|
|
725
|
+
else:
|
|
726
|
+
if verbose: log.write(" -Target vairants to pinpoint were not found. Skip pinpointing process...")
|
|
680
727
|
else:
|
|
681
|
-
if
|
|
728
|
+
if sum(sumstats[snpid].isin(pinpoint))>0:
|
|
729
|
+
to_pinpoint = sumstats.loc[sumstats[snpid].isin(pinpoint),:]
|
|
730
|
+
if verbose: log.write(" -Pinpointing target vairants...")
|
|
731
|
+
ax1.scatter(to_pinpoint["i"],to_pinpoint["scaled_P"],color=pinpoint_color,zorder=100,s=marker_size[1]+1)
|
|
732
|
+
else:
|
|
733
|
+
if verbose: log.write(" -Target vairants to pinpoint were not found. Skip pinpointing process...")
|
|
734
|
+
|
|
735
|
+
|
|
682
736
|
|
|
683
737
|
#ax1.set_xticks(chrom_df.astype("float64"))
|
|
684
738
|
#ax1.set_xticklabels(chrom_df.index.astype("Int64").map(xtick_chr_dict),fontsize=fontsize,family=font_family)
|
|
@@ -105,52 +105,56 @@ def read_popcorn(filelist=[]):
|
|
|
105
105
|
#h2 mode
|
|
106
106
|
#####################################################################
|
|
107
107
|
summary = pd.DataFrame(columns = ["Filename", 'sfile1', 'sfile2', 'mode', 'pg', 'pg_se','pg_z','pg_p', 'h1^2', 'h1^2_se','h1^2_z','h1^2_p', 'h2^2', 'h2^2_se','h2^2_z','h2^2_p'])
|
|
108
|
-
|
|
108
|
+
|
|
109
109
|
for index, ldscfile in enumerate(filelist):
|
|
110
110
|
print("Loading file "+str(index+1)+" :" + ldscfile +" ...")
|
|
111
|
-
|
|
111
|
+
|
|
112
112
|
row={}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
line = file.readline()
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
113
|
+
try:
|
|
114
|
+
with open(ldscfile,"r") as file:
|
|
115
|
+
row["Filename"]=ldscfile.split("/")[-1]
|
|
116
|
+
line=""
|
|
117
|
+
while not re.compile('^Invoking command').match(line):
|
|
118
|
+
line = file.readline()
|
|
119
|
+
if not line: break
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
## first line h2 se
|
|
123
|
+
objects = re.compile('--sfile1 ([^\s]+) --sfile2 ([^\s]+)[ /n]').findall(line)
|
|
124
|
+
row["sfile1"]=objects[0][0]
|
|
125
|
+
row["sfile2"]=objects[0][1]
|
|
126
|
+
|
|
127
|
+
#while not re.compile(r'^Jackknife iter:').match(line):
|
|
128
|
+
# line = file.readline()
|
|
129
|
+
# print(line)
|
|
130
|
+
# if not line: break
|
|
131
|
+
while not re.compile(r'P \(Z\)').findall(line.strip()):
|
|
132
|
+
line = file.readline()
|
|
133
|
+
if not line: break
|
|
134
|
+
|
|
135
|
+
#objects = re.compile('[a-zA-Z\s\d]+:|[-0-9.]+[e]?[-0-9.]+|NA').findall(file.readline())
|
|
136
|
+
objects = file.readline().split()
|
|
137
|
+
row["h1^2"] = objects[1]
|
|
138
|
+
row["h1^2_se"] = objects[2]
|
|
139
|
+
row["h1^2_z"] = objects[3]
|
|
140
|
+
row["h1^2_p"] = objects[4]
|
|
141
|
+
|
|
142
|
+
objects = file.readline().split()
|
|
143
|
+
row["h2^2"] = objects[1]
|
|
144
|
+
row["h2^2_se"] = objects[2]
|
|
145
|
+
row["h2^2_z"] = objects[3]
|
|
146
|
+
row["h2^2_p"] = objects[4]
|
|
147
|
+
|
|
148
|
+
objects = file.readline().split()
|
|
149
|
+
row["mode"] = objects[0]
|
|
150
|
+
row["pg"] = objects[1]
|
|
151
|
+
row["pg_se"] = objects[2]
|
|
152
|
+
row["pg_z"] = objects[3]
|
|
153
|
+
row["pg_p"] = objects[4]
|
|
154
|
+
except:
|
|
155
|
+
continue
|
|
152
156
|
|
|
153
157
|
#summary = summary.append(row,ignore_index=True)
|
|
154
158
|
row = pd.DataFrame([row], columns = summary.columns)
|
|
155
159
|
summary = pd.concat([summary, row], ignore_index=True)
|
|
156
|
-
return summary
|
|
160
|
+
return summary
|
|
@@ -36,6 +36,7 @@ def tofmt(sumstats,
|
|
|
36
36
|
bgzip=False,
|
|
37
37
|
tabix=False,
|
|
38
38
|
verbose=True,
|
|
39
|
+
no_status=False,
|
|
39
40
|
log=Log(),
|
|
40
41
|
to_csvargs=None):
|
|
41
42
|
|
|
@@ -50,7 +51,7 @@ def tofmt(sumstats,
|
|
|
50
51
|
if verbose: log.write(" - Start outputting sumstats in "+fmt+" format...")
|
|
51
52
|
|
|
52
53
|
if "CHR" in sumstats.columns:
|
|
53
|
-
if xymt_number is False and sumstats["CHR"]
|
|
54
|
+
if xymt_number is False and pd.api.types.is_integer_dtype(sumstats["CHR"]):
|
|
54
55
|
sumstats["CHR"]= sumstats["CHR"].map(get_number_to_chr(xymt=xymt,prefix=chr_prefix))
|
|
55
56
|
elif chr_prefix is not None:
|
|
56
57
|
sumstats["CHR"]= chr_prefix + sumstats["CHR"].astype("string")
|
|
@@ -364,7 +365,11 @@ def tofmt(sumstats,
|
|
|
364
365
|
ouput_cols.append(i)
|
|
365
366
|
# + additional cols
|
|
366
367
|
ouput_cols = ouput_cols + cols
|
|
367
|
-
|
|
368
|
+
try:
|
|
369
|
+
if no_status == True:
|
|
370
|
+
ouput_cols.remove("STATUS")
|
|
371
|
+
except:
|
|
372
|
+
pass
|
|
368
373
|
sumstats = sumstats.loc[:,ouput_cols]
|
|
369
374
|
sumstats = sumstats.rename(columns=rename_dictionary)
|
|
370
375
|
|
|
@@ -46,13 +46,15 @@ def plottrumpet(mysumstats,
|
|
|
46
46
|
yscale_factor=1,
|
|
47
47
|
cmap="cool",
|
|
48
48
|
ylim=None,
|
|
49
|
+
xlim=None,
|
|
49
50
|
markercolor="#597FBD",
|
|
50
51
|
fontsize=15,
|
|
51
52
|
font_family="Arial",
|
|
52
|
-
size= "
|
|
53
|
+
size= "ABS_BETA",
|
|
53
54
|
sizes=None,
|
|
54
55
|
save=False,
|
|
55
56
|
saveargs=None,
|
|
57
|
+
figargs=None,
|
|
56
58
|
build="99",
|
|
57
59
|
anno_set=None,
|
|
58
60
|
anno_alias=None,
|
|
@@ -94,7 +96,8 @@ def plottrumpet(mysumstats,
|
|
|
94
96
|
else:
|
|
95
97
|
xticks = [0,0.01,0.05,0.1,0.2,0.5]
|
|
96
98
|
xticklabels = xticks
|
|
97
|
-
|
|
99
|
+
if figargs is None:
|
|
100
|
+
figargs={"figsize":(10,15)}
|
|
98
101
|
#Checking columns#################################################################################################################
|
|
99
102
|
if verbose: log.write("Start to create trumpet plot...")
|
|
100
103
|
|
|
@@ -201,7 +204,7 @@ def plottrumpet(mysumstats,
|
|
|
201
204
|
output_hex_colors
|
|
202
205
|
|
|
203
206
|
##################################################################################################
|
|
204
|
-
fig, ax = plt.subplots(
|
|
207
|
+
fig, ax = plt.subplots(**figargs)
|
|
205
208
|
|
|
206
209
|
##creating power line############################################################################################
|
|
207
210
|
if mode=="q":
|
|
@@ -284,6 +287,9 @@ def plottrumpet(mysumstats,
|
|
|
284
287
|
rotation=90
|
|
285
288
|
ax.set_xticks(xticks,xticklabels,fontsize=fontsize,rotation=rotation)
|
|
286
289
|
ax.set_xlim(-0.02,0.52)
|
|
290
|
+
|
|
291
|
+
if xlim is not None:
|
|
292
|
+
ax.set_xlim(xlim)
|
|
287
293
|
|
|
288
294
|
if ylim is not None:
|
|
289
295
|
ax.set_ylim(ylim)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: gwaslab
|
|
3
|
-
Version: 3.4.
|
|
3
|
+
Version: 3.4.25
|
|
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:
|
|
11
|
+
Requires-Python: <=3.9,>=3.8
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
License-File: LICENSE
|
|
14
14
|
|
|
@@ -32,7 +32,7 @@ Note: GWASLab is being updated very frequently for now. I will release the first
|
|
|
32
32
|
## Install
|
|
33
33
|
|
|
34
34
|
```
|
|
35
|
-
pip install gwaslab==3.4.
|
|
35
|
+
pip install gwaslab==3.4.24
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/data/hapmap3_SNPs/hapmap3_db150_hg19.snplist.gz
RENAMED
|
File without changes
|
{gwaslab-3.4.24 → gwaslab-3.4.25}/src/gwaslab/data/hapmap3_SNPs/hapmap3_db151_hg38.snplist.gz
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|