# #设置,包括= FALSE ----------------------------------------------------- knitr: opts_chunk美元集(呼应= TRUE, dev = " png ") ## ---- 负载,eval = TRUE,消息= FALSE ------------------------------------------- 库(celda) # #——sce_import eval = FALSE ------------------------------------------------- # 南加州爱迪生公司库(singleCellTK) # < - importCellRanger (sampleDirs = c(“路径/ / sample1 /”、“路径/ / sample2 /")) ## ---- sce_import_raw eval = FALSE --------------------------------------------- # 南加州爱迪生公司。raw <- importCellRanger(sampleDirs = c("path/to/sample1/", "path/to/sample2/"), dataType = "raw") ## ----load_10X, eval=TRUE, message=FALSE--------------------------------------- #加载PBMC数据库(TENxPBMCData) sce <- TENxPBMCData("pbmc4k") colnames(sce) <- paste(sce$Sample, sce$Barcode, sep = "_") rownames(sce) <- rowData(sce)$Symbol_TENx counts(sce) <- as(counts(sce), "dgCMatrix") ## ----decontX, eval=TRUE,消息= FALSE ---------------------------------------- 南加州爱迪生公司< - decontX (sce) # #——decontX_background eval = FALSE,消息= FALSE ---------------------------- # 南加州爱迪生公司< - decontX (sce、背景= sce.raw) # #——UMAP_Clusters ------------------------------------------------------------ decontX_UMAP“umap < - reducedDim (sce) plotDimReduceCluster (x = sce decontX_clusters美元,dim1 = umap [1], dim2 = umap [,2 ]) ## ---- plot_decon --------------------------------------------------------------- plotDecontXContamination (sce) # #——plot_feature消息= FALSE ---------------------------------------------- 南加州爱迪生公司库(嘘)< - logNormCounts (sce) plotDimReduceFeature (as.matrix (logcounts (sce)), dim1 = umap [1], dim2 = umap[2],特性= c(“CD3D”、“CD3E”,“gn”,“LYZ”,“S100A8”,“S100A9”,“CD79A”,“CD79B”,“MS4A1”),exactMatch = TRUE) ## ----barplotCounts------------------------------------------------------------ marker <- list(Tcell_Markers = c("CD3E", "CD3D"), Bcell_Markers = c("CD79A", "CD79B", "MS4A1"), Monocyte_Markers = c("S100A8", "S100A9", "LYZ"), NKcell_Markers = "GNLY") celltypemaps <- list(Tcells = 2, Bcells = 5, monocyte = 1, NKcells = 6) plotDecontXMarkerPercentage(sce, markers = markers, groupClusters = celltypemaps,assayName = "计数 ") ## ---- barplotDecontCounts ------------------------------------------------------ plotDecontXMarkerPercentage(=标记,标记,groupClusters = cellTypeMappings assayName = " decontXcounts ") ## ---- barplotBoth -------------------------------------------------------------- plotDecontXMarkerPercentage(=标记,标记,groupClusters = cellTypeMappings assayName = c(“计数”,“decontXcounts ")) ## ---- plotDecontXMarkerExpression ---------------------------------------------- plotDecontXMarkerExpression(=标记,标记[[“Monocyte_Markers”]],groupClusters = cellTypeMappings ncol = 3) # #——plot_norm_counts eval = TRUE -------------------------------------------- 南加州爱迪生公司库(嘘)< - logNormCounts (sce exprs_values =“decontXcounts”,name = " decontXlogcounts ") plotDecontXMarkerExpression(=标记,标记[[“Monocyte_Markers”]],groupClusters = cellTypeMappings ncol = 3, assayName = c(“logcounts”、“decontXlogcounts ")) ## ---- findDelta ---------------------------------------------------------------- 元数据(sce) decontX估计all_cellsδ# #美元美元,newDecontX eval = TRUE,消息= FALSE ------------------------------------- sce.delta < - decontX (sceδ= c(9日20),estimateDelta = FALSE)情节(sce decontX_contamination美元,sce.delta decontX_contamination美元,xlab =“decontX先验估计”,ylab = "设置先验以估计更高的污染")abline(0,1, col = "red", lwd = 2) ## ----seurat_create,eval = FALSE ---------------------------------------------- # # 从CellRanger读计数输出#库(修)#计数< - Read10X(“样品/细节/ filtered_feature_bc_matrix /") # # # 创建一个SingleCellExperiment对象和运行decontX # sce < - SingleCellExperiment南加州爱迪生公司(列表(数量=计数))# < - decontX (sce) # # #创建一个修对象从sce decontX结果# seuratObject < - CreateSeuratObject(圆(decontXcounts (sce ))) ## ---- seurat_raw,eval = FALSE ------------------------------------------------- # 计数。raw <- Read10X("sample/outs/raw_feature_bc_matrix/") # sce。raw <- SingleCellExperiment(list(counts = counts.raw)) # sce <- decontX(sce, background = sce.raw) ## ----seurat_create2, eval = FALSE--------------------------------------------- # counts <- GetAssayData(object = seuratObject, slot = "counts") # sce <- SingleCellExperiment(list(counts = counts)) # sce <- decontX(sce) # seuratObj[["decontXcounts"]] <- CreateAssayObject(counts = decontXcounts(sce)) ## ----------------------------------------------------------------------------- sessionInfo()