-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.qmd
96 lines (70 loc) · 2.73 KB
/
index.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
---
title: "Monte Carlo Cross Validation"
---
# Evidentiary and interpretable prediction
Binary and Multi-classification algorithm for adverse outcome detection, survival classification, and endpoint prediction (see references for details)
![](MCCV_prediction_scheme.png)
# Objectives of this project
1. Build the *mccv* python package: easily implement and perform MCCV for learning and prediction tasks.
2. Showcase accessibly to build, validate, and interpret MCCV classifiers.
3. Demonstrate use in both python and R for diverse community implementations.
# Installation
mkdir ~/my_directory #choose where to clone the mccv repository
cd ~/my_directory
git clone https://github.com/ngiangre/mccv.git
cd mccv/
python3 -m pip install .
# Usage
::: panel-tabset
# Python
```{python}
import pandas as pd
data = pd.read_csv('data/data.csv',index_col=0) # Feature column name is 'biomarker' and response column name is 'status'
data.head()
```
```{python}
import mccv
mccv_obj = mccv.mccv(num_bootstraps=200)
mccv_obj.set_X( data.loc[:,['biomarker']] )
mccv_obj.set_Y( data.loc[:,['status']] )
mccv_obj.run_mccv()
mccv_obj.run_permuted_mccv()
#Output
for n in mccv_obj.mccv_data:
print(n)
mccv_obj.mccv_data[n].head()
for n in mccv_obj.mccv_permuted_data:
print(n)
mccv_obj.mccv_permuted_data[n].head()
```
# R
```{r}
if(!requireNamespace("readr")){install.packages("readr")}
library(readr)
data <- read_csv("data/data.csv",col_types = c("iid")) #set obs as integer, status as integer, and biomarker as double
head(data)
```
```{r}
if(!requireNamespace("reticulate")){install.packages("reticulate")}
mccv = reticulate::import('mccv')
mccv_obj = mccv$mccv(num_bootstraps = as.integer(200))
X = reticulate::r_to_py(data[,c('obs','biomarker')])
X = X$set_index(reticulate::r_to_py('obs'))
y = reticulate::r_to_py(data[,c('obs','status')])
y = y$set_index(reticulate::r_to_py('obs'))
mccv_obj$set_X(X)
mccv_obj$set_Y(y)
mccv_obj$run_mccv()
mccv_obj$run_permuted_mccv()
#Output
lapply(mccv_obj$mccv_data,head)
lapply(mccv_obj$mccv_permuted_data,head)
```
:::
# Contribute
Please do! Reach out to Nick directly (nick.giangreco\@gmail.com), make an issue, or make a pull request.
# License
This software is released under the MIT license, which can be found in LICENSE in the root directory of this repository.
# Citation
Giangreco, N.P., Lebreton, G., Restaino, S. et al. Alterations in the kallikrein-kinin system predict death after heart transplant. Sci Rep 12, 14167 (2022). <https://doi.org/10.1038/s41598-022-18573-2>
Giangreco et al. 2021. Plasma kallikrein predicts primary graft dysfunction after heart transplant. Journal of Heart and Lung Transplantation, 40(10), 1199-1211. <https://doi.org/10.1016/j.healun.2021.07.001>.