Skip to contents

This is the second step in an analysis using limorhyde2, the first is to fit linear models using getModelFit(). This function obtains posterior estimates of coefficients using multivariate adaptive shrinkage (mash), which learns patterns in the data and accounts for noise in the original fits. The defaults for arguments should work well in most cases, so only change them if you know what you're doing.

Usage

getPosteriorFit(
  fit,
  covMethod = c("data-driven", "canonical", "both"),
  getSigResArgs = list(),
  npc = fit$nKnots,
  covEdArgs = list(),
  overwrite = FALSE,
  ...
)

Arguments

fit

A limorhyde2 object.

covMethod

String indicating the type(s) of covariance matrices to use for the mash fit.

getSigResArgs

List of arguments passed to mashr::get_significant_results(). Only used if covMethod is 'data-driven' or 'both'.

npc

Number of principal components passed to mashr::cov_pca(). Only used if covMethod is 'data-driven' or 'both'.

covEdArgs

List of arguments passed to mashr::cov_ed(). Only used if covMethod is 'data-driven' or 'both'.

overwrite

Logical for whether to recompute the mash fit if it already exists.

...

Additional arguments passed to mashr::mash().

Value

A limorhyde2 object containing everything in fit with added or updated elements:

  • mashData: list of mash data objects

  • mashFits: list of mash fit objects

  • mashCoefficients: Matrix of posterior mean coefficients, with rows corresponding to features and columns to model terms.

  • mashIdx: Vector indicating which model terms were included in the mash fit.

Examples

library('data.table')

# rhythmicity in one condition
y = GSE54650$y
metadata = GSE54650$metadata

fit = getModelFit(y, metadata)
fit = getPosteriorFit(fit)
rhyStats = getRhythmStats(fit, features = c('13170', '13869'))

# rhythmicity and differential rhythmicity in multiple conditions
y = GSE34018$y
metadata = GSE34018$metadata

fit = getModelFit(y, metadata, nKnots = 3L, condColname = 'cond')
fit = getPosteriorFit(fit)
rhyStats = getRhythmStats(fit, features = c('13170', '12686'))
diffRhyStats = getDiffRhythmStats(fit, rhyStats)