Skip to main content

A collection of handy tools for GWAS SumStats

Project description

image

GWASLab

badge Downloads badge_pip Hits badge_commit_m

  • A handy Python 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.

Please check GWASLab documentation at https://cloufield.github.io/gwaslab/ Note: GWASLab is being updated very frequently for now. I will release the first stable version soon! Please stay tuned.

Install

pip install gwaslab==3.4.15
import gwaslab as gl
# load plink2 output
mysumstats = gl.Sumstats("t2d_bbj.txt.gz", fmt="plink2")

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

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

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 : Manhattan plot
  • Brisbane plot: GWAS hits density plot
  • Regional plot : GWAS regional plot
  • Heatmap : ldsc-rg genetic correlation matrix
  • Scatter Plot : variant effect size comparison with sumstats
  • Scatter Plot : allele frequency comparison
  • Forest Plot : forest plots for meta-analysis of SNPs

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 form GWAS Catalog.
  • Logging : keep a complete record of manipulations applied to the sumstats.
  • Sumstats summary: give you a quick overview of the sumstats.
  • ...

Requirements

Python >= 3.8
pySAM >0.18,<0.20
pyensembl >=2.2.3
scikit-allel
Biopython >= 1.79
liftover >= 1.1.13
pandas >= 1.3,<1.5
numpy >= 1.21.2
matplotlib >=3.5
seaborn >=0.11.1
scipy >=1.6.2
statsmodels > =0.13
adjustText

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

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

Contacts

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

gwaslab-3.4.16.tar.gz (20.6 MB view details)

Uploaded Source

Built Distribution

gwaslab-3.4.16-py3-none-any.whl (20.6 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gwaslab-3.4.16.tar.gz
  • Upload date:
  • Size: 20.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.16

File hashes

Hashes for gwaslab-3.4.16.tar.gz
Algorithm Hash digest
SHA256 2e1d6ee1c4b1f723086b88a47141bf2dc0e4ebb31e3038e71802ae3437153679
MD5 f83137ec9fc9ef7d04d632bb53577d1c
BLAKE2b-256 0d8ab06357001b86c00ca1a594f067fdb70b4d20685f30f3ce4dfa7de7098bfa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gwaslab-3.4.16-py3-none-any.whl
  • Upload date:
  • Size: 20.6 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.16

File hashes

Hashes for gwaslab-3.4.16-py3-none-any.whl
Algorithm Hash digest
SHA256 0ae256efb6d7a94ef6e50e8ec366d0983b6027d9918af09c5e80445e0b49ec12
MD5 ace30dcedb53004f85f2c5ff2964933a
BLAKE2b-256 96cb49301752a5f48c11f78e80c9ae929ac2e52be0edfe3429a34c271e5c49e1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page