synthesize_cells: Synthesize Fake Cells

View source: R/synthesize_cells.R

synthesize_cellsR Documentation

Synthesize Fake Cells

Description

This function is used to synthesize fake cells via linear combination when the number of cells is not the power of 2. First, we need cell group information where real cells are sampled from. If no group information input, we perform k-means algorithm on the data and use NbClust funciton to determin the best cluster number. Finally, we merge the synthesized and real data as the output result.

Usage

synthesize_cells(dataset, group = NULL, seed, verbose = FALSE)

Arguments

dataset

A matrix or the result generated by wrap_expression

group

A vector. Default is NULL.

seed

Integer. A random seed.

verbose

If return messages.

Value

A list generated by wrap_expression

Examples

set.seed(1)
a <- matrix(rpois(n = 2500, lambda = 2), nrow = 50)
rownames(a) <- paste0("cell_", 1:ncol(a))
colnames(a) <- paste0("gene_", 1:nrow(a))
dataset_ref <- dynwrap::wrap_expression(
  counts = a,
  expression = log2(a+1)
)
result <- synthesize_cells(dataset = a, seed = 2)

duohongrui/simutils documentation built on March 12, 2024, 8:40 p.m.