Learn R Programming

ruv (version 0.9.7.1)

RUVIII: RUV-III

Description

Globally adjust data matrix using both negative controls and replicates.

Usage

RUVIII(Y, M, ctl, k = NULL, eta = NULL, include.intercept = TRUE,
       average = FALSE, fullalpha = NULL, return.info = FALSE, inputcheck = TRUE)

Arguments

Y

The data. A m by n matrix, where m is the number of observations and n is the number of features.

M

The replicate structure. Represented internally as a mapping matrix. The mapping matrix has m rows (one for each observation), and each column represents a set of replicates. The (i, j)-th entry of the mapping matrix is 1 if the i-th observation is in replicate set j, and 0 otherwise. Each observation must be in exactly one set of replicates (some replicate sets may contain only one observation), and thus each row of M must sum to 1. M may be the mapping matrix itself. Alternatively, M may be a vector, factor, or dataframe, in which case it is converted to the mapping matrix by the replicate.matrix function.

ctl

An index vector to specify the negative controls. Either a logical vector of length n or a vector of integers.

k

The number of unwanted factors to use. Can be 0, in which case no adjustment is made. Can also be NULL (the default value), in which case the maximum possible value of k is used; note that in this case no singular value decomposition is necessary and execution is faster.

eta

Gene-wise (as opposed to sample-wise) covariates. These covariates are adjusted for by RUV-1 before any further analysis proceeds. Can be either (1) a matrix with n columns, (2) a matrix with n rows, (3) a dataframe with n rows, (4) a vector or factor of length n, or (5) simply 1, for an intercept term.

include.intercept

When eta is specified (not NULL) but does not already include an intercept term, this will automatically include one.

average

Average replicates after adjustment.

fullalpha

Can be included to speed up execution. Is returned by previous calls of RUVIII (see below).

return.info

If FALSE, only the adjusted data matrix is returned. If TRUE, additional information is returned (see below).

inputcheck

Perform a basic sanity check on the inputs, and issue a warning if there is a problem.

Value

If codereturn.info is TRUE, a list is returned that contains:

newY

The adjusted data matrix.

M

The replicate mapping matrix. Included for reference.

fullalpha

Can be used to speed up future calls to RUVIII

Otherwise, if return.info is FALSE, only the adjusted data matrix is returned.