# An introduction to scReClassify package

Taiyun Kim1,2,3

1School of Mathematics and Statistics, The University of Sydney
2Computational Systems Biology Group, Children’s Medical Research Institute, Faculty of Medicine and Health, The University of Sydney
3Charles Perkins Centre, The University of Sydney

#### 26 April 2023

#### Package

BiocStyle 2.28.0

# Contents

# 1 Introduction

`scReClassify` is a post hoc cell type classification of single-cell RNA-sequencing data to fine-tune cell type annotations generated by any cell type classification procedure. Typically, cell type identification relies on human inspection using combination of prior biological knowledge and computational techniques. Due to incompleteness of our current knowledge and the subjectivity involved in this process, a small amount of cells may be subject to mislabelling. Using semi-supervised learning algorithm, adaSampling, we are able to correct cell type annotations from various degree of noise.

Overview of scReClassify methods

# 2 Installation

Install the latest development version from GitHub using the `devtools` package:

    if (!("devtools" %in% rownames(installed.packages())))
        install.packages("devtools")

    library(devtools)
    devtools::install_github("SydneyBioX/scReClassify")

To install the Bioconductor version of scReClassify, enter the following to your R console.

    if (!requireNamespace("BiocManager", quietly = TRUE))
        install.packages("BiocManager")
    BiocManager::install("scReClassify")

# 3 Loading packages and data

    suppressPackageStartupMessages({
        library(scReClassify)
        library(DT)
        library(mclust)
        library(dplyr)
        library(SummarizedExperiment)
        library(SingleCellExperiment)
    })

    data("gse87795_subset_sce")

    dat <- gse87795_subset_sce
    cellTypes <- gse87795_subset_sce$cellTypes

`gse87795_subset_sce` is a `SingleCellExperiment` object of a mouse fetal liver development data deposited at Gene Expression Omnibus respository with accession ID GSE87795. The cell type information can be found on the `colData` of the `SingleCellExperiment` object.

    # Cell types
    table(cellTypes)

    ## cellTypes
    ## Endothelial Cell      Erythrocyte      Hepatoblast       Macrophage
    ##               49              130               42               51
    ##    Megakaryocyte Mesenchymal Cell
    ##               17               78

    # We set the number of clusters
    nCs <- length(table(cellTypes))
    nCs

    ## [1] 6

    # This demo dataset is already pre-processed
    dim(dat)

    ## [1] 1000  367

There are 6 cell types, 367 cells and 1000 number of genes.

# 4 Part A. scReClassify (Demonstration with synthetic mislabels)

## 4.1 Dimension reduction

Prior to running scReClassify, we perform dimension reduction. `matPCs` is a tool in scReClassify to simplify this process. In this function, a dimension reduced matrix is returned with `n` principal components (PCs), where `n` is the number of principal components (PCs) that by sum explains at least 70% variance.

The function accepts either a `matrix` or a `SingleCellExperiment` object. If the `data` parameter is a `SingleCellExperiment` object, an `assay` variable must be specified to perform dimension reduction on the correct assay. If the `SingleCellExperiment` object `data` already has a ‘PCA’ in `reducedDimNames()`, the ‘PCA’ matrix of `n` columns are returned.

    reducedDim(dat, "matPCs") <- matPCs(dat, assay = "logNorm", 0.7)

## 4.2 Synthetic noise (Demonstration purpose)

Here in this example, we will synthetically generate varying degree of noise (10-50%) in sample labels. The purpose here is to simulate different level of mislabeling in the data. Given a cell type label `cls.truth`, `noisyCls` function will randomly select a `rho` percentage of cells from a given cell type and relabel to other cell types.

Here, we create different degree of noise from 10% to 50%.

    lab <- cellTypes

    set.seed(1)
    # Function to create noise in the cell type label
    noisyCls <- function(dat, rho, cls.truth){
        cls.noisy <- cls.truth
        names(cls.noisy) <- colnames(dat)

        for(i in seq_len(length(table(cls.noisy)))) {
            # class label starts from 0
            if (i != length(table(cls.noisy))) {
                cls.noisy[sample(which(cls.truth == names(table(cls.noisy))[i]),
                                floor(sum(cls.truth == names(table(cls.noisy))[i])*
                                rho))] <- names(table(cls.noisy))[i+1]
            } else {
                cls.noisy[sample(which(cls.truth == names(table(cls.noisy))[i]),
                                floor(sum(cls.truth == names(table(cls.noisy))[i])*
                                rho))] <- names(table(cls.noisy))[1]
            }
        }

        print(sum(cls.truth != cls.noisy))
        return(cls.noisy)
    }

    cls.noisy01 <- noisyCls(t(reducedDim(dat, "matPCs")), rho=0.1, lab)

    ## [1] 34

    cls.noisy02 <- noisyCls(t(reducedDim(dat, "matPCs")), rho=0.2, lab)

    ## [1] 71

    cls.noisy03 <- noisyCls(t(reducedDim(dat, "matPCs")), rho=0.3, lab)

    ## [1] 108

    cls.noisy04 <- noisyCls(t(reducedDim(dat, "matPCs")), rho=0.4, lab)

    ## [1] 144

    cls.noisy05 <- noisyCls(t(reducedDim(dat, "matPCs")), rho=0.5, lab)

    ## [1] 182

With `noisyCls` function, we have relabeled Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Hepatoblast, Erythrocyte, Mesenchymal Cell, Hepatoblast, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Macrophage, Mesenchymal Cell, Macrophage, Erythrocyte, Mesenchymal Cell, Macrophage, Mesenchymal Cell, Megakaryocyte, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Endothelial Cell, Endothelial Cell, Erythrocyte, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Endothelial Cell, Endothelial Cell, Endothelial Cell, Mesenchymal Cell, Endothelial Cell, Endothelial Cell, Mesenchymal Cell, Mesenchymal Cell, Endothelial Cell, Endothelial Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Endothelial Cell, Mesenchymal Cell, Endothelial Cell, Endothelial Cell, Hepatoblast, Mesenchymal Cell, Macrophage, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Macrophage, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Erythrocyte, Erythrocyte, Hepatoblast, Megakaryocyte, Erythrocyte, Erythrocyte, Erythrocyte, Megakaryocyte, Endothelial Cell, Hepatoblast, Erythrocyte, Mesenchymal Cell, Endothelial Cell, Erythrocyte, Macrophage, Mesenchymal Cell, Endothelial Cell, Mesenchymal Cell, Mesenchymal Cell, Macrophage, Megakaryocyte, Erythrocyte, Endothelial Cell, Erythrocyte, Macrophage, Hepatoblast, Mesenchymal Cell, Erythrocyte, Macrophage, Endothelial Cell, Hepatoblast, Mesenchymal Cell, Mesenchymal Cell, Erythrocyte, Mesenchymal Cell, Mesenchymal Cell, Endothelial Cell, Hepatoblast, Erythrocyte, Erythrocyte, Erythrocyte, Endothelial Cell, Hepatoblast, Mesenchymal Cell, Erythrocyte, Erythrocyte, Hepatoblast, Erythrocyte, Hepatoblast, Erythrocyte, Endothelial Cell, Erythrocyte, Mesenchymal Cell, Erythrocyte, Megakaryocyte, Endothelial Cell, Mesenchymal Cell, Mesenchymal Cell, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Megakaryocyte, Megakaryocyte, Erythrocyte, Endothelial Cell, Erythrocyte, Erythrocyte, Mesenchymal Cell, Erythrocyte, Endothelial Cell, Erythrocyte, Mesenchymal Cell, Erythrocyte, Macrophage, Mesenchymal Cell, Erythrocyte, Mesenchymal Cell, Endothelial Cell, Hepatoblast, Erythrocyte, Hepatoblast, Endothelial Cell, Endothelial Cell, Erythrocyte, Endothelial Cell, Macrophage, Erythrocyte, Endothelial Cell, Macrophage, Erythrocyte, Hepatoblast, Hepatoblast, Erythrocyte, Megakaryocyte, Megakaryocyte, Macrophage, Erythrocyte, Macrophage, Erythrocyte, Megakaryocyte, Hepatoblast, Macrophage, Erythrocyte, Erythrocyte, Macrophage, Erythrocyte, Endothelial Cell, Macrophage, Mesenchymal Cell, Endothelial Cell, Erythrocyte, Hepatoblast, Erythrocyte, Endothelial Cell, Erythrocyte, Megakaryocyte, Endothelial Cell, Megakaryocyte, Erythrocyte, Mesenchymal Cell, Hepatoblast, Endothelial Cell, Endothelial Cell, Macrophage, Erythrocyte, Hepatoblast, Mesenchymal Cell, Erythrocyte, Hepatoblast, Erythrocyte, Endothelial Cell, Macrophage, Hepatoblast, Erythrocyte, Hepatoblast, Endothelial Cell, Erythrocyte, Macrophage, Erythrocyte, Hepatoblast, Erythrocyte, Erythrocyte, Hepatoblast, Erythrocyte, Hepatoblast, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Macrophage, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Hepatoblast, Erythrocyte, Erythrocyte, Mesenchymal Cell, Hepatoblast, Hepatoblast, Endothelial Cell, Endothelial Cell, Megakaryocyte, Hepatoblast, Hepatoblast, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Hepatoblast, Macrophage, Erythrocyte, Erythrocyte, Endothelial Cell, Erythrocyte, Macrophage, Macrophage, Hepatoblast, Erythrocyte, Macrophage, Megakaryocyte, Erythrocyte, Hepatoblast, Macrophage, Macrophage, Endothelial Cell, Megakaryocyte, Endothelial Cell, Hepatoblast, Erythrocyte, Endothelial Cell, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Macrophage, Erythrocyte, Erythrocyte, Endothelial Cell, Hepatoblast, Endothelial Cell, Hepatoblast, Erythrocyte, Erythrocyte, Erythrocyte, Endothelial Cell, Macrophage, Erythrocyte, Hepatoblast, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Hepatoblast, Macrophage, Erythrocyte, Hepatoblast, Macrophage, Hepatoblast, Mesenchymal Cell, Erythrocyte, Erythrocyte, Megakaryocyte, Hepatoblast, Macrophage, Hepatoblast, Endothelial Cell, Mesenchymal Cell, Hepatoblast, Erythrocyte, Mesenchymal Cell, Macrophage, Macrophage, Hepatoblast, Erythrocyte, Erythrocyte, Mesenchymal Cell, Macrophage, Macrophage, Erythrocyte, Erythrocyte, Macrophage, Hepatoblast, Hepatoblast, Macrophage, Macrophage, Megakaryocyte, Macrophage, Erythrocyte, Endothelial Cell, Macrophage, Hepatoblast, Erythrocyte, Macrophage, Megakaryocyte, Macrophage, Endothelial Cell, Erythrocyte, Macrophage, Endothelial Cell, Macrophage, Hepatoblast, Endothelial Cell, Endothelial Cell, Hepatoblast, Erythrocyte, Erythrocyte, Macrophage, Erythrocyte, Erythrocyte, Hepatoblast, Megakaryocyte, Macrophage, Megakaryocyte, Megakaryocyte, Erythrocyte, Macrophage, Erythrocyte, Erythrocyte, Hepatoblast, Erythrocyte, Erythrocyte, Erythrocyte, Endothelial Cell, Erythrocyte, Erythrocyte, Macrophage, Macrophage, Erythrocyte, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Hepatoblast, Erythrocyte, Mesenchymal Cell, Hepatoblast, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Macrophage, Mesenchymal Cell, Macrophage, Erythrocyte, Mesenchymal Cell, Macrophage, Mesenchymal Cell, Megakaryocyte, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Endothelial Cell, Endothelial Cell, Erythrocyte, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Endothelial Cell, Endothelial Cell, Endothelial Cell, Mesenchymal Cell, Endothelial Cell, Endothelial Cell, Mesenchymal Cell, Mesenchymal Cell, Endothelial Cell, Endothelial Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Endothelial Cell, Mesenchymal Cell, Endothelial Cell, Endothelial Cell, Hepatoblast, Mesenchymal Cell, Macrophage, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Macrophage, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Erythrocyte, Erythrocyte, Hepatoblast, Megakaryocyte, Erythrocyte, Erythrocyte, Erythrocyte, Megakaryocyte, Endothelial Cell, Hepatoblast, Erythrocyte, Mesenchymal Cell, Endothelial Cell, Erythrocyte, Macrophage, Mesenchymal Cell, Endothelial Cell, Mesenchymal Cell, Mesenchymal Cell, Macrophage, Megakaryocyte, Erythrocyte, Endothelial Cell, Erythrocyte, Macrophage, Hepatoblast, Mesenchymal Cell, Erythrocyte, Macrophage, Endothelial Cell, Hepatoblast, Mesenchymal Cell, Mesenchymal Cell, Erythrocyte, Mesenchymal Cell, Mesenchymal Cell, Endothelial Cell, Hepatoblast, Erythrocyte, Erythrocyte, Erythrocyte, Endothelial Cell, Hepatoblast, Mesenchymal Cell, Erythrocyte, Erythrocyte, Hepatoblast, Erythrocyte, Hepatoblast, Erythrocyte, Endothelial Cell, Erythrocyte, Mesenchymal Cell, Erythrocyte, Megakaryocyte, Endothelial Cell, Mesenchymal Cell, Mesenchymal Cell, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Megakaryocyte, Megakaryocyte, Erythrocyte, Endothelial Cell, Erythrocyte, Erythrocyte, Mesenchymal Cell, Erythrocyte, Endothelial Cell, Erythrocyte, Mesenchymal Cell, Erythrocyte, Macrophage, Mesenchymal Cell, Erythrocyte, Mesenchymal Cell, Endothelial Cell, Hepatoblast, Erythrocyte, Hepatoblast, Endothelial Cell, Endothelial Cell, Erythrocyte, Endothelial Cell, Macrophage, Erythrocyte, Endothelial Cell, Macrophage, Erythrocyte, Hepatoblast, Hepatoblast, Erythrocyte, Megakaryocyte, Megakaryocyte, Macrophage, Erythrocyte, Macrophage, Erythrocyte, Megakaryocyte, Hepatoblast, Macrophage, Erythrocyte, Erythrocyte, Macrophage, Erythrocyte, Endothelial Cell, Macrophage, Mesenchymal Cell, Endothelial Cell, Erythrocyte, Hepatoblast, Erythrocyte, Endothelial Cell, Erythrocyte, Megakaryocyte, Endothelial Cell, Megakaryocyte, Erythrocyte, Mesenchymal Cell, Hepatoblast, Endothelial Cell, Endothelial Cell, Macrophage, Erythrocyte, Hepatoblast, Mesenchymal Cell, Erythrocyte, Hepatoblast, Erythrocyte, Endothelial Cell, Macrophage, Hepatoblast, Erythrocyte, Hepatoblast, Endothelial Cell, Erythrocyte, Macrophage, Erythrocyte, Hepatoblast, Erythrocyte, Erythrocyte, Hepatoblast, Erythrocyte, Hepatoblast, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Macrophage, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Hepatoblast, Erythrocyte, Erythrocyte, Mesenchymal Cell, Hepatoblast, Hepatoblast, Endothelial Cell, Endothelial Cell, Megakaryocyte, Hepatoblast, Hepatoblast, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Hepatoblast, Macrophage, Erythrocyte, Erythrocyte, Endothelial Cell, Erythrocyte, Macrophage, Macrophage, Hepatoblast, Erythrocyte, Macrophage, Megakaryocyte, Erythrocyte, Hepatoblast, Macrophage, Macrophage, Endothelial Cell, Megakaryocyte, Endothelial Cell, Hepatoblast, Erythrocyte, Endothelial Cell, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Macrophage, Erythrocyte, Erythrocyte, Endothelial Cell, Hepatoblast, Endothelial Cell, Hepatoblast, Erythrocyte, Erythrocyte, Erythrocyte, Endothelial Cell, Macrophage, Erythrocyte, Hepatoblast, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Hepatoblast, Macrophage, Erythrocyte, Hepatoblast, Macrophage, Hepatoblast, Mesenchymal Cell, Erythrocyte, Erythrocyte, Megakaryocyte, Hepatoblast, Macrophage, Hepatoblast, Endothelial Cell, Mesenchymal Cell, Hepatoblast, Erythrocyte, Mesenchymal Cell, Macrophage, Macrophage, Hepatoblast, Erythrocyte, Erythrocyte, Mesenchymal Cell, Macrophage, Macrophage, Erythrocyte, Erythrocyte, Macrophage, Hepatoblast, Hepatoblast, Macrophage, Macrophage, Megakaryocyte, Macrophage, Erythrocyte, Endothelial Cell, Macrophage, Hepatoblast, Erythrocyte, Macrophage, Megakaryocyte, Macrophage, Endothelial Cell, Erythrocyte, Macrophage, Endothelial Cell, Macrophage, Hepatoblast, Endothelial Cell, Endothelial Cell, Hepatoblast, Erythrocyte, Erythrocyte, Macrophage, Erythrocyte, Erythrocyte, Hepatoblast, Megakaryocyte, Macrophage, Megakaryocyte, Megakaryocyte, Erythrocyte, Macrophage, Erythrocyte, Erythrocyte, Hepatoblast, Erythrocyte, Erythrocyte, Erythrocyte, Endothelial Cell, Erythrocyte, Erythrocyte, Macrophage, Macrophage, Erythrocyte, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Hepatoblast, Erythrocyte, Mesenchymal Cell, Hepatoblast, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Macrophage, Mesenchymal Cell, Macrophage, Erythrocyte, Mesenchymal Cell, Macrophage, Mesenchymal Cell, Megakaryocyte, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Endothelial Cell, Endothelial Cell, Erythrocyte, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Endothelial Cell, Endothelial Cell, Endothelial Cell, Mesenchymal Cell, Endothelial Cell, Endothelial Cell, Mesenchymal Cell, Mesenchymal Cell, Endothelial Cell, Endothelial Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Endothelial Cell, Mesenchymal Cell, Endothelial Cell, Endothelial Cell, Hepatoblast, Mesenchymal Cell, Macrophage, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Macrophage, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Erythrocyte, Erythrocyte, Hepatoblast, Megakaryocyte, Erythrocyte, Erythrocyte, Erythrocyte, Megakaryocyte, Endothelial Cell, Hepatoblast, Erythrocyte, Mesenchymal Cell, Endothelial Cell, Erythrocyte, Macrophage, Mesenchymal Cell, Endothelial Cell, Mesenchymal Cell, Mesenchymal Cell, Macrophage, Megakaryocyte, Erythrocyte, Endothelial Cell, Erythrocyte, Macrophage, Hepatoblast, Mesenchymal Cell, Erythrocyte, Macrophage, Endothelial Cell, Hepatoblast, Mesenchymal Cell, Mesenchymal Cell, Erythrocyte, Mesenchymal Cell, Mesenchymal Cell, Endothelial Cell, Hepatoblast, Erythrocyte, Erythrocyte, Erythrocyte, Endothelial Cell, Hepatoblast, Mesenchymal Cell, Erythrocyte, Erythrocyte, Hepatoblast, Erythrocyte, Hepatoblast, Erythrocyte, Endothelial Cell, Erythrocyte, Mesenchymal Cell, Erythrocyte, Megakaryocyte, Endothelial Cell, Mesenchymal Cell, Mesenchymal Cell, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Megakaryocyte, Megakaryocyte, Erythrocyte, Endothelial Cell, Erythrocyte, Erythrocyte, Mesenchymal Cell, Erythrocyte, Endothelial Cell, Erythrocyte, Mesenchymal Cell, Erythrocyte, Macrophage, Mesenchymal Cell, Erythrocyte, Mesenchymal Cell, Endothelial Cell, Hepatoblast, Erythrocyte, Hepatoblast, Endothelial Cell, Endothelial Cell, Erythrocyte, Endothelial Cell, Macrophage, Erythrocyte, Endothelial Cell, Macrophage, Erythrocyte, Hepatoblast, Hepatoblast, Erythrocyte, Megakaryocyte, Megakaryocyte, Macrophage, Erythrocyte, Macrophage, Erythrocyte, Megakaryocyte, Hepatoblast, Macrophage, Erythrocyte, Erythrocyte, Macrophage, Erythrocyte, Endothelial Cell, Macrophage, Mesenchymal Cell, Endothelial Cell, Erythrocyte, Hepatoblast, Erythrocyte, Endothelial Cell, Erythrocyte, Megakaryocyte, Endothelial Cell, Megakaryocyte, Erythrocyte, Mesenchymal Cell, Hepatoblast, Endothelial Cell, Endothelial Cell, Macrophage, Erythrocyte, Hepatoblast, Mesenchymal Cell, Erythrocyte, Hepatoblast, Erythrocyte, Endothelial Cell, Macrophage, Hepatoblast, Erythrocyte, Hepatoblast, Endothelial Cell, Erythrocyte, Macrophage, Erythrocyte, Hepatoblast, Erythrocyte, Erythrocyte, Hepatoblast, Erythrocyte, Hepatoblast, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Macrophage, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Hepatoblast, Erythrocyte, Erythrocyte, Mesenchymal Cell, Hepatoblast, Hepatoblast, Endothelial Cell, Endothelial Cell, Megakaryocyte, Hepatoblast, Hepatoblast, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Hepatoblast, Macrophage, Erythrocyte, Erythrocyte, Endothelial Cell, Erythrocyte, Macrophage, Macrophage, Hepatoblast, Erythrocyte, Macrophage, Megakaryocyte, Erythrocyte, Hepatoblast, Macrophage, Macrophage, Endothelial Cell, Megakaryocyte, Endothelial Cell, Hepatoblast, Erythrocyte, Endothelial Cell, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Macrophage, Erythrocyte, Erythrocyte, Endothelial Cell, Hepatoblast, Endothelial Cell, Hepatoblast, Erythrocyte, Erythrocyte, Erythrocyte, Endothelial Cell, Macrophage, Erythrocyte, Hepatoblast, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Hepatoblast, Macrophage, Erythrocyte, Hepatoblast, Macrophage, Hepatoblast, Mesenchymal Cell, Erythrocyte, Erythrocyte, Megakaryocyte, Hepatoblast, Macrophage, Hepatoblast, Endothelial Cell, Mesenchymal Cell, Hepatoblast, Erythrocyte, Mesenchymal Cell, Macrophage, Macrophage, Hepatoblast, Erythrocyte, Erythrocyte, Mesenchymal Cell, Macrophage, Macrophage, Erythrocyte, Erythrocyte, Macrophage, Hepatoblast, Hepatoblast, Macrophage, Macrophage, Megakaryocyte, Macrophage, Erythrocyte, Endothelial Cell, Macrophage, Hepatoblast, Erythrocyte, Macrophage, Megakaryocyte, Macrophage, Endothelial Cell, Erythrocyte, Macrophage, Endothelial Cell, Macrophage, Hepatoblast, Endothelial Cell, Endothelial Cell, Hepatoblast, Erythrocyte, Erythrocyte, Macrophage, Erythrocyte, Erythrocyte, Hepatoblast, Megakaryocyte, Macrophage, Megakaryocyte, Megakaryocyte, Erythrocyte, Macrophage, Erythrocyte, Erythrocyte, Hepatoblast, Erythrocyte, Erythrocyte, Erythrocyte, Endothelial Cell, Erythrocyte, Erythrocyte, Macrophage, Macrophage, Erythrocyte, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Hepatoblast, Erythrocyte, Mesenchymal Cell, Hepatoblast, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Macrophage, Mesenchymal Cell, Macrophage, Erythrocyte, Mesenchymal Cell, Macrophage, Mesenchymal Cell, Megakaryocyte, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Endothelial Cell, Endothelial Cell, Erythrocyte, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Endothelial Cell, Endothelial Cell, Endothelial Cell, Mesenchymal Cell, Endothelial Cell, Endothelial Cell, Mesenchymal Cell, Mesenchymal Cell, Endothelial Cell, Endothelial Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Endothelial Cell, Mesenchymal Cell, Endothelial Cell, Endothelial Cell, Hepatoblast, Mesenchymal Cell, Macrophage, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Macrophage, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Erythrocyte, Erythrocyte, Hepatoblast, Megakaryocyte, Erythrocyte, Erythrocyte, Erythrocyte, Megakaryocyte, Endothelial Cell, Hepatoblast, Erythrocyte, Mesenchymal Cell, Endothelial Cell, Erythrocyte, Macrophage, Mesenchymal Cell, Endothelial Cell, Mesenchymal Cell, Mesenchymal Cell, Macrophage, Megakaryocyte, Erythrocyte, Endothelial Cell, Erythrocyte, Macrophage, Hepatoblast, Mesenchymal Cell, Erythrocyte, Macrophage, Endothelial Cell, Hepatoblast, Mesenchymal Cell, Mesenchymal Cell, Erythrocyte, Mesenchymal Cell, Mesenchymal Cell, Endothelial Cell, Hepatoblast, Erythrocyte, Erythrocyte, Erythrocyte, Endothelial Cell, Hepatoblast, Mesenchymal Cell, Erythrocyte, Erythrocyte, Hepatoblast, Erythrocyte, Hepatoblast, Erythrocyte, Endothelial Cell, Erythrocyte, Mesenchymal Cell, Erythrocyte, Megakaryocyte, Endothelial Cell, Mesenchymal Cell, Mesenchymal Cell, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Megakaryocyte, Megakaryocyte, Erythrocyte, Endothelial Cell, Erythrocyte, Erythrocyte, Mesenchymal Cell, Erythrocyte, Endothelial Cell, Erythrocyte, Mesenchymal Cell, Erythrocyte, Macrophage, Mesenchymal Cell, Erythrocyte, Mesenchymal Cell, Endothelial Cell, Hepatoblast, Erythrocyte, Hepatoblast, Endothelial Cell, Endothelial Cell, Erythrocyte, Endothelial Cell, Macrophage, Erythrocyte, Endothelial Cell, Macrophage, Erythrocyte, Hepatoblast, Hepatoblast, Erythrocyte, Megakaryocyte, Megakaryocyte, Macrophage, Erythrocyte, Macrophage, Erythrocyte, Megakaryocyte, Hepatoblast, Macrophage, Erythrocyte, Erythrocyte, Macrophage, Erythrocyte, Endothelial Cell, Macrophage, Mesenchymal Cell, Endothelial Cell, Erythrocyte, Hepatoblast, Erythrocyte, Endothelial Cell, Erythrocyte, Megakaryocyte, Endothelial Cell, Megakaryocyte, Erythrocyte, Mesenchymal Cell, Hepatoblast, Endothelial Cell, Endothelial Cell, Macrophage, Erythrocyte, Hepatoblast, Mesenchymal Cell, Erythrocyte, Hepatoblast, Erythrocyte, Endothelial Cell, Macrophage, Hepatoblast, Erythrocyte, Hepatoblast, Endothelial Cell, Erythrocyte, Macrophage, Erythrocyte, Hepatoblast, Erythrocyte, Erythrocyte, Hepatoblast, Erythrocyte, Hepatoblast, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Macrophage, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Hepatoblast, Erythrocyte, Erythrocyte, Mesenchymal Cell, Hepatoblast, Hepatoblast, Endothelial Cell, Endothelial Cell, Megakaryocyte, Hepatoblast, Hepatoblast, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Hepatoblast, Macrophage, Erythrocyte, Erythrocyte, Endothelial Cell, Erythrocyte, Macrophage, Macrophage, Hepatoblast, Erythrocyte, Macrophage, Megakaryocyte, Erythrocyte, Hepatoblast, Macrophage, Macrophage, Endothelial Cell, Megakaryocyte, Endothelial Cell, Hepatoblast, Erythrocyte, Endothelial Cell, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Macrophage, Erythrocyte, Erythrocyte, Endothelial Cell, Hepatoblast, Endothelial Cell, Hepatoblast, Erythrocyte, Erythrocyte, Erythrocyte, Endothelial Cell, Macrophage, Erythrocyte, Hepatoblast, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Hepatoblast, Macrophage, Erythrocyte, Hepatoblast, Macrophage, Hepatoblast, Mesenchymal Cell, Erythrocyte, Erythrocyte, Megakaryocyte, Hepatoblast, Macrophage, Hepatoblast, Endothelial Cell, Mesenchymal Cell, Hepatoblast, Erythrocyte, Mesenchymal Cell, Macrophage, Macrophage, Hepatoblast, Erythrocyte, Erythrocyte, Mesenchymal Cell, Macrophage, Macrophage, Erythrocyte, Erythrocyte, Macrophage, Hepatoblast, Hepatoblast, Macrophage, Macrophage, Megakaryocyte, Macrophage, Erythrocyte, Endothelial Cell, Macrophage, Hepatoblast, Erythrocyte, Macrophage, Megakaryocyte, Macrophage, Endothelial Cell, Erythrocyte, Macrophage, Endothelial Cell, Macrophage, Hepatoblast, Endothelial Cell, Endothelial Cell, Hepatoblast, Erythrocyte, Erythrocyte, Macrophage, Erythrocyte, Erythrocyte, Hepatoblast, Megakaryocyte, Macrophage, Megakaryocyte, Megakaryocyte, Erythrocyte, Macrophage, Erythrocyte, Erythrocyte, Hepatoblast, Erythrocyte, Erythrocyte, Erythrocyte, Endothelial Cell, Erythrocyte, Erythrocyte, Macrophage, Macrophage, Erythrocyte and Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Hepatoblast, Erythrocyte, Mesenchymal Cell, Hepatoblast, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Macrophage, Mesenchymal Cell, Macrophage, Erythrocyte, Mesenchymal Cell, Macrophage, Mesenchymal Cell, Megakaryocyte, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Endothelial Cell, Endothelial Cell, Erythrocyte, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Endothelial Cell, Endothelial Cell, Endothelial Cell, Mesenchymal Cell, Endothelial Cell, Endothelial Cell, Mesenchymal Cell, Mesenchymal Cell, Endothelial Cell, Endothelial Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Endothelial Cell, Mesenchymal Cell, Endothelial Cell, Endothelial Cell, Hepatoblast, Mesenchymal Cell, Macrophage, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Macrophage, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Mesenchymal Cell, Erythrocyte, Erythrocyte, Hepatoblast, Megakaryocyte, Erythrocyte, Erythrocyte, Erythrocyte, Megakaryocyte, Endothelial Cell, Hepatoblast, Erythrocyte, Mesenchymal Cell, Endothelial Cell, Erythrocyte, Macrophage, Mesenchymal Cell, Endothelial Cell, Mesenchymal Cell, Mesenchymal Cell, Macrophage, Megakaryocyte, Erythrocyte, Endothelial Cell, Erythrocyte, Macrophage, Hepatoblast, Mesenchymal Cell, Erythrocyte, Macrophage, Endothelial Cell, Hepatoblast, Mesenchymal Cell, Mesenchymal Cell, Erythrocyte, Mesenchymal Cell, Mesenchymal Cell, Endothelial Cell, Hepatoblast, Erythrocyte, Erythrocyte, Erythrocyte, Endothelial Cell, Hepatoblast, Mesenchymal Cell, Erythrocyte, Erythrocyte, Hepatoblast, Erythrocyte, Hepatoblast, Erythrocyte, Endothelial Cell, Erythrocyte, Mesenchymal Cell, Erythrocyte, Megakaryocyte, Endothelial Cell, Mesenchymal Cell, Mesenchymal Cell, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Megakaryocyte, Megakaryocyte, Erythrocyte, Endothelial Cell, Erythrocyte, Erythrocyte, Mesenchymal Cell, Erythrocyte, Endothelial Cell, Erythrocyte, Mesenchymal Cell, Erythrocyte, Macrophage, Mesenchymal Cell, Erythrocyte, Mesenchymal Cell, Endothelial Cell, Hepatoblast, Erythrocyte, Hepatoblast, Endothelial Cell, Endothelial Cell, Erythrocyte, Endothelial Cell, Macrophage, Erythrocyte, Endothelial Cell, Macrophage, Erythrocyte, Hepatoblast, Hepatoblast, Erythrocyte, Megakaryocyte, Megakaryocyte, Macrophage, Erythrocyte, Macrophage, Erythrocyte, Megakaryocyte, Hepatoblast, Macrophage, Erythrocyte, Erythrocyte, Macrophage, Erythrocyte, Endothelial Cell, Macrophage, Mesenchymal Cell, Endothelial Cell, Erythrocyte, Hepatoblast, Erythrocyte, Endothelial Cell, Erythrocyte, Megakaryocyte, Endothelial Cell, Megakaryocyte, Erythrocyte, Mesenchymal Cell, Hepatoblast, Endothelial Cell, Endothelial Cell, Macrophage, Erythrocyte, Hepatoblast, Mesenchymal Cell, Erythrocyte, Hepatoblast, Erythrocyte, Endothelial Cell, Macrophage, Hepatoblast, Erythrocyte, Hepatoblast, Endothelial Cell, Erythrocyte, Macrophage, Erythrocyte, Hepatoblast, Erythrocyte, Erythrocyte, Hepatoblast, Erythrocyte, Hepatoblast, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Macrophage, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Hepatoblast, Erythrocyte, Erythrocyte, Mesenchymal Cell, Hepatoblast, Hepatoblast, Endothelial Cell, Endothelial Cell, Megakaryocyte, Hepatoblast, Hepatoblast, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Hepatoblast, Macrophage, Erythrocyte, Erythrocyte, Endothelial Cell, Erythrocyte, Macrophage, Macrophage, Hepatoblast, Erythrocyte, Macrophage, Megakaryocyte, Erythrocyte, Hepatoblast, Macrophage, Macrophage, Endothelial Cell, Megakaryocyte, Endothelial Cell, Hepatoblast, Erythrocyte, Endothelial Cell, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Macrophage, Erythrocyte, Erythrocyte, Endothelial Cell, Hepatoblast, Endothelial Cell, Hepatoblast, Erythrocyte, Erythrocyte, Erythrocyte, Endothelial Cell, Macrophage, Erythrocyte, Hepatoblast, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Erythrocyte, Hepatoblast, Macrophage, Erythrocyte, Hepatoblast, Macrophage, Hepatoblast, Mesenchymal Cell, Erythrocyte, Erythrocyte, Megakaryocyte, Hepatoblast, Macrophage, Hepatoblast, Endothelial Cell, Mesenchymal Cell, Hepatoblast, Erythrocyte, Mesenchymal Cell, Macrophage, Macrophage, Hepatoblast, Erythrocyte, Erythrocyte, Mesenchymal Cell, Macrophage, Macrophage, Erythrocyte, Erythrocyte, Macrophage, Hepatoblast, Hepatoblast, Macrophage, Macrophage, Megakaryocyte, Macrophage, Erythrocyte, Endothelial Cell, Macrophage, Hepatoblast, Erythrocyte, Macrophage, Megakaryocyte, Macrophage, Endothelial Cell, Erythrocyte, Macrophage, Endothelial Cell, Macrophage, Hepatoblast, Endothelial Cell, Endothelial Cell, Hepatoblast, Erythrocyte, Erythrocyte, Macrophage, Erythrocyte, Erythrocyte, Hepatoblast, Megakaryocyte, Macrophage, Megakaryocyte, Megakaryocyte, Erythrocyte, Macrophage, Erythrocyte, Erythrocyte, Hepatoblast, Erythrocyte, Erythrocyte, Erythrocyte, Endothelial Cell, Erythrocyte, Erythrocyte, Macrophage, Macrophage, Erythrocyte number of cells for `rho` equal to 0.1, 0.2, 0.3, 0.4 and 0.5 respectively.

## 4.3 Use scReClassify to correct mislabeled cell types.

Here in this example, we will only use `Support Vector machine (svm)` as base classifier.

#### 4.3.0.1 Benchmark evaluation

To benchmark scReClassify, we perform scReclassify to all degree of noise with 10 repeats. We measure the accuracy of scReClassify and the Adjusted Rand Index (ARI) to measure the concordance of the reclassified cell type to the true cell type label.

    ###################################
    # SVM
    ###################################
    base <- "svm"
    set.seed(1)
    result = lapply(seq_len(10), function(j) {
        final <- multiAdaSampling(dat, cls.noisy01, reducedDimName = "matPCs",
                                classifier=base, percent=1, L=10)$final
        ari01 <- mclust::adjustedRandIndex(lab, final)
        acc01 <- bAccuracy(lab, final)

        final <- multiAdaSampling(dat, cls.noisy02, reducedDimName = "matPCs",
                                classifier=base,  percent=1, L=10)$final
        ari02 <- mclust::adjustedRandIndex(lab, final)
        acc02 <- bAccuracy(lab, final)

        final <- multiAdaSampling(dat, cls.noisy03, reducedDimName = "matPCs",
                                classifier=base, percent=1, L=10)$final
        ari03 <- mclust::adjustedRandIndex(lab, final)
        acc03 <- bAccuracy(lab, final)

        final <- multiAdaSampling(dat, cls.noisy04, reducedDimName = "matPCs",
                                classifier=base, percent=1, L=10)$final
        ari04 <- mclust::adjustedRandIndex(lab, final)
        acc04 <- bAccuracy(lab, final)

        final <- multiAdaSampling(dat, cls.noisy05, reducedDimName = "matPCs",
                                classifier=base, percent=1, L=10)$final
        ari05 <- mclust::adjustedRandIndex(lab, final)
        acc05 <- bAccuracy(lab, final)

        c(
          acc01 = acc01,
          acc02 = acc02,
          acc03 = acc03,
          acc04 = acc04,
          acc05 = acc05,
          ari01 = ari01,
          ari02 = ari02,
          ari03 = ari03,
          ari04 = ari04,
          ari05 = ari05
        )
    })

    result = do.call(rbind, result)
    acc = result[,seq_len(5)]
    colnames(acc) = seq(from=0.1,to=0.5,by=0.1)

    ari = result[,seq(from= 6, to = 10)]
    colnames(ari) = seq(from=0.1,to=0.5,by=0.1)

We can visualise the performance of the scReClassify. The boxes represent the accuracy and the ARI after scReClassify. The red markers indicate the baseline (prior to scReClassify).

    plot.new()
    par(mfrow = c(1,2))
    boxplot(acc, col="lightblue", main="SVM Accuracy",
            ylim=c(0.45, 1), xlab = "rho", ylab = "Accuracy")
    points(x=seq_len(5), y=c(
        bAccuracy(lab, cls.noisy01),
        bAccuracy(lab, cls.noisy02),
        bAccuracy(lab, cls.noisy03),
        bAccuracy(lab, cls.noisy04),
        bAccuracy(lab, cls.noisy05)),
        col="red3", pch=c(2,3,4,5,6), cex=1)
    boxplot(ari, col="lightblue", main="SVM ARI",
            ylim=c(0.25, 1), xlab = "rho", ylab = "ARI")
    points(x=seq_len(5), y=c(
        mclust::adjustedRandIndex(lab, cls.noisy01),
        mclust::adjustedRandIndex(lab, cls.noisy02),
        mclust::adjustedRandIndex(lab, cls.noisy03),
        mclust::adjustedRandIndex(lab, cls.noisy04),
        mclust::adjustedRandIndex(lab, cls.noisy05)),
        col="red3", pch=c(2,3,4,5,6), cex=1)

The plot shows that with scReClassify, cell type information have been refined (boxes are higher than the red markers). The scReClassified results show higher accuracy across noise levels 0.1 - 0.4 (i.e. closer to the true label). With the noise level 0.5, it is showing similar accuracy which is as expected because the initial label contains equal amount of true and false information and thus making it difficult for the algorithm to learn the true label. This shows that scReClassify is also robust to noisy cell type labels.

# 5 Part B. scReClassify (mislabeled cell type correction)

scReClassify has shown promising result with the synthetic noise we have created. Here we will use scReClassify on the actual cell type label from public repository. The data we will use is a mouse fetal liver dataset from GEO with an accession ID GSE87795.

    # PCA procedure
    reducedDim(dat, "matPCs") <- matPCs(dat, assay = "logNorm", 0.7)

    # run scReClassify
    set.seed(1)
    cellTypes.reclassify <- multiAdaSampling(dat, cellTypes,
                                            reducedDimName = "matPCs",
                                            classifier = "svm", percent = 1, L = 10)

    # Verification by marker genes
    End <- c("ITGA2B", "ITGB3")

Below is a table of cell type labels classified to a different cell types after scReClassify.

    # check examples
    idx <- which(cellTypes.reclassify$final != cellTypes)

    cbind(original=cellTypes[idx], reclassify=cellTypes.reclassify$final[idx]) %>%
        DT::datatable()

Here, we visualise the expression level of the a cells that is reclassified for demontration purpose. The box plots are the marker gene expression levels grouped by cells types. The expression level of the reclassified cell (Cell ID: E13.5_C14) are highlighted as red marker.

    mat <- assay(dat, "logNorm")

    c1 <- mat[, which(cellTypes=="Endothelial Cell")]
    c2 <- mat[, which(cellTypes=="Erythrocyte")]
    c3 <- mat[, which(cellTypes=="Hepatoblast")]
    c4 <- mat[, which(cellTypes=="Macrophage")]
    c5 <- mat[, which(cellTypes=="Megakaryocyte")]
    c6 <- mat[, which(cellTypes=="Mesenchymal Cell")]
    cs <- rainbow(length(table(cellTypes)))

    # (example 1 E13.5_C14)
    #####
    par(mfrow=c(1,2))
    marker <- End[1]
    boxplot(c1[marker,], c2[marker,], c3[marker,],
            c4[marker,], c5[marker,], c6[marker,],
            col=cs, main=marker,
            names=c("Others", "Others", "Others", "Orignal",
                    "Reclassified", "Others"), las=2, xlab = "Labels",
            ylab = "log2FPKM")
    points(5, mat[marker, which(colnames(mat) %in% "E13.5_C14")],
            pch=16, col="red", cex=2)

    marker <- End[2]
    boxplot(c1[marker,], c2[marker,], c3[marker,],
            c4[marker,], c5[marker,], c6[marker,],
            col=cs, main=marker,
            names=c("Others", "Others", "Others", "Orignal",
                    "Reclassified", "Others"), las=2, xlab = "Labels",
            ylab = "log2FPKM")
    points(5, mat[marker, which(colnames(mat) %in% "E13.5_C14")],
            pch=16, col="red", cex=2)

As shown in the boxplots above, the expression level of the reclassified cell (red dot) is similar to the expression levels of the reclassified cell types in a marker gene. This highlights that the E13.5_C14 cell has a similar expression profiles to the reclassified cell types rather than its originally labeled cell type. Thus, we were able to identify that E13.5_C14 potentially belongs to the reclassified cell type with scReClassify.

# 6 SessionInfo

    sessionInfo()

    ## R version 4.3.0 RC (2023-04-13 r84269 ucrt)
    ## Platform: x86_64-w64-mingw32/x64 (64-bit)
    ## Running under: Windows Server 2022 x64 (build 20348)
    ##
    ## Matrix products: default
    ##
    ##
    ## locale:
    ## [1] LC_COLLATE=C
    ## [2] LC_CTYPE=English_United States.utf8
    ## [3] LC_MONETARY=English_United States.utf8
    ## [4] LC_NUMERIC=C
    ## [5] LC_TIME=English_United States.utf8
    ##
    ## time zone: America/New_York
    ## tzcode source: internal
    ##
    ## attached base packages:
    ## [1] stats4    stats     graphics  grDevices utils     datasets  methods
    ## [8] base
    ##
    ## other attached packages:
    ##  [1] SingleCellExperiment_1.22.0 SummarizedExperiment_1.30.0
    ##  [3] Biobase_2.60.0              GenomicRanges_1.52.0
    ##  [5] GenomeInfoDb_1.36.0         IRanges_2.34.0
    ##  [7] S4Vectors_0.38.0            BiocGenerics_0.46.0
    ##  [9] MatrixGenerics_1.12.0       matrixStats_0.63.0
    ## [11] dplyr_1.1.2                 mclust_6.0.0
    ## [13] DT_0.27                     scReClassify_1.6.0
    ## [15] BiocStyle_2.28.0
    ##
    ## loaded via a namespace (and not attached):
    ##  [1] utf8_1.2.3              sass_0.4.5              generics_0.1.3
    ##  [4] class_7.3-21            bitops_1.0-7            lattice_0.21-8
    ##  [7] digest_0.6.31           magrittr_2.0.3          evaluate_0.20
    ## [10] grid_4.3.0              bookdown_0.33           fastmap_1.1.1
    ## [13] jsonlite_1.8.4          Matrix_1.5-4            e1071_1.7-13
    ## [16] BiocManager_1.30.20     fansi_1.0.4             crosstalk_1.2.0
    ## [19] jquerylib_0.1.4         cli_3.6.1               rlang_1.1.0
    ## [22] XVector_0.40.0          ellipsis_0.3.2          cachem_1.0.7
    ## [25] DelayedArray_0.26.0     yaml_2.3.7              tools_4.3.0
    ## [28] GenomeInfoDbData_1.2.10 vctrs_0.6.2             R6_2.5.1
    ## [31] magick_2.7.4            proxy_0.4-27            lifecycle_1.0.3
    ## [34] zlibbioc_1.46.0         randomForest_4.7-1.1    htmlwidgets_1.6.2
    ## [37] pkgconfig_2.0.3         bslib_0.4.2             pillar_1.9.0
    ## [40] Rcpp_1.0.10             glue_1.6.2              highr_0.10
    ## [43] tidyselect_1.2.0        tibble_3.2.1            xfun_0.39
    ## [46] knitr_1.42              htmltools_0.5.5         rmarkdown_2.21
    ## [49] compiler_4.3.0          RCurl_1.98-1.12