gwaslab 3.4.41__tar.gz → 3.4.42__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 (85) hide show
  1. {gwaslab-3.4.41/src/gwaslab.egg-info → gwaslab-3.4.42}/PKG-INFO +6 -3
  2. {gwaslab-3.4.41 → gwaslab-3.4.42}/README.md +5 -2
  3. {gwaslab-3.4.41 → gwaslab-3.4.42}/pyproject.toml +1 -1
  4. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/bd_common_data.py +14 -1
  5. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/bd_get_hapmap3.py +7 -3
  6. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/g_Sumstats.py +156 -138
  7. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/g_SumstatsPair.py +15 -15
  8. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/g_version.py +2 -2
  9. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/hm_harmonize_sumstats.py +365 -12
  10. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/io_read_tabular.py +7 -7
  11. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/io_to_formats.py +96 -21
  12. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/io_to_pickle.py +1 -1
  13. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/ldsc_ldscore.py +1 -1
  14. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/qc_fix_sumstats.py +2 -2
  15. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/util_ex_calculate_ldmatrix.py +2 -2
  16. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/util_ex_calculate_prs.py +2 -2
  17. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/util_ex_ldsc.py +163 -110
  18. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/util_ex_plink_filter.py +2 -2
  19. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/util_ex_run_clumping.py +2 -2
  20. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/util_in_filter_value.py +27 -9
  21. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/viz_plot_trumpetplot.py +115 -4
  22. {gwaslab-3.4.41 → gwaslab-3.4.42/src/gwaslab.egg-info}/PKG-INFO +6 -3
  23. {gwaslab-3.4.41 → gwaslab-3.4.42}/LICENSE +0 -0
  24. {gwaslab-3.4.41 → gwaslab-3.4.42}/LICENSE_before_v3.4.39 +0 -0
  25. {gwaslab-3.4.41 → gwaslab-3.4.42}/setup.cfg +0 -0
  26. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/__init__.py +0 -0
  27. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/bd_config.py +0 -0
  28. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/bd_download.py +0 -0
  29. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/data/chrx_par/chrx_par_hg19.bed.gz +0 -0
  30. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/data/chrx_par/chrx_par_hg38.bed.gz +0 -0
  31. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/data/formatbook.json +0 -0
  32. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/data/hapmap3_SNPs/hapmap3_db150_hg19.snplist.gz +0 -0
  33. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/data/hapmap3_SNPs/hapmap3_db151_hg38.snplist.gz +0 -0
  34. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/data/high_ld/high_ld_hla_hg19.bed.gz +0 -0
  35. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/data/high_ld/high_ld_hla_hg38.bed.gz +0 -0
  36. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/data/reference.json +0 -0
  37. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/g_Log.py +0 -0
  38. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/g_Phenotypes.py +0 -0
  39. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/g_SumstatsT.py +0 -0
  40. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/g_Sumstats_summary.py +0 -0
  41. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/g_meta.py +0 -0
  42. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/g_vchange_status.py +0 -0
  43. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/hm_casting.py +0 -0
  44. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/hm_rsid_to_chrpos.py +0 -0
  45. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/io_preformat_input.py +0 -0
  46. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/io_read_ldsc.py +0 -0
  47. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/ldsc_irwls.py +0 -0
  48. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/ldsc_jackknife.py +0 -0
  49. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/ldsc_parse.py +0 -0
  50. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/ldsc_regressions.py +0 -0
  51. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/ldsc_sumstats.py +0 -0
  52. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/qc_check_datatype.py +0 -0
  53. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/run_script.py +0 -0
  54. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/util_ex_gwascatalog.py +0 -0
  55. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/util_ex_ldproxyfinder.py +0 -0
  56. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/util_ex_process_h5.py +0 -0
  57. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/util_ex_process_ref.py +0 -0
  58. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/util_ex_run_2samplemr.py +0 -0
  59. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/util_ex_run_coloc.py +0 -0
  60. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/util_ex_run_susie.py +0 -0
  61. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/util_in_calculate_gc.py +0 -0
  62. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/util_in_calculate_power.py +0 -0
  63. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/util_in_convert_h2.py +0 -0
  64. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/util_in_correct_winnerscurse.py +0 -0
  65. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/util_in_fill_data.py +0 -0
  66. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/util_in_get_density.py +0 -0
  67. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/util_in_get_sig.py +0 -0
  68. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/viz_aux_annotate_plot.py +0 -0
  69. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/viz_aux_quickfix.py +0 -0
  70. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/viz_aux_reposition_text.py +0 -0
  71. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/viz_aux_save_figure.py +0 -0
  72. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/viz_plot_compare_af.py +0 -0
  73. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/viz_plot_compare_effect.py +0 -0
  74. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/viz_plot_forestplot.py +0 -0
  75. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/viz_plot_miamiplot.py +0 -0
  76. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/viz_plot_miamiplot2.py +0 -0
  77. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/viz_plot_mqqplot.py +0 -0
  78. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/viz_plot_qqplot.py +0 -0
  79. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/viz_plot_regionalplot.py +0 -0
  80. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/viz_plot_rg_heatmap.py +0 -0
  81. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab/viz_plot_stackedregional.py +0 -0
  82. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab.egg-info/SOURCES.txt +0 -0
  83. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab.egg-info/dependency_links.txt +0 -0
  84. {gwaslab-3.4.41 → gwaslab-3.4.42}/src/gwaslab.egg-info/requires.txt +0 -0
  85. {gwaslab-3.4.41 → gwaslab-3.4.42}/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.41
3
+ Version: 3.4.42
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/
@@ -50,7 +50,7 @@ Warning: Known issues of GWASLab are summarized in [https://cloufield.github.io/
50
50
  ### install via pip
51
51
 
52
52
  ```
53
- pip install gwaslab==3.4.40
53
+ pip install gwaslab==3.4.41
54
54
  ```
55
55
 
56
56
  ```python
@@ -89,7 +89,7 @@ Create a Python 3.9 environment and install gwaslab using pip:
89
89
  ```
90
90
  conda env create -n gwaslab_test -c conda-forge python=3.9
91
91
  conda activate gwaslab
92
- pip install gwaslab==3.4.40
92
+ pip install gwaslab==3.4.41
93
93
  ```
94
94
 
95
95
  or create a new environment using yml file [environment_3.4.40.yml](https://github.com/Cloufield/gwaslab/blob/main/environment_3.4.40.yml)
@@ -201,6 +201,9 @@ dependencies:
201
201
  ## Sample Data
202
202
  - Sample GWAS data used in GWASLab is obtained from: http://jenger.riken.jp/ (Suzuki, Ken, et al. "Identification of 28 new susceptibility loci for type 2 diabetes in the Japanese population." Nature genetics 51.3 (2019): 379-386.).
203
203
 
204
+ ## Acknowledgement
205
+
206
+ Thanks to @sup3rgiu, @soumickmj and @gmauro for their contributions to the source codes.
204
207
 
205
208
  ## Contacts
206
209
  * Github: [https://github.com/Cloufield/gwaslab](https://github.com/Cloufield/gwaslab)
@@ -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.40
26
+ pip install gwaslab==3.4.41
27
27
  ```
28
28
 
29
29
  ```python
@@ -62,7 +62,7 @@ Create a Python 3.9 environment and install gwaslab using pip:
62
62
  ```
63
63
  conda env create -n gwaslab_test -c conda-forge python=3.9
64
64
  conda activate gwaslab
65
- pip install gwaslab==3.4.40
65
+ pip install gwaslab==3.4.41
66
66
  ```
67
67
 
68
68
  or create a new environment using yml file [environment_3.4.40.yml](https://github.com/Cloufield/gwaslab/blob/main/environment_3.4.40.yml)
@@ -174,6 +174,9 @@ dependencies:
174
174
  ## Sample Data
175
175
  - Sample GWAS data used in GWASLab is obtained from: http://jenger.riken.jp/ (Suzuki, Ken, et al. "Identification of 28 new susceptibility loci for type 2 diabetes in the Japanese population." Nature genetics 51.3 (2019): 379-386.).
176
176
 
177
+ ## Acknowledgement
178
+
179
+ Thanks to @sup3rgiu, @soumickmj and @gmauro for their contributions to the source codes.
177
180
 
178
181
  ## Contacts
179
182
  * Github: [https://github.com/Cloufield/gwaslab](https://github.com/Cloufield/gwaslab)
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
7
7
 
8
8
  [project]
9
9
  name = "gwaslab"
10
- version = "3.4.41"
10
+ version = "3.4.42"
11
11
  authors = [
12
12
  { name="Yunye", email="yunye@gwaslab.com" },
13
13
  ]
@@ -298,9 +298,22 @@ def gtf_to_protein_coding(gtfpath,log=Log(),verbose=True):
298
298
 
299
299
  return protein_coding_path
300
300
 
301
+ ####################################################################################################################
302
+ # From BioPython: https://github.com/biopython/biopython/blob/c5a6b1374267d769b19c1022b4b45472316e78b4/Bio/Seq.py#L36
303
+ def _maketrans(complement_mapping):
304
+ """Make a python string translation table.
305
+
306
+ Arguments:
307
+ - complement_mapping - a dictionary.
301
308
 
302
-
309
+ Returns a translation table (a bytes object of length 256) for use with
310
+ the python string's translate method.
303
311
 
312
+ Compatible with lower case and upper case sequences.
313
+ """
314
+ keys = "".join(complement_mapping.keys()).encode("ASCII")
315
+ values = "".join(complement_mapping.values()).encode("ASCII")
316
+ return bytes.maketrans(keys + keys.lower(), values + values.lower())
304
317
 
305
318
  ####################################################################################################################
306
319
 
@@ -12,7 +12,7 @@ from gwaslab.qc_fix_sumstats import finished
12
12
  #A P-value
13
13
  #A signed summary statistic (beta, OR, log odds, Z-score, etc)
14
14
 
15
- def gethapmap3(sumstats,rsid="rsID",chrom="CHR", pos="POS", ea="EA", nea="NEA",build="19", verbose=True, match_allele= True, log=Log()):
15
+ def gethapmap3(sumstats,rsid="rsID",chrom="CHR", pos="POS", ea="EA", nea="NEA",build="19", verbose=True, match_allele= True, how="inner", log=Log()):
16
16
  ##start function with col checking##########################################################
17
17
  _start_line = "extract HapMap3 SNPs"
18
18
  _end_line = "extracting HapMap3 SNPs"
@@ -47,7 +47,7 @@ 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:
50
+ if rsid in sumstats.columns and how=="inner":
51
51
  output = sumstats.loc[sumstats[rsid].isin(hapmap3_ref["rsid"].values),:].copy()
52
52
  return output
53
53
 
@@ -56,11 +56,15 @@ def gethapmap3(sumstats,rsid="rsID",chrom="CHR", pos="POS", ea="EA", nea="NEA",b
56
56
  sumstats ["chr:pos"] = sumstats[chrom].astype("string")+":"+sumstats[pos].astype("string")
57
57
  hapmap3_ref["chr:pos"] = hapmap3_ref["#CHROM"]+":"+hapmap3_ref["POS"]
58
58
  hapmap3_ref = hapmap3_ref.rename(columns={"rsid":"rsID"})
59
- output = pd.merge(sumstats,hapmap3_ref.loc[:,["chr:pos","rsID"]+additional_cols],left_on="chr:pos",right_on="chr:pos",how="inner",suffixes=('', '_hapmap3')).copy()
59
+ output = pd.merge(sumstats,hapmap3_ref.loc[:,["chr:pos","rsID"]+additional_cols],left_on="chr:pos",right_on="chr:pos",how=how,suffixes=('', '_hapmap3')).copy()
60
60
  if match_allele:
61
61
  log.write(" -Checking if alleles are same...")
62
62
  is_matched = ((output[ea].astype("string") == output["A1"]) & (output[nea].astype("string") == output["A2"])) \
63
63
  | ((output[ea].astype("string") == output["A2"]) & (output[nea].astype("string") == output["A1"]))
64
+ if how=="right":
65
+ is_matched = ((output[ea].astype("string") == output["A1"]) & (output[nea].astype("string") == output["A2"])) \
66
+ | ((output[ea].astype("string") == output["A2"]) & (output[nea].astype("string") == output["A1"])) | output[ea].isna()
67
+
64
68
  log.write(" -Variants with macthed alleles: {}".format(sum(is_matched)))
65
69
  output = output.loc[is_matched,:]
66
70
  output = output.drop(columns=["chr:pos"]+additional_cols)