Skip to main content

A collection of handy tools for GWAS

Project description

image

gwaslab

badge badge_pip Hits

  • A simple python toolkit for handling GWAS 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 document at https://cloufield.github.io/gwaslab/

Install

pip install gwaslab==3.3.4
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.
  • Converting GWAS sumstats to specific formats:
  • Optional Filtering of variants in Hapmap3 SNPs / High-LD regions / HLA 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, MLOG10
  • Customized 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

imageimageimageimage

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.
  • Logging : keep a complete record of manipulations from raw data to munged data.
  • Sumstats summary function: know your data better.

Requirements:

  • Python >= 3.6
  • pySAM
  • pyensembl
  • scikit-allel
  • Biopython >= 1.79
  • liftover >= 1.1.13
  • pandas >= 1.2.4
  • numpy >= 1.21.2
  • matplotlib >=3.5
  • seaborn >=0.11.1
  • scipy >=1.6.2
  • statsmodels > =0.13
  • adjustText

Contacts

Project details


Release history Release notifications | RSS feed

This version

3.3.5

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.3.5.tar.gz (98.3 MB view details)

Uploaded Source

Built Distribution

gwaslab-3.3.5-py3-none-any.whl (98.3 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gwaslab-3.3.5.tar.gz
  • Upload date:
  • Size: 98.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.8.1 keyring/23.1.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.7

File hashes

Hashes for gwaslab-3.3.5.tar.gz
Algorithm Hash digest
SHA256 662ac2b2d215b99c379adbab47abb9a6a39592d3194b848e16cb85164ff3ebe0
MD5 0dd2c4e47c42cb3cf2651938e8b58dbf
BLAKE2b-256 98c21f26f25b6d36e0427724daebedd5b037e9bc939f6d8185655c2011a1b6b5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gwaslab-3.3.5-py3-none-any.whl
  • Upload date:
  • Size: 98.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.8.1 keyring/23.1.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.7

File hashes

Hashes for gwaslab-3.3.5-py3-none-any.whl
Algorithm Hash digest
SHA256 bc178dd8c28cbe5c180874993d4b41492babfa6297a6905b9d2fa6dc2a0e0ba6
MD5 eb2c971a96875e2b4a173df36659bdee
BLAKE2b-256 cd7a52977c1336ef1b53a00be11875251245a0f92406d84573be980c37c49098

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