runSVA: Test for surrogate variables

View source: R/runSVA.R

runSVAR Documentation

Test for surrogate variables

Description

Takes a DGEobj from runVoom and tests for surrogate variables. Adds a new design matrix to the DGEobj with the surrogate variable columns appended using cbind. runVoom should then be run again with the new design matrix to complete the analysis.

Usage

runSVA(dgeObj, designMatrixName, n.sv, method = "leek")

Arguments

dgeObj

A DGEobj with normalized counts and a designMatrix.

designMatrixName

The itemName of the design matrix in DGEobj.

n.sv

Optional; Use to override the default n.sv returned by num.sv for the number of SV to analyze.

method

Method passed to num.sv. Supports "leek" or "be". (Default = "leek")

Value

dgeObj containing an updated design table, the svobj and a new design matrix.

Examples

## Not run: 
   # NOTE: Requires the sva package

    dgeObj <- readRDS(system.file("exampleObj.RDS", package = "DGEobj"))

    ###  Create a model based on surgery status, intentionally omitting the compound treatments
    dgeObj$design$SurgeryStatus <- "BDL"
    dgeObj$design$SurgeryStatus[dgeObj$design$ReplicateGroup == "Sham"] <- "Sham"
    formula <- '~ 0 + SurgeryStatus'
    designMatrix <- model.matrix (as.formula(formula), dgeObj$design)

    # Make sure the column names in the design matrix are legal
    colnames(designMatrix) <- make.names(colnames(designMatrix))

    #capture the formula as an attribute of the design matrix
    attr(designMatrix, "formula") <- formula

    #add the designMatrix to the DGEobj
    dgeObj <- DGEobj::addItem(dgeObj,
                              item      = designMatrix,
                              itemName  = "SurgeryStatusDesign",
                              itemType  = "designMatrix",
                              parent    = "design",
                              overwrite = TRUE)

    dgeObj <- runSVA(dgeObj, designMatrixName = "SurgeryStatusDesign")

## End(Not run)


DGEobj.utils documentation built on May 20, 2022, 1:08 a.m.