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.7035672

4 R session information.

#> ─ Session info ───────────────────────────────────────────────────────────────────────────────────────────────────────
#>  setting  value
#>  version  R Under development (unstable) (2023-10-22 r85388)
#>  os       Ubuntu 22.04.3 LTS
#>  system   x86_64, linux-gnu
#>  ui       X11
#>  language (EN)
#>  collate  en_US.UTF-8
#>  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.4.0)
#>  AnnotationDbi            1.65.0    2023-10-24 [2] Bioconductor
#>  AnnotationFilter         1.27.0    2023-10-24 [2] Bioconductor
#>  AnnotationHub            3.11.0    2023-10-24 [2] Bioconductor
#>  beachmat                 2.19.0    2023-10-24 [2] Bioconductor
#>  beeswarm                 0.4.0     2021-06-01 [2] CRAN (R 4.4.0)
#>  Biobase                * 2.63.0    2023-10-24 [2] Bioconductor
#>  BiocFileCache            2.11.0    2023-10-24 [2] Bioconductor
#>  BiocGenerics           * 0.49.0    2023-10-24 [2] Bioconductor
#>  BiocIO                   1.13.0    2023-10-24 [2] Bioconductor
#>  BiocManager              1.30.22   2023-08-08 [2] CRAN (R 4.4.0)
#>  BiocNeighbors            1.21.0    2023-10-24 [2] Bioconductor
#>  BiocParallel             1.37.0    2023-10-24 [2] Bioconductor
#>  BiocSingular             1.19.0    2023-10-24 [2] Bioconductor
#>  BiocStyle              * 2.31.0    2023-10-24 [2] Bioconductor
#>  BiocVersion              3.19.0    2023-10-24 [2] Bioconductor
#>  biomaRt                  2.59.0    2023-10-24 [2] Bioconductor
#>  Biostrings               2.71.0    2023-10-24 [2] Bioconductor
#>  bit                      4.0.5     2022-11-15 [2] CRAN (R 4.4.0)
#>  bit64                    4.0.5     2020-08-30 [2] CRAN (R 4.4.0)
#>  bitops                   1.0-7     2021-04-24 [2] CRAN (R 4.4.0)
#>  blob                     1.2.4     2023-03-17 [2] CRAN (R 4.4.0)
#>  bookdown                 0.36      2023-10-16 [2] CRAN (R 4.4.0)
#>  bslib                    0.5.1     2023-08-11 [2] CRAN (R 4.4.0)
#>  cachem                   1.0.8     2023-05-01 [2] CRAN (R 4.4.0)
#>  ccImpute               * 1.5.0     2023-10-24 [1] Bioconductor
#>  cli                      3.6.1     2023-03-23 [2] CRAN (R 4.4.0)
#>  codetools                0.2-19    2023-02-01 [3] CRAN (R 4.4.0)
#>  colorspace               2.1-0     2023-01-23 [2] CRAN (R 4.4.0)
#>  crayon                   1.5.2     2022-09-29 [2] CRAN (R 4.4.0)
#>  curl                     5.1.0     2023-10-02 [2] CRAN (R 4.4.0)
#>  DBI                      1.1.3     2022-06-18 [2] CRAN (R 4.4.0)
#>  dbplyr                   2.3.4     2023-09-26 [2] CRAN (R 4.4.0)
#>  DelayedArray             0.29.0    2023-10-24 [2] Bioconductor
#>  DelayedMatrixStats       1.25.0    2023-10-24 [2] Bioconductor
#>  digest                   0.6.33    2023-07-07 [2] CRAN (R 4.4.0)
#>  dplyr                    1.1.3     2023-09-03 [2] CRAN (R 4.4.0)
#>  ellipsis                 0.3.2     2021-04-29 [2] CRAN (R 4.4.0)
#>  ensembldb                2.27.0    2023-10-24 [2] Bioconductor
#>  evaluate                 0.22      2023-09-29 [2] CRAN (R 4.4.0)
#>  ExperimentHub            2.11.0    2023-10-24 [2] Bioconductor
#>  fansi                    1.0.5     2023-10-08 [2] CRAN (R 4.4.0)
#>  fastmap                  1.1.1     2023-02-24 [2] CRAN (R 4.4.0)
#>  filelock                 1.0.2     2018-10-05 [2] CRAN (R 4.4.0)
#>  generics                 0.1.3     2022-07-05 [2] CRAN (R 4.4.0)
#>  GenomeInfoDb           * 1.39.0    2023-10-24 [2] Bioconductor
#>  GenomeInfoDbData         1.2.11    2023-10-23 [2] Bioconductor
#>  GenomicAlignments        1.39.0    2023-10-24 [2] Bioconductor
#>  GenomicFeatures          1.55.0    2023-10-24 [2] Bioconductor
#>  GenomicRanges          * 1.55.0    2023-10-24 [2] Bioconductor
#>  ggbeeswarm               0.7.2     2023-04-29 [2] CRAN (R 4.4.0)
#>  ggplot2                * 3.4.4     2023-10-12 [2] CRAN (R 4.4.0)
#>  ggrepel                  0.9.4     2023-10-13 [2] CRAN (R 4.4.0)
#>  glue                     1.6.2     2022-02-24 [2] CRAN (R 4.4.0)
#>  gridExtra                2.3       2017-09-09 [2] CRAN (R 4.4.0)
#>  gtable                   0.3.4     2023-08-21 [2] CRAN (R 4.4.0)
#>  hms                      1.1.3     2023-03-21 [2] CRAN (R 4.4.0)
#>  htmltools                0.5.6.1   2023-10-06 [2] CRAN (R 4.4.0)
#>  httpuv                   1.6.12    2023-10-23 [2] CRAN (R 4.4.0)
#>  httr                     1.4.7     2023-08-15 [2] CRAN (R 4.4.0)
#>  interactiveDisplayBase   1.41.0    2023-10-24 [2] Bioconductor
#>  IRanges                * 2.37.0    2023-10-24 [2] Bioconductor
#>  irlba                    2.3.5.1   2022-10-03 [2] CRAN (R 4.4.0)
#>  jquerylib                0.1.4     2021-04-26 [2] CRAN (R 4.4.0)
#>  jsonlite                 1.8.7     2023-06-29 [2] CRAN (R 4.4.0)
#>  KEGGREST                 1.43.0    2023-10-24 [2] Bioconductor
#>  knitr                    1.44      2023-09-11 [2] CRAN (R 4.4.0)
#>  later                    1.3.1     2023-05-02 [2] CRAN (R 4.4.0)
#>  lattice                  0.22-5    2023-10-24 [3] CRAN (R 4.4.0)
#>  lazyeval                 0.2.2     2019-03-15 [2] CRAN (R 4.4.0)
#>  lifecycle                1.0.3     2022-10-07 [2] CRAN (R 4.4.0)
#>  magrittr                 2.0.3     2022-03-30 [2] CRAN (R 4.4.0)
#>  Matrix                   1.6-1.1   2023-09-18 [3] CRAN (R 4.4.0)
#>  MatrixGenerics         * 1.15.0    2023-10-24 [2] Bioconductor
#>  matrixStats            * 1.0.0     2023-06-02 [2] CRAN (R 4.4.0)
#>  mclust                 * 6.0.0     2022-10-31 [2] CRAN (R 4.4.0)
#>  memoise                  2.0.1     2021-11-26 [2] CRAN (R 4.4.0)
#>  mime                     0.12      2021-09-28 [2] CRAN (R 4.4.0)
#>  munsell                  0.5.0     2018-06-12 [2] CRAN (R 4.4.0)
#>  pillar                   1.9.0     2023-03-22 [2] CRAN (R 4.4.0)
#>  pkgconfig                2.0.3     2019-09-22 [2] CRAN (R 4.4.0)
#>  png                      0.1-8     2022-11-29 [2] CRAN (R 4.4.0)
#>  pracma                   2.4.2     2022-09-22 [2] CRAN (R 4.4.0)
#>  prettyunits              1.2.0     2023-09-24 [2] CRAN (R 4.4.0)
#>  progress                 1.2.2     2019-05-16 [2] CRAN (R 4.4.0)
#>  promises                 1.2.1     2023-08-10 [2] CRAN (R 4.4.0)
#>  ProtGenerics             1.35.0    2023-10-24 [2] Bioconductor
#>  purrr                    1.0.2     2023-08-10 [2] CRAN (R 4.4.0)
#>  R6                       2.5.1     2021-08-19 [2] CRAN (R 4.4.0)
#>  rappdirs                 0.3.3     2021-01-31 [2] CRAN (R 4.4.0)
#>  Rcpp                     1.0.11    2023-07-06 [2] CRAN (R 4.4.0)
#>  RcppAnnoy                0.0.21    2023-07-02 [2] CRAN (R 4.4.0)
#>  RCurl                    1.98-1.12 2023-03-27 [2] CRAN (R 4.4.0)
#>  restfulr                 0.0.15    2022-06-16 [2] CRAN (R 4.4.0)
#>  rjson                    0.2.21    2022-01-09 [2] CRAN (R 4.4.0)
#>  rlang                    1.1.1     2023-04-28 [2] CRAN (R 4.4.0)
#>  rmarkdown                2.25      2023-09-18 [2] CRAN (R 4.4.0)
#>  Rsamtools                2.19.0    2023-10-24 [2] Bioconductor
#>  RSpectra                 0.16-1    2022-04-24 [2] CRAN (R 4.4.0)
#>  RSQLite                  2.3.1     2023-04-03 [2] CRAN (R 4.4.0)
#>  rsvd                     1.0.5     2021-04-16 [2] CRAN (R 4.4.0)
#>  rtracklayer              1.63.0    2023-10-24 [2] Bioconductor
#>  S4Arrays                 1.3.0     2023-10-24 [2] Bioconductor
#>  S4Vectors              * 0.41.0    2023-10-24 [2] Bioconductor
#>  sass                     0.4.7     2023-07-15 [2] CRAN (R 4.4.0)
#>  ScaledMatrix             1.11.0    2023-10-24 [2] Bioconductor
#>  scales                   1.2.1     2022-08-20 [2] CRAN (R 4.4.0)
#>  scater                 * 1.31.0    2023-10-24 [2] Bioconductor
#>  scRNAseq               * 2.15.0    2023-10-24 [2] Bioconductor
#>  scuttle                * 1.13.0    2023-10-24 [2] Bioconductor
#>  sessioninfo            * 1.2.2     2021-12-06 [2] CRAN (R 4.4.0)
#>  shiny                    1.7.5.1   2023-10-14 [2] CRAN (R 4.4.0)
#>  SIMLR                    1.29.0    2023-10-24 [2] Bioconductor
#>  SingleCellExperiment   * 1.25.0    2023-10-24 [2] Bioconductor
#>  SparseArray              1.3.0     2023-10-24 [2] Bioconductor
#>  sparseMatrixStats        1.15.0    2023-10-24 [2] Bioconductor
#>  stringi                  1.7.12    2023-01-11 [2] CRAN (R 4.4.0)
#>  stringr                  1.5.0     2022-12-02 [2] CRAN (R 4.4.0)
#>  SummarizedExperiment   * 1.33.0    2023-10-24 [2] Bioconductor
#>  tibble                   3.2.1     2023-03-20 [2] CRAN (R 4.4.0)
#>  tidyselect               1.2.0     2022-10-10 [2] CRAN (R 4.4.0)
#>  utf8                     1.2.4     2023-10-22 [2] CRAN (R 4.4.0)
#>  vctrs                    0.6.4     2023-10-12 [2] CRAN (R 4.4.0)
#>  vipor                    0.4.5     2017-03-22 [2] CRAN (R 4.4.0)
#>  viridis                  0.6.4     2023-07-22 [2] CRAN (R 4.4.0)
#>  viridisLite              0.4.2     2023-05-02 [2] CRAN (R 4.4.0)
#>  withr                    2.5.1     2023-09-26 [2] CRAN (R 4.4.0)
#>  xfun                     0.40      2023-08-09 [2] CRAN (R 4.4.0)
#>  XML                      3.99-0.14 2023-03-19 [2] CRAN (R 4.4.0)
#>  xml2                     1.3.5     2023-07-06 [2] CRAN (R 4.4.0)
#>  xtable                   1.8-4     2019-04-21 [2] CRAN (R 4.4.0)
#>  XVector                  0.43.0    2023-10-24 [2] Bioconductor
#>  yaml                     2.3.7     2023-01-23 [2] CRAN (R 4.4.0)
#>  zlibbioc                 1.49.0    2023-10-24 [2] Bioconductor
#> 
#>  [1] /tmp/RtmpUzhXc3/Rinst3f874fb9f43dd
#>  [2] /home/biocbuild/bbs-3.19-bioc/R/site-library
#>  [3] /home/biocbuild/bbs-3.19-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.