PYPE

PheWAS analysis, visualization, phenotype metadata, and Mendelian randomization in Python.

Get started View on GitHub Read the paper

What PYPE does

PYPE is a Python package for phenome-wide association studies, result visualization, variant annotation, and Mendelian randomization.

It was developed for investigator-driven analyses of biobank-scale data. Researchers can test genetic variants, risk scores, biomarkers, or other numeric predictors against many phenotypes while adjusting for covariates such as age, sex, and genetic principal components.

What is a phenome-wide association study?

A phenome-wide association study, or PheWAS, tests one or more predictors against a large set of phenotypes. It is useful when the question is broad: which diseases, measurements, laboratory values, or other traits are associated with a genetic variant or phenotype of interest?

PYPE runs the predictor-outcome regressions, applies sample-size requirements, and returns the effect estimate, standard error, and p-value for each association. It also provides multiple-testing correction, phenotype metadata, and Manhattan, volcano, and category enrichment plots.

A PheWAS finds associations. An association may reflect causation, reverse causation, confounding, selection bias, or chance.

What is Mendelian randomization?

Mendelian randomization, or MR, uses genetic variants associated with an exposure as instruments to estimate the exposure's effect on an outcome. Because genetic variants are assigned before disease develops, MR can provide evidence about whether an observed relationship may be causal.

MR depends on assumptions about instrument strength, confounding, and horizontal pleiotropy. PYPE includes inverse variance weighted, MR-Egger, median, mode, and MR-PRESSO methods so results can be compared across estimators with different assumptions.

Why use PheWAS and MR together?

PheWAS and MR answer different questions. PheWAS is a broad screen for associations across many traits. MR is a focused follow-up that tests whether evidence is consistent with an exposure affecting an outcome.

PYPE supports both steps in one package: run a PheWAS, add phenotype descriptions and categories, inspect the results in plots, then use suitable GWAS summary statistics for MR. The methods can also be used independently.

Run PheWAS

Test selected predictors against many phenotypes with optional covariates.

Review results

Apply multiple-testing correction and examine significant associations in plots.

Add annotations

Attach phenotype metadata and map significant variants to nearby genes.

Run MR

Harmonize exposure and outcome summary statistics and compare MR estimators.

Choose a guide

Getting started

Install PYPE and run a first PheWAS, plot, and MR analysis.

File formats

See every required dataframe and column, including gene interval files.

API reference

Review function signatures, parameters, return values, and examples.

MR methods

Compare assumptions, use cases, caveats, and primary citations.

Plotting gallery

View every plot type and the options that control annotations and styling.

Paper reproduction

Rerun the public MR analyses and compare legacy and corrected IVW results.