gwaslab 3.5.0__tar.gz → 3.5.1__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.

Files changed (95) hide show
  1. {gwaslab-3.5.0/src/gwaslab.egg-info → gwaslab-3.5.1}/PKG-INFO +3 -3
  2. {gwaslab-3.5.0 → gwaslab-3.5.1}/README.md +1 -1
  3. {gwaslab-3.5.0 → gwaslab-3.5.1}/pyproject.toml +2 -2
  4. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/bd_get_hapmap3.py +3 -1
  5. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/g_Sumstats.py +8 -8
  6. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/g_version.py +2 -2
  7. gwaslab-3.5.1/src/gwaslab/io_process_args.py +23 -0
  8. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/qc_fix_sumstats.py +9 -5
  9. gwaslab-3.5.1/src/gwaslab/vis_plot_credible sets.py +0 -0
  10. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/viz_aux_annotate_plot.py +8 -0
  11. gwaslab-3.5.1/src/gwaslab/viz_aux_property.py +2 -0
  12. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/viz_plot_compare_effect.py +787 -468
  13. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/viz_plot_mqqplot.py +4 -1
  14. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/viz_plot_phe_heatmap.py +1 -1
  15. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/viz_plot_stackedregional.py +1 -1
  16. {gwaslab-3.5.0 → gwaslab-3.5.1/src/gwaslab.egg-info}/PKG-INFO +3 -3
  17. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab.egg-info/SOURCES.txt +3 -0
  18. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab.egg-info/requires.txt +1 -1
  19. {gwaslab-3.5.0 → gwaslab-3.5.1}/LICENSE +0 -0
  20. {gwaslab-3.5.0 → gwaslab-3.5.1}/LICENSE_before_v3.4.39 +0 -0
  21. {gwaslab-3.5.0 → gwaslab-3.5.1}/setup.cfg +0 -0
  22. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/__init__.py +0 -0
  23. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/bd_common_data.py +0 -0
  24. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/bd_config.py +0 -0
  25. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/bd_download.py +0 -0
  26. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/cache_manager.py +0 -0
  27. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/data/chrx_par/chrx_par_hg19.bed.gz +0 -0
  28. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/data/chrx_par/chrx_par_hg38.bed.gz +0 -0
  29. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/data/formatbook.json +0 -0
  30. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/data/hapmap3_SNPs/hapmap3_db150_hg19.snplist.gz +0 -0
  31. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/data/hapmap3_SNPs/hapmap3_db151_hg38.snplist.gz +0 -0
  32. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/data/high_ld/high_ld_hla_hg19.bed.gz +0 -0
  33. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/data/high_ld/high_ld_hla_hg38.bed.gz +0 -0
  34. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/data/reference.json +0 -0
  35. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/g_Log.py +0 -0
  36. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/g_Phenotypes.py +0 -0
  37. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/g_SumstatsPair.py +0 -0
  38. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/g_SumstatsT.py +0 -0
  39. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/g_Sumstats_summary.py +0 -0
  40. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/g_meta.py +0 -0
  41. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/g_vchange_status.py +0 -0
  42. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/hm_casting.py +0 -0
  43. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/hm_harmonize_sumstats.py +0 -0
  44. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/hm_rsid_to_chrpos.py +0 -0
  45. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/io_preformat_input.py +0 -0
  46. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/io_read_ldsc.py +0 -0
  47. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/io_read_tabular.py +0 -0
  48. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/io_to_formats.py +0 -0
  49. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/io_to_pickle.py +0 -0
  50. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/ldsc_irwls.py +0 -0
  51. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/ldsc_jackknife.py +0 -0
  52. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/ldsc_ldscore.py +0 -0
  53. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/ldsc_parse.py +0 -0
  54. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/ldsc_regressions.py +0 -0
  55. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/ldsc_sumstats.py +0 -0
  56. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/qc_check_datatype.py +0 -0
  57. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/run_script.py +0 -0
  58. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/util_abf_finemapping.py +0 -0
  59. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/util_ex_calculate_ldmatrix.py +0 -0
  60. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/util_ex_calculate_prs.py +0 -0
  61. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/util_ex_gwascatalog.py +0 -0
  62. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/util_ex_ldproxyfinder.py +0 -0
  63. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/util_ex_ldsc.py +0 -0
  64. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/util_ex_plink_filter.py +0 -0
  65. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/util_ex_process_h5.py +0 -0
  66. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/util_ex_process_ref.py +0 -0
  67. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/util_ex_run_2samplemr.py +0 -0
  68. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/util_ex_run_clumping.py +0 -0
  69. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/util_ex_run_coloc.py +0 -0
  70. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/util_ex_run_susie.py +0 -0
  71. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/util_in_calculate_gc.py +0 -0
  72. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/util_in_calculate_power.py +0 -0
  73. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/util_in_convert_h2.py +0 -0
  74. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/util_in_correct_winnerscurse.py +0 -0
  75. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/util_in_fill_data.py +0 -0
  76. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/util_in_filter_value.py +0 -0
  77. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/util_in_get_density.py +0 -0
  78. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/util_in_get_sig.py +0 -0
  79. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/util_in_meta.py +0 -0
  80. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/util_in_snphwe.py +0 -0
  81. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/viz_aux_chromatin.py +0 -0
  82. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/viz_aux_quickfix.py +0 -0
  83. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/viz_aux_reposition_text.py +0 -0
  84. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/viz_aux_save_figure.py +0 -0
  85. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/viz_plot_compare_af.py +0 -0
  86. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/viz_plot_forestplot.py +0 -0
  87. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/viz_plot_miamiplot.py +0 -0
  88. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/viz_plot_miamiplot2.py +0 -0
  89. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/viz_plot_qqplot.py +0 -0
  90. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/viz_plot_regional2.py +0 -0
  91. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/viz_plot_regionalplot.py +0 -0
  92. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/viz_plot_rg_heatmap.py +0 -0
  93. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab/viz_plot_trumpetplot.py +0 -0
  94. {gwaslab-3.5.0 → gwaslab-3.5.1}/src/gwaslab.egg-info/dependency_links.txt +0 -0
  95. {gwaslab-3.5.0 → gwaslab-3.5.1}/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.5.0
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>=1.1.13
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.4.46
54
+ pip install gwaslab==3.5.0
55
55
  ```
56
56
 
57
57
  ```python
@@ -23,7 +23,7 @@ Warning: Known issues of GWASLab are summarized in [https://cloufield.github.io/
23
23
  ### install via pip
24
24
 
25
25
  ```
26
- pip install gwaslab==3.4.46
26
+ pip install gwaslab==3.5.0
27
27
  ```
28
28
 
29
29
  ```python
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
7
7
 
8
8
  [project]
9
9
  name = "gwaslab"
10
- version = "3.5.0"
10
+ version = "3.5.1"
11
11
  authors = [
12
12
  { name="Yunye", email="yunye@gwaslab.com" },
13
13
  ]
@@ -24,7 +24,7 @@ dependencies = [
24
24
  "pySAM==0.22.1",
25
25
  "Biopython>=1.79",
26
26
  "adjustText>=0.7.3, <=0.8",
27
- "liftover>=1.1.13",
27
+ "liftover>=1.1.13, <=1.3.1",
28
28
  "scikit-allel>=1.3.5",
29
29
  "pyensembl==2.2.3",
30
30
  "gtfparse==1.3.0",
@@ -47,8 +47,10 @@ def gethapmap3(sumstats,rsid="rsID",chrom="CHR", pos="POS", ea="EA", nea="NEA",b
47
47
  #rsid A1 A2 #CHROM POS
48
48
  #rs3094315 G A 1 752566
49
49
 
50
- if rsid in sumstats.columns and how=="inner":
50
+ if rsid in sumstats.columns:
51
+ log.write(" -rsID will be used for matching...", verbose=verbose)
51
52
  output = sumstats.loc[sumstats[rsid].isin(hapmap3_ref["rsid"].values),:].copy()
53
+ log.write(" -Raw input contains "+str(len(output))+" Hapmap3 variants based on rsID...", verbose=verbose)
52
54
  return output
53
55
 
54
56
  elif chrom in sumstats.columns and pos in sumstats.columns:
@@ -790,28 +790,28 @@ class Sumstats():
790
790
 
791
791
 
792
792
  ## LDSC ##############################################################################################
793
- def estimate_h2_by_ldsc(self, build=None, verbose=True, match_allele=True, **kwargs):
793
+ def estimate_h2_by_ldsc(self, build=None, verbose=True, match_allele=True, how="right", **kwargs):
794
794
  if build is None:
795
795
  build = self.meta["gwaslab"]["genome_build"]
796
- insumstats = gethapmap3(self.data.copy(), build=build, verbose=verbose , match_allele=True, how="right" )
796
+ insumstats = gethapmap3(self.data.copy(), build=build, verbose=verbose , match_allele=match_allele, how=how )
797
797
  self.ldsc_h2, self.ldsc_h2_results = _estimate_h2_by_ldsc(insumstats=insumstats, log=self.log, verbose=verbose, **kwargs)
798
798
 
799
- def estimate_rg_by_ldsc(self, build=None, verbose=True, match_allele=True, **kwargs):
799
+ def estimate_rg_by_ldsc(self, build=None, verbose=True, match_allele=True, how="right",**kwargs):
800
800
  if build is None:
801
801
  build = self.meta["gwaslab"]["genome_build"]
802
- insumstats = gethapmap3(self.data.copy(), build=build, verbose=verbose , match_allele=True, how="right" )
802
+ insumstats = gethapmap3(self.data.copy(), build=build, verbose=verbose , match_allele=match_allele, how=how )
803
803
  self.ldsc_rg = _estimate_rg_by_ldsc(insumstats=insumstats, log=self.log, verbose=verbose, **kwargs)
804
804
 
805
- def estimate_h2_cts_by_ldsc(self, build=None, verbose=True, match_allele=True, **kwargs):
805
+ def estimate_h2_cts_by_ldsc(self, build=None, verbose=True, match_allele=True, how="right",**kwargs):
806
806
  if build is None:
807
807
  build = self.meta["gwaslab"]["genome_build"]
808
- insumstats = gethapmap3(self.data.copy(), build=build, verbose=verbose , match_allele=True, how="right" )
808
+ insumstats = gethapmap3(self.data.copy(), build=build, verbose=verbose , match_allele=match_allele, how=how )
809
809
  self.ldsc_h2_cts = _estimate_h2_cts_by_ldsc(insumstats=insumstats, log=self.log, verbose=verbose, **kwargs)
810
810
 
811
- def estimate_partitioned_h2_by_ldsc(self, build=None, verbose=True, match_allele=True, **kwargs):
811
+ def estimate_partitioned_h2_by_ldsc(self, build=None, verbose=True, match_allele=True, how="right",**kwargs):
812
812
  if build is None:
813
813
  build = self.meta["gwaslab"]["genome_build"]
814
- insumstats = gethapmap3(self.data.copy(), build=build, verbose=verbose , match_allele=True, how="right" )
814
+ insumstats = gethapmap3(self.data.copy(), build=build, verbose=verbose , match_allele=match_allele, how=how )
815
815
  self.ldsc_partitioned_h2_summary, self.ldsc_partitioned_h2_results = _estimate_partitioned_h2_by_ldsc(insumstats=insumstats, log=self.log, verbose=verbose, **kwargs)
816
816
  # external ################################################################################################
817
817
 
@@ -15,8 +15,8 @@ def _get_version():
15
15
  def gwaslab_info():
16
16
  # version meta information
17
17
  dic={
18
- "version":"3.5.0",
19
- "release_date":"20241029"
18
+ "version":"3.5.1",
19
+ "release_date":"20241120"
20
20
  }
21
21
  return dic
22
22
 
@@ -0,0 +1,23 @@
1
+ import copy
2
+ def _merge_and_sync_dic(list_of_dics:list, default:dict) -> dict:
3
+ temp = copy.copy(default)
4
+ for dic in list_of_dics:
5
+ if isinstance(dic, dict):
6
+ temp.update(dic)
7
+ return temp
8
+
9
+ def _list_func_args(func):
10
+ return func.__code__.co_varnames
11
+
12
+ def _extract_kwargs(prefix:str, default:dict, kwargs:dict) -> dict:
13
+ extracted = []
14
+ for key,value in kwargs.items():
15
+ if key=="kwargs" or key=="args":
16
+ for key_nested,value_nested in kwargs[key].items():
17
+ if prefix in key_nested and "arg" in key_nested:
18
+ extracted.append(value_nested)
19
+ else:
20
+ if prefix in key and "arg" in key:
21
+ extracted.append(value)
22
+ merged_arg = _merge_and_sync_dic(extracted, default)
23
+ return merged_arg
@@ -1579,14 +1579,14 @@ def liftover_variant(sumstats,
1579
1579
 
1580
1580
  try:
1581
1581
  if chain is None:
1582
- converter = get_lifter(from_build,to_build,one_based=True)
1582
+ converter = get_lifter("hg{}".format(from_build),"hg{}".format(to_build),one_based=True)
1583
1583
  else:
1584
- converter = ChainFile(chain, one_based=True)
1584
+ converter = ChainFile(chain,target="",query="", one_based=True)
1585
1585
  except:
1586
1586
  if chain is None:
1587
- converter = get_lifter(from_build,to_build)
1587
+ converter = get_lifter("hg{}".format(from_build),"hg{}".format(to_build))
1588
1588
  else:
1589
- converter = ChainFile(chain)
1589
+ converter = ChainFile(chain, target="",query="")
1590
1590
 
1591
1591
  dic= get_number_to_chr(in_chr=False,xymt=["X","Y","M"])
1592
1592
  dic2= get_chr_to_number(out_chr=False)
@@ -1627,11 +1627,15 @@ def parallelizeliftovervariant(sumstats,n_cores=1,chrom="CHR", pos="POS", from_b
1627
1627
  else:
1628
1628
  try:
1629
1629
  chain = get_chain(from_build=from_build, to_build=to_build)
1630
- log.write(" -Creating converter using ChainFile: {}".format(chain), verbose=verbose)
1630
+ if chain is None or chain==False:
1631
+ raise ValueError("")
1632
+ log.write(" -Creating converter using provided ChainFile: {}".format(chain), verbose=verbose)
1631
1633
  except:
1632
1634
  chain = None
1633
1635
  lifter_from_build=from_build
1634
1636
  lifter_to_build=to_build
1637
+ log.write(" -Try creating converter using liftover package", verbose=verbose)
1638
+
1635
1639
  log.write(" -Creating converter : {} -> {}".format(lifter_from_build, lifter_to_build), verbose=verbose)
1636
1640
  # valid chr and pos
1637
1641
  pattern = r"\w\w\w0\w\w\w"
File without changes
@@ -38,6 +38,7 @@ def annotate_single(
38
38
  region,
39
39
  region_anno_bbox_args,
40
40
  skip,
41
+ arrow_kwargs=None,
41
42
  anno_height=1,
42
43
  amode="int",
43
44
  snpid="SNPID",
@@ -48,6 +49,9 @@ def annotate_single(
48
49
  _invert=False,
49
50
  log=Log()
50
51
  ):
52
+ if arrow_kwargs is None:
53
+ arrow_kwargs=dict()
54
+
51
55
  if anno and (to_annotate.empty is not True):
52
56
  #initiate a list for text and a starting position
53
57
  text = []
@@ -223,6 +227,8 @@ def annotate_single(
223
227
  else:
224
228
  arrowargs=dict(arrowstyle='-|>', color='grey', shrinkA=10, linewidth=0.1, relpos=(1,0.5))
225
229
  ################################################################################################################################
230
+ for key,value in arrow_kwargs.items():
231
+ arrowargs[key]=value
226
232
 
227
233
  anno_to_adjust = ax1.annotate(annotation_text,
228
234
  xy=xy,
@@ -293,6 +299,7 @@ def annotate_pair(
293
299
  pos="POS",
294
300
  repel_force=0.02,
295
301
  verbose=True,
302
+ arrow_kwargs=None,
296
303
  log=Log()
297
304
  ):
298
305
  if anno is not None:
@@ -474,6 +481,7 @@ def annotate_pair(
474
481
  arrowargs=dict(arrowstyle='-|>', color='grey', shrinkA=10, linewidth=0.1, relpos=(0,0.5))
475
482
  else:
476
483
  arrowargs=dict(arrowstyle='-|>', color='grey', shrinkA=10, linewidth=0.1, relpos=(1,0.5))
484
+
477
485
 
478
486
  anno_to_adjust = ax.annotate(annotation_text,
479
487
  xy=xy,
@@ -0,0 +1,2 @@
1
+ import matplotlib.pyplot as plt
2
+