Skip to main content

A collection of handy tools for GWAS

Project description

gwaslab

A collection of handy python scripts for GWAS. This package is based on matplotlib and seaborn. Just want to save myself from repetitive work.

What you can do with gwaslab:

  1. Side-by-side Manhattan and QQ plot
  2. Manhattan plot
  3. QQ plot
  4. Calculate lamda GC
  5. [Select top SNPs based on a given window size.]
  6. Convert beta/se <-> OR/95%L_U/95%L_L
  7. Select hapmap3 SNPs from sumstats
  8. Convert Observed scale heritability to liability scale heritability

manhattan_qq_plot

Requirements:

  1. Python>3 2. "scipy" 3. "numpy" 4. "pandas" 5. "matplotlib" 6. "seaborn"

Install:

pip install gwaslab

Current version: 0.0.4

Usage:

Input: pandas dataframe

Create Manhattan plot and QQ plot with just one line

import gwaslab as gl

## creat qqplot and manhattan plot with just one line
## pass a dataframe in, and specify the column name for chromosome, base pair position, and also the p values.
gl.mqqplot(sumstats,"CHR","POS","PVALUE")

## adjust the plot, select top snps and add annotation sutomatically.
gl.mqqplot(sumstats,"CHR","POS","PVALUE",cut=20,cutfactor=10,anno=True,verbose=True,save=True,title="gwaslab")

## all options
gl.mqqplot(insumstats,
          chrom,
          pos,
          p,
          scaled=False,
          cut=0,
          cutfactor=10,
          cut_line_color="#ebebeb",
          windowsizekb=500,
          anno=None,
          sig_level=5e-8,
          sig_line_color="grey",
          suggestive_sig_level=5e-6,
          title =None,
          mtitle=None,
          qtitle=None,
          figsize =(15,5),
          fontsize = 10,
          colors = ["#000042", "#7878BA"],
          verbose=True,
          repel_force=0.03,
          gc=True,
          save=None,
          saveargs={"dpi":300,"facecolor":"white"}
          )

Or you can plot it separately.

Manhattan plot

gl.mplot()

QQ plot

gl.qqplot()

Calculate genomic inflation factor

gc(insumstats{"PVALUE"},mode="p",level=0.5)
gc(insumstats["Z"],mode="z",level=0.5)
gc(insumstats["chi2"],mode="chi2",level=0.5)

Extract top snps given a sliding window size

gl.getsig(insumstats,id,chrom,pos,p)

gl.getsig(insumstats,id,chrom,pos,p,windowsizekb=500,verbose=True,sig_level=5e-8)

Converting observed scale heritability to liability scale heritability

gl.h2_obs_to_liab(h2_obs, P, K)

gl.h2_obs_to_liab(h2_obs, P, K, se_obs=None)

Ref:


Log

  • 0.0.4
    • added mqqplot feature
    • fixed gtesig algorithm
    • recreated mplot and qqplot

Next

  • beta to OR
  • OR to beta

For more information: https://gwaslab.com/

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-0.0.5.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

gwaslab-0.0.5-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gwaslab-0.0.5.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.24.0 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.47.0 importlib-metadata/4.11.1 keyring/21.2.1 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.3

File hashes

Hashes for gwaslab-0.0.5.tar.gz
Algorithm Hash digest
SHA256 30403f415ba5a6204f331c1cd1cb71064b075bb97d1a879ef29a4817b0577d07
MD5 e54ebcf34f28815c9da069aa2d5133a6
BLAKE2b-256 9c31da85c612e903b577938d6ca80d9e020c23168e5e19dc9b41d81a57f9ca44

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gwaslab-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 13.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.24.0 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.47.0 importlib-metadata/4.11.1 keyring/21.2.1 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.3

File hashes

Hashes for gwaslab-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 c8c0215b66f86a9f59739648b9a255d20b643aca8bbf0733b3acccf694c65aed
MD5 d9ced8954a23ff74cad7f6593685464f
BLAKE2b-256 3d2404fad77eeaea27acfa3bf1e9f95832e06e187e4fe8c72a1ee6a499562aef

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