forked from qinqian/SingleCellOpenProblems
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmnn.py
39 lines (34 loc) · 1.29 KB
/
mnn.py
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
from ....tools.conversion import r_function
from ....tools.decorators import method
from ....tools.normalize import log_cpm
from ....tools.normalize import log_scran_pooling
from ....tools.utils import check_version
_mnn = r_function("mnn.R")
@method(
method_name="Mutual Nearest Neighbors (log CPM)",
paper_name="Batch effects in single-cell RNA-sequencing data are corrected by "
"matching mutual nearest neighbors",
paper_url="https://www.nature.com/articles/nbt.4091",
paper_year=2018,
code_url="https://github.com/LTLA/batchelor",
code_version=check_version("rpy2"),
image="openproblems-r-extras",
)
def mnn_log_cpm(adata):
log_cpm(adata)
log_cpm(adata, obsm="mode2", obs="mode2_obs", var="mode2_var")
return _mnn(adata)
@method(
method_name="Mutual Nearest Neighbors (log scran)",
paper_name="Batch effects in single-cell RNA-sequencing data are corrected by "
"matching mutual nearest neighbors",
paper_url="https://www.nature.com/articles/nbt.4091",
paper_year=2018,
code_url="https://github.com/LTLA/batchelor",
code_version=check_version("rpy2"),
image="openproblems-r-extras",
)
def mnn_log_scran_pooling(adata):
log_scran_pooling(adata)
log_cpm(adata, obsm="mode2", obs="mode2_obs", var="mode2_var")
return _mnn(adata)