Modified based on RUV2 from package ruv and RUVg from package RUVSeq function (see these function's documentations for full documentations and usage)

scRUVg(
  Y,
  ctl,
  k,
  Z = 1,
  eta = NULL,
  include.intercept = TRUE,
  fullW = NULL,
  svdyc = NULL
)

Arguments

Y

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

ctl

index vector to specify the negative controls.

k

The number of unwanted factors to use.

Z

Any additional covariates to include in the model.

eta

Gene-wise (as opposed to sample-wise) covariates.

include.intercept

Applies to both Z and eta. When Z or eta (or both) is specified (not NULL) but does not already include an intercept term, this will automatically include one. If only one of Z or eta should include an intercept, this variable should be set to FALSE, and the intercept term should be included manually where desired.

fullW

Can be included to speed up execution. Is returned by previous calls of scRUVg

svdyc

Can be included to speed up execution. For internal use; please use fullW instead.

Value

A list consists of:

  • A matrix newY, the normalised matrix,

  • A matrix W, the unwanted variation matrix, and ;

  • A matrix alpha, this corresponding coefficient matrix for W.

Author

Yingxin Lin, Kevin Wang

Examples

L = scMerge::ruvSimulate(m = 80, n = 1000, nc = 50, nCelltypes = 10)
Y = L$Y; ctl = L$ctl
ruvgRes = scMerge::scRUVg(Y = Y, ctl = ctl, k = 20)