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.0.tar.gz (34.7 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.0-py3-none-any.whl (40.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: twosamplemr-0.1.0.tar.gz
  • Upload date:
  • Size: 34.7 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.0.tar.gz
Algorithm Hash digest
SHA256 86291f48503c8b653ff04f48c637a5f43c48a2eaab01351e3596d28128ca31a6
MD5 928e4f7ebe683a31cf57e8fcff0f2acf
BLAKE2b-256 93e9538a4de149d660fbb6f7b306538fd43de3c7c21fac6a85b31fbc0ac46d1d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: twosamplemr-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 40.3 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 272b4ae03826833c4309a09474c53c91611f709713a9e8f756feb0563fdf0d23
MD5 712d6b2c635de6bd4ceb661de5941404
BLAKE2b-256 458daf390e104bd6a6b35936e145227bc99e9d652bafeab56d751d196f80705b

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