# NOT RUN {
# First example with multi omics TCGA study
# -----------------------------
data("breast.TCGA")
# this is the X data as a list of mRNA and miRNA; the Y data set is a single data set of proteins
data = list(mrna = breast.TCGA$data.train$mrna, mirna = breast.TCGA$data.train$mirna)
# set up a full design where every block is connected
design = matrix(1, ncol = length(data), nrow = length(data),
dimnames = list(names(data), names(data)))
diag(design) = 0
design
# set number of component per data set
ncomp = c(2)
# set number of variables to select, per component and per data set (this is set arbitrarily)
list.keepX = list(mrna = rep(20, 2), mirna = rep(10,2))
list.keepY = c(rep(10, 2))
TCGA.block.spls = block.spls(X = data, Y = breast.TCGA$data.train$protein,
ncomp = ncomp, keepX = list.keepX, keepY = list.keepY, design = design)
TCGA.block.spls
# in plotindiv we color the samples per breast subtype group but the method is unsupervised!
plotIndiv(TCGA.block.spls, group = breast.TCGA$data.train$subtype, ind.names = FALSE)
# illustrates coefficient weights in each block
plotLoadings(TCGA.block.spls, ncomp = 1)
plotVar(TCGA.block.spls, style = 'graphics', legend = TRUE)
network(TCGA.block.spls)
# Second example with a constraint sPLS
# --------------------
# using the data and design from example above
## we force the first PLS-component of X to be built with only a few variables selected
# in the earlier example
constraint.mrna.comp1 = c("EPHB3", "CBR1", "BSPRY")
constraint.mirna.comp1 = c("hsa-mir-128-2", "hsa-mir-196b")
constraint.prot.comp1 = c("Paxillin")
TCGA.block.spls.constraint = block.spls(X = data, Y = breast.TCGA$data.train$protein, ncomp = 2,
keepX = list(mrna = 20, mirna = 20),
keepY = 20,
keepX.constraint = list(mrna = list(constraint.mrna.comp1), mirna = list(constraint.mirna.comp1)),
keepY.constraint = list(protein = list(constraint.prot.comp1)))
# see if that subset contraint on comp 1 affected the variables selected in comp 2:
intersect(selectVar(TCGA.block.spls.constraint, comp = 2)$mrna$name,
selectVar(TCGA.block.spls, comp = 2)$mrna$name)
# indices of the constraint variable on the first component
TCGA.block.spls.constraint$keepX.constraint
TCGA.block.spls.constraint$keepY.constraint
# }
Run the code above in your browser using DataLab