evaluate_library: evaluate_library

View source: R/evaluate_library.R

evaluate_libraryR Documentation

evaluate_library

Description

For the selected library, returns estimates of the library quality (at cell, gene and/or celltype levels) as a function of number of genes. Grid of number of genes is specified with 'library.size_type' and 'n_genes.step' arguments. For each type of stat (cell, gene and/or celltype) returns data.frame with calculated statistics, and field 'n_genes' correspond to number of genes used.

Usage

evaluate_library(
  sce,
  genes.selection,
  genes.all = rownames(sce),
  batch = NULL,
  n.neigh = 5,
  nPC.all = 50,
  library.size_type = "single",
  n_genes.step = 10,
  return.cell_score_stat = T,
  return.gene_score_stat = T,
  return.celltype_stat = T,
  celltype.id = "celltype",
  verbose = TRUE,
  neighs.all_stat = NULL,
  gene_stat_all = NULL,
  ...
)

Arguments

sce

SingleCellExperiment object containing gene counts matrix (stored in 'logcounts' assay).

genes.selection

Character vector specifying genes to be used for the construction of Selection kNN-graph.

genes.all

Character vector specifying genes to be used for the construction of True kNN-graph.

batch

Name of the field in colData(sce) to specify batch. Default batch=NULL if no batch is applied.

n.neigh

Positive integer > 1, specifying number of neighbors to use for kNN-graph. Default n.neigh=5.

nPC.all

Scalar (or NULL if no PCA is to be applied) specifying number of PCs to use for construction of True kNN-graph. Default nPC.all=50.

library.size_type

String identifying whether evaluation should be performed only on the whole inserted library (= 'single') or on a series of subsets of the library (= 'series'). Default library.size_type="single".

n_genes.step

In case library.size_type == "series", a scalar identifying the step of the grid for library subsets. Default n_genes.step=10.

return.cell_score_stat

Boolean identifying whether stat on cell neighborhood preservation score should be returned. Default return.cell_score_stat=TRUE.

return.gene_score_stat

Boolean identifying whether stat on gene prediction score should be returned. Default return.gene_score_stat=TRUE.

return.celltype_stat

Boolean identifying whether stat on celltype mapping should be returned. Default return.celltype_stat=TRUE.

celltype.id

Character specifying which field in colData(sce) should be used as celltype. Default celltype.id="celltype".

verbose

Boolean identifying whether intermediate print outputs should be returned. Default verbose=TRUE.

neighs.all_stat

If not NULL (NULL is default), contains precomputed stat relevant for cell neighbourhood preservation score. Use geneBasisR::get_neighs_all_stat to calculate this.

gene_stat_all

If not NULL (NULL is default), contains precomputed stat relevant for gene prediction score. Use geneBasisR::get_gene_correlation_scores to calculate this.

...

Additional parameters

Value

list of evaluation metrics on provided dataset and gene selection

Examples

require(SingleCellExperiment)
n_row = 1000
n_col = 100
sce = SingleCellExperiment(assays = list(logcounts = matrix(rnorm(n_row*n_col), ncol=n_col)))
rownames(sce) = as.character(1:n_row)
colnames(sce) = c(1:n_col)
sce$cell = colnames(sce)
sce$celltype = as.character(sample.int(5, n_col, replace = TRUE))
genes.selection = sample(rownames(sce) , 20)
out = evaluate_library(sce, genes.selection)


MarioniLab/geneBasisR documentation built on June 30, 2023, 2:04 p.m.