# 使用 seuratV4
.libPaths(c("/share/biosoft/R/Seurat4lib/", .libPaths()))
library(Seurat)
#library(velocyto.R)
#library(SeuratWrappers)
library(qs)
# 加载 SCP之前设置python
Sys.setenv(RETICULATE_AUTOCONFIGURE = "FALSE")
library(reticulate)
use_python("/share/biosoft/python/Python-v3.10.10/bin/python", required = TRUE)
py_config()
#跳过警告
suppressPackageStartupMessages({
#options(reticulate.conda_binary = "/path/to/conda", SCP_env_name = "SCP_env")
library(SCP)
})
#测试
data("pancreas_sub")
print(pancreas_sub)
data("panc8_sub")
panc8_sub <- Integration_SCP(srtMerge = panc8_sub, batch = "tech", integration_method = "Seurat")
CellDimPlot(
srt = panc8_sub, group.by = c("celltype", "tech"), reduction = "SeuratUMAP2D",
title = "Seurat", theme_use = "theme_blank"
)
panc8_rename <- RenameFeatures(
srt = panc8_sub,
newnames = make.unique(capitalize(rownames(panc8_sub[["RNA"]]), force_tolower = TRUE)),
assays = "RNA"
)
srt_query <- RunKNNMap(srt_query = pancreas_sub, srt_ref = panc8_rename, ref_umap = "SeuratUMAP2D")
ProjectionPlot( #这个会报错
srt_query = srt_query, srt_ref = panc8_rename,
query_group = "SubCellType", ref_group = "celltype"
)
pancreas_sub <- RunPAGA(
srt = pancreas_sub, group_by = "SubCellType",
linear_reduction = "PCA", nonlinear_reduction = "UMAP"
)
PAGAPlot(srt = pancreas_sub, reduction = "UMAP", label = TRUE, label_insitu = TRUE, label_repel = TRUE)
pancreas_sub <- RunSCVELO(
srt = pancreas_sub, group_by = "SubCellType",
linear_reduction = "PCA", nonlinear_reduction = "UMAP"
)
VelocityPlot(srt = pancreas_sub, reduction = "UMAP", group_by = "SubCellType")
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!
