Skip to main content

GWASLab

image

badge Downloads badge_pip badge_commit_m

  • A handy Python-based toolkit for handling GWAS summary statistics (sumstats).
  • Each process is modularized and can be customized to your needs.
  • Sumstats-specific manipulations are designed as methods of a Python object, gwaslab.Sumstats.

Installation

install via pip

The latest version of GWASLab now supports Python 3.9, 3.10, 3.11, and 3.12.

pip install gwaslab

install in conda environment

Create a Python 3.9, 3.10, 3.11 or 3.12 environment and install gwaslab using pip:

conda env create -n gwaslab -c conda-forge python=3.12

conda activate gwaslab

pip install gwaslab

or create a new environment using yml file environment.yml

conda env create -n gwaslab -f environment.yml

install using docker (deprecated)

A docker file is available here for building local images.

Quick start

import gwaslab as gl

# load plink2 output
mysumstats = gl.Sumstats("sumstats.txt.gz", fmt="plink2")

# or load sumstats with auto mode (auto-detecting commonly used headers) 
# assuming ALT/A1 is EA, and frq is EAF
mysumstats = gl.Sumstats("sumstats.txt.gz", fmt="auto")

# or you can specify the columns:
mysumstats = gl.Sumstats("sumstats.txt.gz",
             snpid="SNP",
             chrom="CHR",
             pos="POS",
             ea="ALT",
             nea="REF",
             eaf="Frq",
             beta="BETA",
             se="SE",
             p="P",
             direction="Dir",
             n="N",
             build="19")

# manhattan and qq plot
mysumstats.plot_mqq()
...

Documentation and tutorials

Documentation and tutorials for GWASLab are avaiable at here.

Functions

Loading and Formatting

  • Loading sumstats by simply specifying the software name or format name, or specifying each column name.
  • Converting GWAS sumstats to specific formats:
    • LDSC / MAGMA / METAL / PLINK / SAIGE / REGENIE / MR-MEGA / GWAS-SSF / FUMA / GWAS-VCF / BED...
    • check available formats
  • Optional filtering of variants in commonly used genomic regions: Hapmap3 SNPs / High-LD regions / MHC region

Standardization & Normalization

  • Variant ID standardization
  • CHR and POS notation standardization
  • Variant POS and allele normalization
  • Genome build : Inference and Liftover

Quality control, Value conversion & Filtering

  • Statistics sanity check
  • Extreme value removal
  • Equivalent statistics conversion
    • BETA/SE , OR/OR_95L/OR_95U
    • P, Z, CHISQ, MLOG10P
  • Customizable value filtering

Harmonization

  • rsID assignment based on CHR, POS, and REF/ALT
  • CHR POS assignment based on rsID using a reference text file
  • Palindromic SNPs and indels strand inference using a reference VCF
  • Check allele frequency discrepancy using a reference VCF
  • Reference allele alignment using a reference genome sequence FASTA file

Visualization

  • Mqq plot: Manhattan plot, QQ plot or MQQ plot (with a bunch of customizable features including auto-annotate nearest gene names)
  • Miami plot: mirrored Manhattan plot
  • Brisbane plot: GWAS hits density plot
  • Regional plot: GWAS regional plot
  • Genetic correlation heatmap: ldsc-rg genetic correlation matrix
  • Scatter plot: variant effect size comparison
  • Scatter plot: allele frequency comparison
  • Scatter plot: trumpet plot (plot of MAF and effect size with power lines)

Visualization Examples

image image image image

Other Utilities

  • Read ldsc h2 or rg outputs directly as DataFrames (auto-parsing).
  • Extract lead variants given a sliding window size.
  • Extract novel loci given a list of known lead variants / or known loci obtained from GWAS Catalog.
  • Logging: keep a complete record of manipulations applied to the sumstats.
  • Sumstats summary: give you a quick overview of the sumstats.
  • ...

Issues

How to cite

  • GWASLab preprint: He, Y., Koido, M., Shimmori, Y., Kamatani, Y. (2023). GWASLab: a Python package for processing and visualizing GWAS summary statistics. Preprint at Jxiv, 2023-5. https://doi.org/10.51094/jxiv.370

Sample data used for tutorial

  • 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.).

Acknowledgement

Thanks to @sup3rgiu, @soumickmj and @gmauro for their contributions to the source codes.

Contacts

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gwaslab-4.2.0.tar.gz (27.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gwaslab-4.2.0-py3-none-any.whl (26.9 MB view details)

Uploaded Python 3

File details

Details for the file gwaslab-4.2.0.tar.gz.

File metadata

  • Download URL: gwaslab-4.2.0.tar.gz
  • Upload date:
  • Size: 27.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for gwaslab-4.2.0.tar.gz
Algorithm Hash digest
SHA256 ae2b5e0d37118f01382c9eefaf3fb78ec719e4cab83a491639e3fc8d075467c9
MD5 941d6d18b93bc432b799f96da0760a2a
BLAKE2b-256 adce1421d5d48889880ce6cbc1aa1d034f54ab9a9f2d2eb090617e4223f6c4c9

See more details on using hashes here.

File details

Details for the file gwaslab-4.2.0-py3-none-any.whl.

File metadata

  • Download URL: gwaslab-4.2.0-py3-none-any.whl
  • Upload date:
  • Size: 26.9 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for gwaslab-4.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 685fb6672fc3d042cf08529473bef24fe42d3a9137ce8a7e51914fa08e2aecd5
MD5 554e27626b394cc4d8eb7e76302e3efd
BLAKE2b-256 8a3c97b669f20ae989e770d3e1c649d93d29a671a7055341feff8f259573c7e6

See more details on using hashes here.

Release history Release notifications | RSS feed

4.2.2

2 files

4.2.1

2 files

This release

4.2.0 This release

2 files

4.1.9

2 files

4.1.8

2 files

4.1.7

2 files

4.1.6

2 files

4.1.5

2 files

4.1.4

2 files

4.1.3

2 files

4.1.2

2 files

4.1.1

2 files

4.0.9

2 files

4.0.8

2 files

4.0.7

2 files

4.0.6

2 files

4.0.5

2 files

4.0.4

2 files

4.0.3

2 files

4.0.2

2 files

4.0.1

2 files

4.0.0

2 files

3.6.16

2 files

3.6.15

2 files

3.6.14

2 files

3.6.13

2 files

3.6.12

2 files

3.6.11

2 files

3.6.10

2 files

3.6.9

2 files

3.6.8

2 files

3.6.7

2 files

3.6.6

2 files

3.6.5

2 files

3.6.4

2 files

3.6.3

2 files

3.6.2

2 files

3.6.1

2 files

3.6.0

2 files

3.5.8

2 files

3.5.7

2 files

3.5.6

2 files

3.5.5

2 files

3.5.4

2 files

3.5.3

2 files

3.5.2

2 files

3.5.1

2 files

3.5.0

2 files

3.4.49

2 files

3.4.48

2 files

3.4.47

2 files

3.4.46

2 files

3.4.45

2 files

3.4.44

2 files

3.4.43

2 files

3.4.42

2 files

3.4.41

2 files

3.4.40

2 files

3.4.39

2 files

3.4.38

2 files

3.4.37

2 files

3.4.36

2 files

3.4.35

2 files

3.4.34

2 files

3.4.33

2 files

3.4.32

2 files

3.4.31

2 files

3.4.30

2 files

3.4.29

2 files

3.4.28

2 files

3.4.27

2 files

3.4.26

2 files

3.4.25

2 files

3.4.24

2 files

3.4.23

2 files

3.4.22

2 files

3.4.21

2 files

3.4.20

2 files

3.4.19

2 files

3.4.18

2 files

3.4.17

2 files

3.4.16

2 files

3.4.15

2 files

3.4.14

2 files

3.4.13

2 files

3.4.12

2 files

3.4.11

2 files

3.4.10

2 files

3.4.9

2 files

3.4.8

2 files

3.4.7

2 files

3.4.6

2 files

3.4.5

2 files

3.4.4

2 files

3.4.3

2 files

3.4.2

2 files

3.4.1

2 files

3.4.0

2 files

3.3.24

2 files

3.3.23

2 files

3.3.22

2 files

3.3.21

2 files

3.3.20

2 files

3.3.19

2 files

3.3.18

2 files

3.3.17

2 files

3.3.16

2 files

3.3.15

2 files

3.3.14

2 files

3.3.13

2 files

3.3.12

2 files

3.3.11

2 files

3.3.10

2 files

3.3.9

2 files

3.3.8

2 files

3.3.7

2 files

3.3.6

2 files

3.3.5

2 files

3.3.4

2 files

3.3.3

2 files

3.3.2

2 files

3.3.1

2 files

3.3.0

2 files

3.2.0

2 files

3.1.2

2 files

3.1.1

2 files

3.1.0

2 files

3.0.2

2 files

3.0.1

2 files

3.0.0

2 files

1.0.4

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

1 file

0.0.6

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page