Contents

1 Introduction

Dropout events make the lowly expressed genes indistinguishable from true zero expression and different from the low expression in cells of the same type. This issue makes any subsequent downstream analysis difficult. ccImpute(Malec, Kurban, and Dalkilic 2022) is an imputation tool that uses cell similarity established by consensus clustering to impute the most probable dropout events in the scRNA-seq datasets. ccImpute demonstrates performance which exceeds the performance of existing imputation approaches while introducing the least amount of new noise as measured by clustering performance characteristics on datasets with known cell identities.

1.1 Installation.

To install this package, start R (version "4.2") and enter:
if (!require("BiocManager", quietly = TRUE))
    install.packages("BiocManager")

BiocManager::install("ccImpute")

2 Data Pre-processing

ccImpute is an imputation tool that does not provide functions for pre-processing the data. This tool expects the user to pre-process the data before using it. The input data is expected to be in a log-normalized format. This manual includes sample minimal pre-processing of a dataset from scRNAseq database using the scater tool.

3 Sample Usage

3.1 Required libraries

library(scRNAseq)
library(scater)
library(ccImpute)
library(SingleCellExperiment)
library(stats)
library(mclust)

3.2 Input Data.

The following code loads Darmanis dataset(Darmanis et al. 2015) and computes log-transformed normalized counts:

sce <- DarmanisBrainData()
sce <- logNormCounts(sce)

3.3 Pre-processing data.

A user may consider performing feature selection prior to running the imputation. ccImpute only imputes the most probable dropout events and is unlikely to benefit from the presence of scarcely expressed genes nor make any correctio ns to their expression.

3.4 Adjusted Rand Index (ARI)

Adjusted Rand Index is a measure of the similarity between two data clusterings adjusted for the chance grouping of elements. This measure allows us to evaluate the performance of the clustering algorithm as a similarity to the optimal clustering assignments derived from cell labels.

3.5 Compute Adjusted Rand Index (ARI) without imputation.

# Set seed for reproducibility purposes.
set.seed(0) 
# Compute PCA reduction of the dataset
reducedDims(sce) <- list(PCA=prcomp(t(logcounts(sce)))$x)

# Get an actual number of cell types
k <- length(unique(colData(sce)$cell.type))

# Cluster the PCA reduced dataset and store the assignments
set.seed(0) 
assgmts <- kmeans(reducedDim(sce, "PCA"), centers = k, iter.max = 1e+09,
    nstart = 1000)$cluster

# Use ARI to compare the k-means assignments to label assignments
adjustedRandIndex(assgmts, colData(sce)$cell.type)
#> [1] 0.5206793

3.6 Perform the imputation and update the logcounts assay.

assay(sce, "imputed") <- ccImpute(logcounts(sce), k = k)
#> Running ccImpute on dataset with 466 cells.
#> Imputation finished.

3.7 Re-compute Adjusted Rand Index (ARI) with imputation.

# Recompute PCA reduction of the dataset
reducedDim(sce, "PCA_imputed") <- prcomp(t(assay(sce, "imputed")))$x

# Cluster the PCA reduced dataset and store the assignments
assgmts <- kmeans(reducedDim(sce, "PCA_imputed"), centers = k, iter.max = 1e+09,
    nstart = 1000)$cluster

# Use ARI to compare the k-means assignments to label assignments
adjustedRandIndex(assgmts, colData(sce)$cell.type)
#> [1] 0.697712

4 R session information.

#> ─ Session info ───────────────────────────────────────────────────────────────────────────────────────────────────────
#>  setting  value
#>  version  R version 4.3.1 (2023-06-16)
#>  os       Ubuntu 22.04.3 LTS
#>  system   x86_64, linux-gnu
#>  ui       X11
#>  language (EN)
#>  collate  C
#>  ctype    en_US.UTF-8
#>  tz       America/New_York
#>  date     2023-10-24
#>  pandoc   2.7.3 @ /usr/bin/ (via rmarkdown)
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────────────────────────────────────────────
#>  package                * version   date (UTC) lib source
#>  abind                    1.4-5     2016-07-21 [2] CRAN (R 4.3.1)
#>  AnnotationDbi            1.64.0    2023-10-24 [2] Bioconductor
#>  AnnotationFilter         1.26.0    2023-10-24 [2] Bioconductor
#>  AnnotationHub            3.10.0    2023-10-24 [2] Bioconductor
#>  beachmat                 2.18.0    2023-10-24 [2] Bioconductor
#>  beeswarm                 0.4.0     2021-06-01 [2] CRAN (R 4.3.1)
#>  Biobase                * 2.62.0    2023-10-24 [2] Bioconductor
#>  BiocFileCache            2.10.0    2023-10-24 [2] Bioconductor
#>  BiocGenerics           * 0.48.0    2023-10-24 [2] Bioconductor
#>  BiocIO                   1.12.0    2023-10-24 [2] Bioconductor
#>  BiocManager              1.30.22   2023-08-08 [2] CRAN (R 4.3.1)
#>  BiocNeighbors            1.20.0    2023-10-24 [2] Bioconductor
#>  BiocParallel             1.36.0    2023-10-24 [2] Bioconductor
#>  BiocSingular             1.18.0    2023-10-24 [2] Bioconductor
#>  BiocStyle              * 2.30.0    2023-10-24 [2] Bioconductor
#>  BiocVersion              3.18.0    2023-10-24 [2] Bioconductor
#>  biomaRt                  2.58.0    2023-10-24 [2] Bioconductor
#>  Biostrings               2.70.0    2023-10-24 [2] Bioconductor
#>  bit                      4.0.5     2022-11-15 [2] CRAN (R 4.3.1)
#>  bit64                    4.0.5     2020-08-30 [2] CRAN (R 4.3.1)
#>  bitops                   1.0-7     2021-04-24 [2] CRAN (R 4.3.1)
#>  blob                     1.2.4     2023-03-17 [2] CRAN (R 4.3.1)
#>  bookdown                 0.36      2023-10-16 [2] CRAN (R 4.3.1)
#>  bslib                    0.5.1     2023-08-11 [2] CRAN (R 4.3.1)
#>  cachem                   1.0.8     2023-05-01 [2] CRAN (R 4.3.1)
#>  ccImpute               * 1.4.0     2023-10-24 [1] Bioconductor
#>  cli                      3.6.1     2023-03-23 [2] CRAN (R 4.3.1)
#>  codetools                0.2-19    2023-02-01 [3] CRAN (R 4.3.1)
#>  colorspace               2.1-0     2023-01-23 [2] CRAN (R 4.3.1)
#>  crayon                   1.5.2     2022-09-29 [2] CRAN (R 4.3.1)
#>  curl                     5.1.0     2023-10-02 [2] CRAN (R 4.3.1)
#>  DBI                      1.1.3     2022-06-18 [2] CRAN (R 4.3.1)
#>  dbplyr                   2.3.4     2023-09-26 [2] CRAN (R 4.3.1)
#>  DelayedArray             0.28.0    2023-10-24 [2] Bioconductor
#>  DelayedMatrixStats       1.24.0    2023-10-24 [2] Bioconductor
#>  digest                   0.6.33    2023-07-07 [2] CRAN (R 4.3.1)
#>  dplyr                    1.1.3     2023-09-03 [2] CRAN (R 4.3.1)
#>  ellipsis                 0.3.2     2021-04-29 [2] CRAN (R 4.3.1)
#>  ensembldb                2.26.0    2023-10-24 [2] Bioconductor
#>  evaluate                 0.22      2023-09-29 [2] CRAN (R 4.3.1)
#>  ExperimentHub            2.10.0    2023-10-24 [2] Bioconductor
#>  fansi                    1.0.5     2023-10-08 [2] CRAN (R 4.3.1)
#>  fastmap                  1.1.1     2023-02-24 [2] CRAN (R 4.3.1)
#>  filelock                 1.0.2     2018-10-05 [2] CRAN (R 4.3.1)
#>  generics                 0.1.3     2022-07-05 [2] CRAN (R 4.3.1)
#>  GenomeInfoDb           * 1.38.0    2023-10-24 [2] Bioconductor
#>  GenomeInfoDbData         1.2.11    2023-10-17 [2] Bioconductor
#>  GenomicAlignments        1.38.0    2023-10-24 [2] Bioconductor
#>  GenomicFeatures          1.54.0    2023-10-24 [2] Bioconductor
#>  GenomicRanges          * 1.54.0    2023-10-24 [2] Bioconductor
#>  ggbeeswarm               0.7.2     2023-04-29 [2] CRAN (R 4.3.1)
#>  ggplot2                * 3.4.4     2023-10-12 [2] CRAN (R 4.3.1)
#>  ggrepel                  0.9.4     2023-10-13 [2] CRAN (R 4.3.1)
#>  glue                     1.6.2     2022-02-24 [2] CRAN (R 4.3.1)
#>  gridExtra                2.3       2017-09-09 [2] CRAN (R 4.3.1)
#>  gtable                   0.3.4     2023-08-21 [2] CRAN (R 4.3.1)
#>  hms                      1.1.3     2023-03-21 [2] CRAN (R 4.3.1)
#>  htmltools                0.5.6.1   2023-10-06 [2] CRAN (R 4.3.1)
#>  httpuv                   1.6.12    2023-10-23 [2] CRAN (R 4.3.1)
#>  httr                     1.4.7     2023-08-15 [2] CRAN (R 4.3.1)
#>  interactiveDisplayBase   1.40.0    2023-10-24 [2] Bioconductor
#>  IRanges                * 2.36.0    2023-10-24 [2] Bioconductor
#>  irlba                    2.3.5.1   2022-10-03 [2] CRAN (R 4.3.1)
#>  jquerylib                0.1.4     2021-04-26 [2] CRAN (R 4.3.1)
#>  jsonlite                 1.8.7     2023-06-29 [2] CRAN (R 4.3.1)
#>  KEGGREST                 1.42.0    2023-10-24 [2] Bioconductor
#>  knitr                    1.44      2023-09-11 [2] CRAN (R 4.3.1)
#>  later                    1.3.1     2023-05-02 [2] CRAN (R 4.3.1)
#>  lattice                  0.22-5    2023-10-24 [3] CRAN (R 4.3.1)
#>  lazyeval                 0.2.2     2019-03-15 [2] CRAN (R 4.3.1)
#>  lifecycle                1.0.3     2022-10-07 [2] CRAN (R 4.3.1)
#>  magrittr                 2.0.3     2022-03-30 [2] CRAN (R 4.3.1)
#>  Matrix                   1.6-1.1   2023-09-18 [3] CRAN (R 4.3.1)
#>  MatrixGenerics         * 1.14.0    2023-10-24 [2] Bioconductor
#>  matrixStats            * 1.0.0     2023-06-02 [2] CRAN (R 4.3.1)
#>  mclust                 * 6.0.0     2022-10-31 [2] CRAN (R 4.3.1)
#>  memoise                  2.0.1     2021-11-26 [2] CRAN (R 4.3.1)
#>  mime                     0.12      2021-09-28 [2] CRAN (R 4.3.1)
#>  munsell                  0.5.0     2018-06-12 [2] CRAN (R 4.3.1)
#>  pillar                   1.9.0     2023-03-22 [2] CRAN (R 4.3.1)
#>  pkgconfig                2.0.3     2019-09-22 [2] CRAN (R 4.3.1)
#>  png                      0.1-8     2022-11-29 [2] CRAN (R 4.3.1)
#>  pracma                   2.4.2     2022-09-22 [2] CRAN (R 4.3.1)
#>  prettyunits              1.2.0     2023-09-24 [2] CRAN (R 4.3.1)
#>  progress                 1.2.2     2019-05-16 [2] CRAN (R 4.3.1)
#>  promises                 1.2.1     2023-08-10 [2] CRAN (R 4.3.1)
#>  ProtGenerics             1.34.0    2023-10-24 [2] Bioconductor
#>  purrr                    1.0.2     2023-08-10 [2] CRAN (R 4.3.1)
#>  R6                       2.5.1     2021-08-19 [2] CRAN (R 4.3.1)
#>  rappdirs                 0.3.3     2021-01-31 [2] CRAN (R 4.3.1)
#>  Rcpp                     1.0.11    2023-07-06 [2] CRAN (R 4.3.1)
#>  RcppAnnoy                0.0.21    2023-07-02 [2] CRAN (R 4.3.1)
#>  RCurl                    1.98-1.12 2023-03-27 [2] CRAN (R 4.3.1)
#>  restfulr                 0.0.15    2022-06-16 [2] CRAN (R 4.3.1)
#>  rjson                    0.2.21    2022-01-09 [2] CRAN (R 4.3.1)
#>  rlang                    1.1.1     2023-04-28 [2] CRAN (R 4.3.1)
#>  rmarkdown                2.25      2023-09-18 [2] CRAN (R 4.3.1)
#>  Rsamtools                2.18.0    2023-10-24 [2] Bioconductor
#>  RSpectra                 0.16-1    2022-04-24 [2] CRAN (R 4.3.1)
#>  RSQLite                  2.3.1     2023-04-03 [2] CRAN (R 4.3.1)
#>  rsvd                     1.0.5     2021-04-16 [2] CRAN (R 4.3.1)
#>  rtracklayer              1.62.0    2023-10-24 [2] Bioconductor
#>  S4Arrays                 1.2.0     2023-10-24 [2] Bioconductor
#>  S4Vectors              * 0.40.0    2023-10-24 [2] Bioconductor
#>  sass                     0.4.7     2023-07-15 [2] CRAN (R 4.3.1)
#>  ScaledMatrix             1.10.0    2023-10-24 [2] Bioconductor
#>  scales                   1.2.1     2022-08-20 [2] CRAN (R 4.3.1)
#>  scater                 * 1.30.0    2023-10-24 [2] Bioconductor
#>  scRNAseq               * 2.15.0    2023-10-24 [2] Bioconductor
#>  scuttle                * 1.12.0    2023-10-24 [2] Bioconductor
#>  sessioninfo            * 1.2.2     2021-12-06 [2] CRAN (R 4.3.1)
#>  shiny                    1.7.5.1   2023-10-14 [2] CRAN (R 4.3.1)
#>  SIMLR                    1.28.0    2023-10-24 [2] Bioconductor
#>  SingleCellExperiment   * 1.24.0    2023-10-24 [2] Bioconductor
#>  SparseArray              1.2.0     2023-10-24 [2] Bioconductor
#>  sparseMatrixStats        1.14.0    2023-10-24 [2] Bioconductor
#>  stringi                  1.7.12    2023-01-11 [2] CRAN (R 4.3.1)
#>  stringr                  1.5.0     2022-12-02 [2] CRAN (R 4.3.1)
#>  SummarizedExperiment   * 1.32.0    2023-10-24 [2] Bioconductor
#>  tibble                   3.2.1     2023-03-20 [2] CRAN (R 4.3.1)
#>  tidyselect               1.2.0     2022-10-10 [2] CRAN (R 4.3.1)
#>  utf8                     1.2.4     2023-10-22 [2] CRAN (R 4.3.1)
#>  vctrs                    0.6.4     2023-10-12 [2] CRAN (R 4.3.1)
#>  vipor                    0.4.5     2017-03-22 [2] CRAN (R 4.3.1)
#>  viridis                  0.6.4     2023-07-22 [2] CRAN (R 4.3.1)
#>  viridisLite              0.4.2     2023-05-02 [2] CRAN (R 4.3.1)
#>  withr                    2.5.1     2023-09-26 [2] CRAN (R 4.3.1)
#>  xfun                     0.40      2023-08-09 [2] CRAN (R 4.3.1)
#>  XML                      3.99-0.14 2023-03-19 [2] CRAN (R 4.3.1)
#>  xml2                     1.3.5     2023-07-06 [2] CRAN (R 4.3.1)
#>  xtable                   1.8-4     2019-04-21 [2] CRAN (R 4.3.1)
#>  XVector                  0.42.0    2023-10-24 [2] Bioconductor
#>  yaml                     2.3.7     2023-01-23 [2] CRAN (R 4.3.1)
#>  zlibbioc                 1.48.0    2023-10-24 [2] Bioconductor
#> 
#>  [1] /tmp/RtmpvUM4f4/Rinst2387527cf3dfb2
#>  [2] /home/biocbuild/bbs-3.18-bioc/R/site-library
#>  [3] /home/biocbuild/bbs-3.18-bioc/R/library
#> 
#> ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

References

Darmanis, Spyros, Steven A Sloan, Ye Zhang, Martin Enge, Christine Caneda, Lawrence M Shuer, Melanie G Hayden Gephart, Ben A Barres, and Stephen R Quake. 2015. “A Survey of Human Brain Transcriptome Diversity at the Single Cell Level.” Proceedings of the National Academy of Sciences 112 (23): 7285–90.

Malec, Marcin, Hasan Kurban, and Mehmet Dalkilic. 2022. “CcImpute: An Accurate and Scalable Consensus Clustering Based Algorithm to Impute Dropout Events in the Single-Cell Rna-Seq Data.” BMC Bioinformatics 23 (1): 1–17.