limma_cor: Test correlation of each row of object to phenotype using...

View source: R/limma_cor.R

limma_corR Documentation

Test correlation of each row of object to phenotype using moderated variance

Description

Test correlation of each row of object to phenotype. By default, it uses the model design=model.matrix(~1+phenotype) and tests 2nd coefficient. See examples in vignette.

Usage

limma_cor(
  object,
  phenotype = NULL,
  design = NULL,
  prefix = NULL,
  weights = NA,
  trend = FALSE,
  ndups = NULL,
  spacing = NULL,
  block = NULL,
  correlation = NULL,
  adjust.method = "BH",
  coef = 2,
  reorder.rows = TRUE,
  moderated = TRUE,
  reduce.df = 0,
  check.names = TRUE,
  cols = c("AveExpr", "P.Value", "adj.P.Val", "logFC")
)

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.

phenotype

Numeric vector of sample characteristics (e.g. phenotypes or treatments). Should be same length as ncol(object).

design

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

prefix

Character string to add to beginning of column names. NULL does not add a prefix.

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.

trend

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

ndups

Positive integer giving the number of times each distinct probe is measured in each sample. See Details.

spacing

Positive integer giving the spacing between duplicate occurrences of the same probe, with spacing=1 for consecutive rows. See Details.

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. Options, in increasing conservatism, include "none", "BH", "BY", and "holm". See p.adjust for the complete list of options. A NULL value will result in the default adjustment method, which is "BH".

coef

Column index or column name of the linear model to test, passed to eztoptab.

reorder.rows

Logical, should rows be reordered by p-value?

moderated

Logical; should eBayes be used? Otherwise an unmoderated version for limma to produce ordinary least squares statistics is used.

reduce.df

Number degrees of freedom to subtract from residual. This may be necessary if removeBatchEffect was previously applied to object. Must be <= df.residual returned by lmFit.

check.names

Logical; should names(phenotype)==rownames(object) be checked?

cols

Columns of topTable output to include. Possibilities include "logFC", "SE", "AveExpr", "z", "t", "P.Value", "adj.P.Val", "CI.L", "CI.R", "B". Some of these column names are then changed here. If logFC is specified, FC will automatically also be given.

Details

Exactly one of design or phenotype must be non-null. If design is NULL and phenotype is given, design will be calculated as model.matrix(~0+phenotype). See further details in lmFit.

The defaults of arguments ndups and spacing are set to NULL, which allows these arguments to be overridden by the elements object$printer$ndups and object$printer$spacing, respectively, if these exist. Whereas, if an element does not exist, the corresponding argument is treated as being its default in lmFit, i.e. ndups=1 or spacing=1. If either of these arguments are specified, they would override the respective element of object$printer, if the element existed.

When moderated is FALSE, an error is generated if trend is TRUE.

Value

Data frame.

See Also

lmFit; eBayes; ezcor


jdreyf/ezlimma documentation built on Sept. 16, 2024, 2:08 a.m.