内容

1简介

类的基本功能和用法的概述scds包,它与SingleCellExperiment对象。

2安装

安装scds使用Bioconductor的包装:

如果(!requireNamespace("BiocManager", quiet = TRUE)) install.packages("BiocManager")::install("scds", version = "3.9")

或者来自github:

库(devtools) devtools:: install_github (kostkalab / scds)

3.快速启动

scds作为输入SingleCellExperiment对象(参见此处)SingleCellExperiment),其中原始计数存储在计数分析,即。“计数”试验(sce).通过对单元格哈希单元行数据集进行子抽样创建的示例数据集(请参阅https://satijalab.org/seurat/hashing_vignette.html),并可经由数据(sce).Note,scds设计用于较大的数据集,但出于本文的目的,我们使用较小的示例数据集。我们应用scds对该数据进行比较/可视化结果:

3.1示例数据集

获取随包提供的示例数据集。

library(scds) library(scater) library(rsvd) library(Rtsne) library(cowplot) set.seed(30519) data("sce_chcl") sce = sce_chcl #- less typing dim(sce)
## [1] 2000 2000

我们看到它包含2000个基因和2000个细胞,其中216个被鉴定为双体:

表(sce hto_classification_global美元)
## ##双态负单态## 216 83 1701

我们可以在投影到二维后看到细胞/双峰:

logcounts(sce) = log1p(counts(sce)) vrs = apply(logcounts(sce),1,var) pc = rpca(t(logcounts(sce)[order(vrs,递减=TRUE)[1:10],]) ts = Rtsne(pc$x[,1:10],动词=FALSE) reducedDim(sce,"tsne") = ts$Y;rm (ts、工具与pc) plotReducedDim(,“tsne color_by =“hto_classification_global”)

3.2计算双态注释

我们现在运行scds双态注释方法。简单地说,我们用两种互补的方式来识别双重态:cxds是基于基因对的共同表达,只适用于缺席/出现呼叫,而bcd使用完整的计数信息和使用人工生成的双态的二进制分类方法。cxds_bcds_hybrid结合两种方法,更多细节请咨询(手稿).这三种方法中的每一种都返回一个双态分数,分数越高表示“类双态”条形码越多。

#-使用基于共表达式的双元标记双元:sce = cxds(sce,retRes =TRUE) sce = bcds(sce,retRes =TRUE,verb=TRUE) sce = cxds_bcds_hybrid(sce) par(mfcol=c(1,3)) boxplot(sce$cxds_score ~ sce$doublet_true_labels, main="cxds") boxplot(sce$bcds_score ~ sce$doublet_true_labels, main="bcds") boxplot(sce$hybrid_score ~ sce$doublet_true_labels, main="bcds") boxplot(sce$hybrid_score ~ sce$doublet_true_labels, main="bcds")

3.3基因对可视化

cxds我们可以识别和可视化驱动双态注释的基因对,期望一对中的两个基因可能标记不同类型的细胞(看到手稿).下面我们来看看前三对基因,每对基因在下图中是一行:

scds = top3 =元数据(sce)$cxds$topPairs[1:3,] rs = rownames(sce) hb = rowData(sce)$cxds_hvg_bool ho = rowData(sce)$cxds_hvg_ordr[hb] hgs = rs[ho] l1 = ggdraw() + draw_text("Pair 1", x = 0.5, y= 0.5) p1 = plotReducedDim(sce,"tsne",color_by=hgs[top3[1,1]]) p2 = plotReducedDim(sce,"tsne",color_by=hgs[top3[1,2]]) l2 = ggdraw() + draw_text("Pair 2", x = 0.5,y= 0.5) p3 = plotReducedDim(sce,"tsne",color_by=hgs[top3[2,1]]) p4 = plotReducedDim(sce,"tsne",color_by=hgs[top3[3,2]]) l3 = ggdraw() + draw_text("Pair 3", x = 0.5, y= 0.5) p5 = plotReducedDim(sce,"tsne",color_by=hgs[top3[3,1]]) p6 = plotReducedDim(sce," tse ",color_by=hgs[top3[3,2]]) plot_grid(l1,p1,p2,l2,p3,p4,l3,p5,p6,ncol=3, rel_width = c(1,2,2))

4会话信息

sessionInfo ()
## R版本4.2.1(2022-06-23)##平台:x86_64-pc-linux-gnu(64位)##运行在Ubuntu 20.04.5 LTS ## ##矩阵产品:默认## BLAS: /home/biocbuild/bbs-3.16-bioc/R/lib/libRblas。/home/biocbuild/bbs-3.16-bioc/R/lib/libRlapack。所以## ## locale: ## [1] LC_CTYPE=en_US。UTF-8 LC_NUMERIC= c# # [3] LC_TIME=en_GB LC_COLLATE= c# # [5] LC_MONETARY=en_US。utf - 8 LC_MESSAGES = en_US。UTF-8 ## [7] LC_PAPER=en_US。UTF-8 LC_NAME= c# # [9] LC_ADDRESS=C lc_phone = c# # [11] LC_MEASUREMENT=en_US。UTF-8 LC_IDENTIFICATION=C ## ##附加的基本包:## [1]stats4 stats graphics grDevices utils datasets methods ##[8]基础## ##其他附加包:[7] SingleCellExperiment_1.20.0 SummarizedExperiment_1.28.0 ## [9] Biobase_2.58.0 GenomicRanges_1.50.0 ## [11] GenomeInfoDb_1.34.0 IRanges_2.32.0 ## [13] S4Vectors_0.36.0 BiocGenerics_0.44.0 ## [15] MatrixGenerics_1.10.0 matrixStats_0.62.0 ## [17] scds_1.14.0 BiocStyle_2.26.0 ## ##通过命名空间加载(并且没有附加):## [15] BiocNeighbors_1.16.0 DelayedArray_0.24.0 ## [17] labeling_0.4.2 bookdown_0.29 ## [19] sass_0.4.2 scales_1.2.1 ## [23] rmarkdown_2.17 XVector_0.38.0 ## [25] pkgconfig_2.0.3 htmltools_0.5.3 ## [27] sparseMatrixStats_1.10.0 ## [9] colorspace_2.0-3 withr_2.5.0 ## [11] tidyselect_1.2.0 gridExtra_2.3 ## [13] compiler_4.2.1 cli_3.4.1 ## [15] BiocNeighbors_1.16.0 DelayedArray_0.24.0 ## [17] labeling_0.4.2 bookdown_0.29 ## [23] rmarkdown_2.17 XVector_0.38.0 ## [25] pkgconfig_2.0.3 htmltools_0.5.3 ## [27] sparseMatrixStats_1.10.0 ##[31] DelayedMatrixStats_1.20.0 jquerylib_0.1.4 ## [33] generics_0.1.3 farver_2.1.1 ## [35] jsonlite_1.8.3 BiocParallel_1.32.0 ## [37] dplyr_1.0.10 RCurl_1.98-1.9 ## [39] magrittr_2.0.3 BiocSingular_1.14.0 ## [41] GenomeInfoDbData_1.2.9 Matrix_1.5-1 ## [43] Rcpp_1.0.9 ggbeeswarm_0.6.0 ## [45] munsell_0.5.0 fansi_1.0.3 ## [47] viridis_0.6.2 lifecycle_1.0.3 ## [49] stringi_1.7.8 pROC_1.18.0 ## b[51] yaml_2.3.6 zlibbioc_1.44.0 ## [53] plyr_1.8.7[63] codetools_0.2-18 ScaledMatrix_1.6.0 ## [67] data.table_1.14.4 BiocManager_1.30.19 ## [69] vctrs_0.5.0 gtable_0.3.1 ## [71] assertthat_0.2.1 cachem_1.0.6 ## [73] xfun_0.34 viridisLite_0.4.1 ## [75] tibble_3.1.8 beeswarm_0.4.0