Skip to main content

Two-sample Mendelian randomization implemented in Python

Project description

TwoSampleMR-Python

A package for performing Mendelian randomization using GWAS summary data. It allows causal inference using genetic variants as instrumental variables, fully integrated with the IEU OpenGWAS database.

This repository contains a reimplementation of the TwoSampleMR package.
It was developed as part of a master's thesis at UniZg-FER for academic purposes and learning.

Module Description
instruments.py Extracts instruments from OpenGWAS.
query.py Queries outcome data from OpenGWAS.
harmonise.py Harmonises exposure and outcome datasets.
mr.py Core MR methods (IVW, Egger, Median, Mode, GRIP).
heterogeneity.py Heterogeneity and pleiotropy tests.
multivariable_mr.py Multivariable MR framework.

Example Usage:

from instruments import extract_instruments
from query import extract_outcome_data
from harmonise import harmonise_data
from mr import mr

exposure = extract_instruments(["ieu-a-2"])
outcome = extract_outcome_data(exposure["SNP"], ["ieu-a-7"])
dat = harmonise_data(exposure, outcome)
res = mr(dat)
print(res)

Project details


Download files

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

Source Distribution

twosamplemr-0.1.1.tar.gz (34.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

twosamplemr-0.1.1-py3-none-any.whl (40.4 kB view details)

Uploaded Python 3

File details

Details for the file twosamplemr-0.1.1.tar.gz.

File metadata

  • Download URL: twosamplemr-0.1.1.tar.gz
  • Upload date:
  • Size: 34.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for twosamplemr-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a0653fb533a976472dffb3b276113d953cde2f0c71b167f5269f4f4545f9b03d
MD5 222e8c59245aaa471d5ab904812585a0
BLAKE2b-256 16365f1a8e721fe132f83e21319d2889a17d5862ebb86b22e23765bc09611900

See more details on using hashes here.

File details

Details for the file twosamplemr-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: twosamplemr-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 40.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for twosamplemr-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 115e2ad65c74a2ddd49f2721de505ac57ae2916fc8a63f1f8c18d6b62b476cbd
MD5 14164a464537892a66aed3157e68e5ba
BLAKE2b-256 555a506af978cca4738018e09030055bffdc12660ddcb8dd0d9e2525f0ec2208

See more details on using hashes here.

Supported by

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