This is the first step in an analysis using limorhyde2, the second is to moderate the fits using getPosteriorFit().

getModelFit(
  y,
  metadata,
  period = 24,
  nKnots = 4L,
  timeColname = "time",
  condColname = NULL,
  covarColnames = NULL,
  nShifts = 3L,
  method = c("trend", "voom"),
  lmFitArgs = list(),
  eBayesArgs = if (method == "trend") list(trend = TRUE) else list(),
  keepLmFits = FALSE
)

Arguments

y

Matrix-like object of measurements, with rows corresponding to features and columns to samples.

metadata

data.frame containing experimental design information for each sample. Rows of metadata must correspond to columns of y. Row names are ignored.

period

Number specifying the period for the time variable, in the same units as the values in the timeColname column.

nKnots

Number of internal knots for the periodic spline for the time variable. Use NULL to fit a cosinor-based model instead of a spline-based model.

timeColname

String indicating the column in metadata containing the time at which each sample was acquired.

condColname

String indicating the column in metadata containing the condition in which each sample was acquired. NULL indicates all samples came from the same condition. If not NULL, the model will include main effects and interactions with the terms for time.

covarColnames

Character vector indicating the columns in metadata containing covariates to include in the model. NULL indicates no covariates.

nShifts

Number of shifted models to fit. Only used for periodic splines, not for cosinor. Do not change from the default unless you know what you're doing.

method

String indicating how to fit the mean-variance relationship in the data. Use 'trend' for microarray data and 'voom' for RNA-seq count data.

lmFitArgs

List of arguments passed to limma::lmFit().

eBayesArgs

List of arguments passed to limma::eBayes().

keepLmFits

Logical indicating whether to keep the complete fit objects from limma. Not needed by any functions in limorhyde2.

Value

A limorhyde2 object with elements:

  • metadata: As supplied above, converted to a data.table.

  • timeColname: As supplied above.

  • condColname: As supplied above.

  • covarColnames: As supplied above.

  • coefficients: Matrix with rows corresponding to features and columns to model terms, including all shifted models.

  • shifts: Numeric vector indicating amount by which timepoints were shifted for each shifted model.

  • period: As supplied above.

  • condLevels: If condColname is not NULL, a vector of unique values of the condition variable.

  • nKnots: Number of knots, where 2 indicates a cosinor-based model.

  • nConds: Number of conditions.

  • nCovs: Number of covariates.

  • lmFits: If keepLmFits is TRUE, a list of fit objects from limma, with length equal to length of the shifts element.

See also