Skip to contents

Main functionality 1: To detect dubious metacells for a given metacell partition

Usage

mcRigor_DETECT(
  obj_singlecell,
  cell_membership = NULL,
  tgamma = NULL,
  assay_type = c("RNA", "ATAC"),
  aggregate_method = c("mean", "sum", "geom"),
  output_file = NULL,
  Nrep = 1,
  gene_filter = 0.1,
  feature_use = 2000,
  cor_method = c("pearson", "spearman"),
  prePro = T,
  test_cutoff = 0.01,
  thre_smooth = T,
  thre_bw = 1/6,
  draw = T,
  pur_metric = NULL,
  check_purity = T,
  fields = NULL,
  step_save = T
)

Arguments

obj_singlecell

Seurat object of the original single cells.

cell_membership

A dataframe, each column of which contains the metacell membership of single cells under a given gamma (granularity level). The column names should be the corresponding gamma's (in the character type). The row names should be the single cell id's.

tgamma

The target gamma value — the gamma (in the character type) corresponding to the metacell partition where dubious metacells detection will be performed. tgamma has to be in the column names of cell_membership. If tgamma = NULL, dubious metacells detection will be performed on the metacell partition represented by the first column of cell_membership.

assay_type

The type of data assay yuo are using, depending on which different normalization would be used.

aggregate_method

The method to aggregate single cell profiles into metacell profiles

output_file

The directory for output saving

Nrep

The number of permutation repetitions we use when deriving the null.

gene_filter

A proportion. Genes expressed lower than this proportion will be filtered out.

feature_use

The number of genes to use in metacell testing.

cor_method

The method for gene correlation calculation description

prePro

A boolean indicating whether to normalize obj_singlecell for preprocessing.

test_cutoff

The test size for dubious metacell detection testing

thre_smooth

A boolean indicating whether to smooth the threshold function

thre_bw

If thre_smooth is True, thre_bw specifies the bandwidth for smoothing

draw

A boolean indicating whether to visualize the mcRigor results

pur_metric

Can be NULL or a metadata variable name, ex. cell type.

check_purity

A boolean indicating whether to calculate the metacell purity of specific fields or not.

fields

A vector of the fields of interest, ex. celltype. It should be a subset of obj_singlecell's meta.data.

step_save

A boolean indicating whether to save the outputs step by step

Value

A list containing the following fields:

mc_res

A named vector indicating whether each metacll is dubious or trustworthy

obj_metacell

The metacell Seurat object with the mcRigor detection results in the metadata

thre

The thresholds for dubious metacell detection

TabMC

A dataframe containing the permutation results, elements to calculate the test statistics mcDiv and mcDiv null

test_plot

The scatter plots demonstrating the mcDiv values and the obtained thresholds for dubious metacell detection

purity_plot

A violin plot showing the purity distribution of the pur_metric covariate in dubious metacells and trustworthy metacells