Skip to contents

The R package ClusterDE is a post-clustering DE method for controlling the false discovery rate (FDR) of identified between cell-type DE genes regardless of clustering quality. The core idea of ClusterDE is to generate real-data-based synthetic null data with only one cell type, as contrast to the real data, for evaluating the whole procedure of clustering followed by a DE test. Detailed tutorials that illustrate various functionalities of ClusterDE are available at this website. The following illustration figure summarizes the usage of ClusterDE:

ClusterDE schematic

The motivation and application of ClusterDE: In Seurat function findMarkers, the authors pointed out: “p-values should be interpreted cautiously, as the genes used for clustering are the same genes tested for differential expression.” This is the “double-dipping” issue. If your clustering results are inaccurate and since the clustering has used your expression data already, the discovered DE genes may not represent the discrete cell type separation, but other variation in your data (e.g., cell cycle, total UMI, or other variation you are not clear. These are still biological variation but do not define discrete status).

ClusterDE aims at correcting the double-dipping issue for comparing two dubious clusters, which you are not sure if they are two discrete cell types or just an artifact of your clustering algorithm based on conventional DE analysis. ClusterDE controls the false discoveries in DE and prioritizes the true cell type markers.

Installation

To install the development version from GitHub, please run:

if (!require("devtools", quietly = TRUE))
  install.packages("devtools")
devtools::install_github("SONGDONGYUAN1994/ClusterDE")

API Reference

The example below shows how to manually generate null data from a gene-by-cell matrix containing the two clusters of interest. For typical UMI count data, we recommend using the Negative Binomial model (nb).

data(exampleCounts, package = "ClusterDE")
obj <- Seurat::CreateSeuratObject(counts = exampleCounts)
null_data <- ClusterDE::constructNull(
  obj,
  approximation = NULL,
  corr_cut = 0.1,
  data_type = "scRNA",
  family = "nb",
  formula = "1",
  if_sparse = F,
  n_cores = 1,
  n_pcs = 200,
  n_rep = 1,
  other_covariates = NULL,
  seed = 123
)

See API Reference for parameter settings of constructNull().

The output of constructNull() is the new gene by cell matrix.

The following figure briefly describes how ClusterDE generates the synthetic null data:

After obtaining the synthetic null data, perform standard preprocessing and clustering pipeline to get DE p-values.

Finally, we compare the p-values from the null and p-values from the target data (real data) by callDE(). See API Reference for parameter settings of callDE().

The output of callDE() is a list of DE genes, ordered by record from most significant to less significant.

Contact

Any questions or suggestions on ClusterDE are welcomed! Please report it on issues, or contact Dongyuan Song ().