cell_sampler: Sample cells and apply function

Description Usage Arguments Value

View source: R/cell_sampler.R

Description

Sample a certain number of cells from a DGE data.frame and apply a specific function to the subset.

Usage

1
2
cell_sampler(dge, size, fun, groups = NULL, n = 1, simplify = TRUE,
  replace = TRUE, funArgs = list())

Arguments

dge

A data.frame containing DGE data, with rows being genes and columns cells. The first column is assumed to provide the gene identifiers.

size

Number of cells that should be sampled. If different sizes should be sampled each specified group, size needs to be a vector of length length(levels(groups)) providing sizes for each group of cells. If groups is used it's recommendend that size is a named vector with group ids as names, as this will ensure correct sizes per group.

fun

Function to apply to sampled cells. Needs to take a DGE data.frame as it's first positional argument.

groups

Optional; a factor of the same length as the number of cells providing group assignments for each cell in dge. If groups = NULL all cells are assigned to the same group.

n

Number of times a sample is drawn and the function is applied.

simplify

Logical or character string specifying if and how the output should be simplified. See help for sapply for more information.

replace

Should samples be drawn with replacement?

funArgs

Optional; a list with additional arguments for the applied function fun.

Value

A list of output objects from each sampling iteration of the selected function fun if simplify = FALSE. If simplify = TRUE a vector, matrix, or, if simplify = "array", an array if appropriate.


argschwind/dropseqr documentation built on May 23, 2019, 4:24 p.m.