roast_contrasts: Test contrasts of gene sets between groups using rotation...

View source: R/roast_contrasts.R

roast_contrastsR Documentation

Test contrasts of gene sets between groups using rotation testing with output to Excel

Description

Test contrasts of gene sets using roast with functions mroast or fry. It returns a data frame with statistics per gene set, and writes this to an Excel file. The Excel file links to CSV files, which contain statistics per gene set. Some of the arguments only apply to mroast. See examples in vignette.

Usage

roast_contrasts(
  object,
  G,
  feat.tab,
  grp = NULL,
  contrast.v,
  design = NULL,
  fun = c("fry", "mroast"),
  set.statistic = "mean",
  name = NA,
  weights = NA,
  gene.weights = NULL,
  trend = FALSE,
  block = NULL,
  correlation = NULL,
  adjust.method = "BH",
  min.nfeats = 3,
  max.nfeats = 1000,
  nrot = 999,
  alternative = c("two.sided", "less", "greater"),
  check.names = TRUE,
  pwy.nchar = 199,
  seed = 0
)

Arguments

object

Matrix-like data object containing log-ratios or log-expression values, with rows corresponding to features (e.g. genes) and columns to samples. Must have row names that are non-duplicated and non-empty.

G

Gene set list as returned from read_gmt.

feat.tab

Table of feature (e.g. gene) statistics that the Excel table can link to.

grp

Vector of sample groups. These must be valid variable names in R and the same length as ncol(object).

contrast.v

Named vector of contrasts, passed to makeContrasts.

design

Design matrix of the experiment, with rows corresponding to samples and columns to coefficients to be estimated.

fun

Function to use, either fry or mroast.

set.statistic

Summary set statistic. Possibilities are "mean", "floormean", "mean50", or "msq". Only for mroast.

name

Name for the folder and Excel file that get written. Set to NA to avoid writing output.

weights

Non-negative observation weights. Can be a numeric matrix of individual weights of same size as the object, or a numeric vector of sample weights with length ncol(object), or a numeric vector of gene weights with length equal to nrow(object). Set to NULL to ignore object$weights. weights=NA (with length one) doesn't pass weights to limma.

gene.weights

Numeric vector of directional (positive or negative) genewise weights. These represent each gene's contribution to pathways. They are not for precision weights, from weights. This vector must have length equal to nrow(object). Only for mroast.

trend

Logical; should an intensity-trend be allowed for the prior variance? Default is that the prior variance is constant.

block

Vector specifying a blocking variable on the samples. Has length = ncol(object). Must be NULL if ndups > 1.

correlation

Inter-duplicate or inter-technical replicate correlation. Must be given if ndups>1 or !is.null(block).

adjust.method

Method used to adjust the p-values for multiple testing. Only for mroast.

min.nfeats

Minimum number of features (e.g. genes) needed in a gene set for testing.

max.nfeats

Maximum number of features (e.g. genes) needed in a gene set for testing.

nrot

Number of rotations used to estimate the p-values for mroast.

alternative

Alternative hypothesis; must be one of "two.sided", "greater" or "less". "greater" corresponds to positive association, "less" to negative association.

check.names

Logical; should names(grp)==rownames(object) be checked? Ignored if is.null(design).

pwy.nchar

Numeric maximum number of characters allowed in pathway name.

seed

Integer seed to set for reproducility if fun="mroast", since mroast uses random simulations. Ignored if fun="fry".

Details

Pathway (i.e. gene set) names are altered to be valid filenames in Windows and Linux. Numeric columns are rounded to 8 significant figures.

This function does not accept ndups nor spacing, because we found that these arguments do not impact limma::mroast nor limma::fry.

Value

Data frame of gene set statistics.


jdreyf/ezlimma documentation built on April 28, 2024, 1:10 p.m.