Metadata-Version: 2.4
Name: twosamplemr
Version: 0.1.1
Summary: Two-sample Mendelian randomization implemented in Python
Author-email: Jurica Matosic <jurica.juki.matosic@gmail.com>
Project-URL: Homepage, https://github.com/JuMa555/TwoSampleMR-Python
Project-URL: Repository, https://github.com/JuMa555/TwoSampleMR-Python
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pandas
Requires-Dist: numpy
Requires-Dist: scipy
Requires-Dist: matplotlib
Requires-Dist: seaborn
Requires-Dist: statsmodels
Requires-Dist: ieugwaspy
Requires-Dist: requests
Requires-Dist: dotenv
Dynamic: license-file

# 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](https://opengwas.io/) database.


This repository contains a reimplementation of the [TwoSampleMR](https://github.com/MRCIEU/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:

```python
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)
```
