generate_random_data: Generating random data

View source: R/function_generate_random_data.R

generate_random_dataR Documentation

Generating random data

Description

'generate_random_data' simulates data which can be used exemplary for digital tissue deconvolution. It will generate a numeric matrix with ' n.features' rows, and ('n.types' * 'n.samples.per.type') columns. Each column represents a sample of special type. The function will generate 'n.types', and for each type 'n.samples.per.type'.
Mathematically, each feature is drawn from a poisson distribution. For each feature in every cell type, a lambda is drawn randomly. Then it generates multiple samples per type. This ensures that samples from the same cell type have similar counts for the same feature.

Usage

generate_random_data(
  n.types = 5,
  n.samples.per.type = 10,
  n.features = 1000,
  sample.type = "Cell",
  feature.type = "gene",
  seed = 1310
)

Arguments

n.types

integer, 2 <= 'n.types', how many different types should be included in the data set

n.samples.per.type

integer 1 <= 'n.samples.per.type', how many samples should be generated per type

n.features

integer, 1 <= 'n.features', how many features should be included

sample.type

string, name of samples

feature.type

string, name of features

seed

integer, will be passed to "set_seed"

Value

matrix with ('n.types' * 'n.samples.per.type') columns, and 'n.features' rows

Examples

library(DTD)
random.data <- generate_random_data(
  n.types = 5,
  n.samples.per.type = 10,
  n.features = 100,
  sample.type = "Cell",
  feature.type = "gene"
)

# normalize all samples to the same amount of counts:
random.data <- normalize_to_count(random.data)

MarianSchoen/DTD documentation built on April 29, 2022, 1:59 p.m.