getSampledAbund {simphony}R Documentation

Sample abundance values

Description

Sample feature abundance values from the given distributions. This function is used internally by simphony(), and should not usually need to be called directly.

Usage

getSampledAbund(
  abundDt,
  logOdds = FALSE,
  family = c("gaussian", "negbinom", "bernoulli", "poisson"),
  inplace = FALSE
)

Arguments

abundDt

data.table of expected abundance. If family is 'gaussian', required columns are feature, sample, mu, and sd. If family is 'negbinom', required columns are feature, sample, mu, dispFunc, cond, and group. If family is 'bernoulli' or 'poisson', required columns are feature, sample, and mu.

logOdds

Logical for whether mu corresponds to log-odds. Only used if family is 'bernoulli'.

family

Character string for the family of distributions from which to sample the abundance values. simphony will give a warning if it tries to sample from a distribution outside the region in which the distribution is defined: \mu < 0 for negative binomial and Poisson, and \mu < 0 or \mu > 1 for Bernoulli.

inplace

Logical for whether to modify abundDt in-place, adding a column abund containing the abundance values.

Value

Matrix of abundance values, where rows correspond to features and columns correspond to samples.

See Also

simphony(), getExpectedAbund()

Examples

library('data.table')
set.seed(6022)
abundDt = data.table(feature = 'feature_1', sample = c('sample_1', 'sample_2'),
                    mu = c(0, 5), sd = 1)
abundMat = getSampledAbund(abundDt)


[Package simphony version 1.0.3 Index]