SCP 安装成功的单细胞转录组 docker镜像使用 single-cell-v5

SCP


# 使用 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")



添加 splice 和unsplice  assay

Rscript $scripts/add_usAssay_ToSeuratObj.r -i subset.T.qs -l ../01.cellranger/pbmc_ctrl/velocyto/pbmc_ctrl.loom \
  ../01.cellranger/pbmc_stim/velocyto/pbmc_stim.loom -p subset.T.US
  
R 代码
obj=qread("subset.T.US.qs")
#bm Assay5转换成 Assay
obj[["RNA4"]] <- as(object = obj[["RNA"]], Class = "Assay")
DefaultAssay(obj)<-"RNA4"
obj <- RunPAGA(
  srt = obj, group_by = "mycelltype",assay_X = "RNA4",
  assay_layers = c("spliced", "unspliced"),
  slot_layers = "counts",
  linear_reduction = "pca", nonlinear_reduction = "umap"
)
PAGAPlot(srt = obj, reduction = "UMAP", label = TRUE, label_insitu = TRUE, label_repel = TRUE)

attachments-2025-12-ZdZYqbgF6933f91929fa9.png






obj <- RunSCVELO(
  srt = obj, group_by = "mycelltype",assay_X = "RNA4",
  linear_reduction = "pca", nonlinear_reduction = "umap"
)
VelocityPlot(srt = obj, reduction = "umap", group_by = "mycelltype")
VelocityPlot(srt = obj, reduction = "umap", plot_type = "stream")

attachments-2025-12-yNf8FZFH6933f9ea2faeb.pngattachments-2025-12-C2k03X6x6933f9f0b52f5.png
attachments-2025-12-1jqGl9ly6933f9d0b7be8.png

attachments-2025-12-f16O5SzR6933f99a2d1b0.png
attachments-2025-12-EZJ9kogt6933f981d0ed0.png



  obj <- RunMonocle3(srt = obj, reduction = "umap")
  names(obj@tools$Monocle3)
  trajectory <- obj@tools$Monocle3$trajectory
  milestones <- obj@tools$Monocle3$milestones
  
  CellDimPlot(obj, group.by = "Monocle3_partitions", reduction = "UMAP", label = TRUE, theme_use = "theme_blank") + trajectory + milestones
  CellDimPlot(obj, group.by = "Monocle3_clusters", reduction = "UMAP", label = TRUE, theme_use = "theme_blank") + trajectory
  FeatureDimPlot(obj, features = "Monocle3_Pseudotime", reduction = "UMAP", theme_use = "theme_blank") + trajectory
  

attachments-2025-12-GwOopB4m6933fb37707f1.png




  • 发表于 2025-12-05 20:00
  • 阅读 ( 358 )
  • 分类:转录组

0 条评论

请先 登录 后评论
omicsgene
omicsgene

生物信息

750 篇文章

作家榜 »

  1. omicsgene 750 文章
  2. 安生水 367 文章
  3. Daitoue 167 文章
  4. 生物女学霸 120 文章
  5. xun 94 文章
  6. rzx 87 文章
  7. 红橙子 81 文章
  8. Ti Amo 74 文章