runSVA: Test for surrogate variables

Description Usage Arguments Value Examples

View source: R/runSVA.R

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

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
    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")

DGEobj.utils documentation built on April 28, 2021, 9:06 a.m.