# 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")
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab