使用标记的 Gromov-Wasserstein最佳传输进行跨模态匹配和扰动响应预测。
├── .gitignore
├── README.md
├── perturbot
│ ├── cv # Cross-validation experiments
│ └── perturbot
│ ├── match
│ │ ├── ot_labels.py # Label-constrained Entropic Optimal Transport
│ │ ├── ott_egwl.py # Label-constrained Entropic Gromov-Wasserstein
│ │ ├── cot_labels.py # Label-constrained Co-OT (Redko et al., 2020)
│ │ └── cot_feature.py # Feature-feature OT based on Co-OT concept
│ ├── predict
│ └── eval
├── scvi-tools # forked `scvi-tools` with label adaptation
└── ott # forked `ott` with label adaptation
perturbot/
使用修改后的scvi-tools
和ott
子模块,可以使用pip install
安装。
cd scvi-tools/
pip install .
cd ../ott/
pip install .
cd ../perturbot
pip install .
import numpy as np
from sklearn . decomposition import PCA
from perturbot . match import (
get_coupling_cotl ,
get_coupling_cotl_sinkhorn ,
get_coupling_egw_labels_ott ,
get_coupling_egw_all_ott ,
get_coupling_eot_ott ,
get_coupling_leot_ott ,
get_coupling_egw_ott ,
get_coupling_cot ,
get_coupling_cot_sinkhorn ,
get_coupling_gw_labels ,
get_coupling_fot ,
)
from perturbot . predict import train_mlp
# Generate data
n_samples = 300
labels = [ 0 , 1 , 2 , 3 ]
X_dict = { k : np . random . rand ( n_samples , 1000 ) for k in labels }
Y_dict = { k : np . random . rand ( n_samples , 2000 ) for k in labels }
pca = PCA ( n_components = 50 )
X_reduced = { k : pca . fit_transform ( X_dict [ k ]) for k in labels }
Y_reduced = { k : pca . fit_transform ( Y_dict [ k ]) for k in labels }
# Learn matching in the latent space
T_dict , log = get_coupling_egw_labels_ott (( X_reduced , Y_reduced )) # Other get_coupling_X methods be used
# Train MLP based on matching
model , pred_log = train_mlp (( X_dict , Y_dict ), T_dict )
# Learn feature-feature matching
T_feature , fm_log = get_coupling_fot (( X_dict , Y_dict ), T_dict )
有关更多详细信息,请参阅文档和手稿。
请提交问题或联系 [email protected]。
Jayoung Ryu、罗曼·洛佩兹和夏洛特·邦纳
如果您在工作中使用了 Perturb-OT,请引用:
@misc{ryu2024crossmodality,
title={Cross-modality Matching and Prediction of Perturbation Responses with Labeled Gromov-Wasserstein Optimal Transport},
author={Jayoung Ryu and Romain Lopez and Charlotte Bunne and Aviv Regev},
year={2024},
eprint={2405.00838},
archivePrefix={arXiv},
primaryClass={q-bio.GN}
}