Skip to contents

Calculate expected abundance for multiple features at multiple timepoints in multiple conditions.

Usage

getExpectedAbund(
  featureMetadata,
  times = NULL,
  sampleMetadata = NULL,
  byCondGroup = is.null(times)
)

Arguments

featureMetadata

data.table with columns feature, base, rhyFunc, amp, period, and phase, where every row corresponds to a gene. If byCondGroup is TRUE, then must also have columns cond and group.

times

Numeric vector of the times at which to calculate expected abundance for each row in featureMetadata.

sampleMetadata

data.table with columns sample, cond, and time. Either times or sampleMetadata must be provided, and the former takes precedence.

byCondGroup

Logical for whether to speed up the calculation by grouping by the columns cond and group. Primarily for internal use.

Value

data.table derived from featureMetadata (but with more rows), with additional columns time and mu and possibly others. If sampling will use the negative binomial family, mu corresponds to log2 counts.

Examples

library('data.table')
featureMetadata = data.table(feature = c('feature_1', 'feature_2'),
                             base = function(x) 0,
                             amp = c(function(x) 0, function(x) 1),
                             period = 24,
                             phase = 0, rhyFunc = sin)
abundDt = getExpectedAbund(featureMetadata, times = 6:17)