title: 通过conda安装纯净环境的imputation tags: [] id: '1688' categories:
https://genomebiology.biomedcentral.com/articles/10.1186/s13059-020-02132-x
https://github.com/jingshuw/SAVERX
fg
垃圾程序让人高血压!!!
conda deactivate
conda create -n imputation_saver_x -c conda-forge python=3.7 -y
conda activate imputation_saver_x
pip install scanpy==1.4.4
pip install tensorflow==2.1.0
pip install Keras==2.3.1
nano -K /opt/conda/envs/imputation_saver_x/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py
按说明重定义 is_tensor 函数
pip install sctransfer
修改 /opt/conda/envs/imputation_saver_x/lib/python3.7/site-packages/keras/engine/saving.py
删除全部的 .decode('utf8')和.encode('utf8')
conda deactivate
conda create -n imputation_saver_x -c conda-forge python=3.7 -y
conda activate imputation_saver_x
pip install scanpy==1.4.4
pip install tensorflow==1.15.0
pip install Keras==2.3.1
pip install sctransfer
Sys.setenv(RETICULATE_PYTHON = "/opt/conda/envs/imputation_saver_x/bin/python3.7")
library('reticulate')
use_condaenv("imputation_saver_x")
py_config()
library(SAVERX)
pip install magic-impute
Sys.setenv(RETICULATE_PYTHON = "/opt/conda/envs/imputation_magic/bin/python3.8")
library('reticulate')
use_condaenv("imputation_magic")
py_config()
library(Rmagic)
conda install -c bioconda r-harmony -y
require(tidyverse)
f_ScaleData_RunPCA <- function(scRNA){
scRNA <- FindVariableFeatures(scRNA, selection.method = "vst", nfeatures = 2000)
lc_all.genes <- rownames(scRNA)
scRNA <- ScaleData(scRNA, features = lc_all.genes)
scRNA <- RunPCA(scRNA, features = VariableFeatures(object = scRNA))
print(ElbowPlot(scRNA, ndims = 40))
scRNA
}
require(harmony)
f_RunHarmony <- function(scRNA, dims=1:30, batchN="batch"){
scRNA = scRNA %>% RunHarmony(batchN, plot_convergence = TRUE, max.iter.harmony = 30)
scRNA <- scRNA %>% RunUMAP(reduction = "harmony", dims = dims)
scRNA
}
f_FindNeighbors <- function(scRNA, resolution = 0.5){
scRNA <- scRNA %>% FindNeighbors(reduction = "harmony") %>% FindClusters(resolution = resolution)
scRNA[[paste0('h_resolution_', resolution)]] <- Idents(scRNA)
scRNA
}