Cloufield / gwaslab

A Python package for handling and visualizing GWAS summary statistics. https://cloufield.github.io/gwaslab/
GNU General Public License v3.0
151 stars 25 forks source link

GWASLab

image

badge Downloads badge_pip Hits badge_commit_m

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.

Warning: Known issues of GWASLab are summarized in https://cloufield.github.io/gwaslab/KnownIssues/ .

Install

install via pip

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

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

# 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()
...

install in conda environment

Create a Python 3.9 environment and install gwaslab using pip:

conda env create -n gwaslab_test -c conda-forge python=3.9
conda activate gwaslab
pip install gwaslab==3.4.45

or create a new environment using yml file environment_3.4.40.yml

conda env create -n gwaslab -f environment_3.4.40.yml

install using docker

A docker file is available here for building local images.

Functions

Loading and Formatting

Standardization & Normalization

Quality control, Value conversion & Filtering

Harmonization

Visualization

Visualization Examples

image image image image

Other Utilities

Requirements (deprecated)

environment.yml

name: gwaslab
channels:
  - conda-forge
  - defaults
dependencies:
  - python=3.8.16=h7a1cb2a_3
  - jupyter==1.0.0
  - pip==23.1.2
  - pip:
      - adjusttext==0.8
      - biopython==1.81
      - gwaslab==3.4.16
      - liftover==1.1.16
      - matplotlib==3.7.1
      - numpy==1.24.2
      - pandas==1.4.4
      - scikit-allel==1.3.5
      - scikit-learn==1.2.2
      - scipy==1.10.1
      - seaborn==0.11.2
      - statsmodels==0.13
      - adjustText==0.8
      - pysam==0.19
      - pyensembl==2.2.3
      - h5py==3.10.0

How to cite

Sample Data

Acknowledgement

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

Contacts