## plot of individuals for objects of class 'rcc'
# ----------------------------------------------------
data(nutrimouse)
X <- nutrimouse$lipid
Y <- nutrimouse$gene
nutri.res <- rcc(X, Y, ncomp = 3, lambda1 = 0.064, lambda2 = 0.008)
plotArrow(nutri.res)
# names indicate genotype
plotArrow(nutri.res,
group = nutrimouse$genotype, ind.names = nutrimouse$genotype)
plotArrow(nutri.res, group = nutrimouse$genotype,
add.legend = TRUE)
## plot of individuals for objects of class 'pls' or 'spls'
# ----------------------------------------------------
data(liver.toxicity)
X <- liver.toxicity$gene
Y <- liver.toxicity$clinic
toxicity.spls <- spls(X, Y, ncomp = 3, keepX = c(50, 50, 50),
keepY = c(10, 10, 10))
#default
plotArrow(toxicity.spls)
# colors indicate time of necropsy, text is the dose
plotArrow(toxicity.spls, group = liver.toxicity$treatment[, 'Time.Group'],
ind.names = liver.toxicity$treatment[, 'Dose.Group'],
add.legend = TRUE)
# colors indicate time of necropsy, text is the dose, label at start of arrow
plotArrow(toxicity.spls, group = liver.toxicity$treatment[, 'Time.Group'],
ind.names = liver.toxicity$treatment[, 'Dose.Group'],
add.legend = TRUE, position.names = 'start')
## variable representation for objects of class 'sgcca' (or 'rgcca')
# ----------------------------------------------------
data(nutrimouse)
Y = unmap(nutrimouse$diet)
data = list(gene = nutrimouse$gene, lipid = nutrimouse$lipid, Y = Y)
design1 = matrix(c(0,1,1,1,0,1,1,1,0), ncol = 3, nrow = 3, byrow = TRUE)
nutrimouse.sgcca <- wrapper.sgcca(blocks = data,
design = design1,
penalty = c(0.3, 0.5, 1),
ncomp = c(2, 2, 3),
scheme = "centroid",
verbose = FALSE,
bias = FALSE)
# default style: same color for all samples
plotArrow(nutrimouse.sgcca)
plotArrow(nutrimouse.sgcca, group = nutrimouse$diet, add.legend =TRUE,
main = 'my plot')
# ind.names to visualise the unique individuals
plotArrow(nutrimouse.sgcca, group = nutrimouse$diet, add.legend =TRUE,
main = 'my plot', ind.names = TRUE)
# ind.names to visualise the unique individuals
plotArrow(nutrimouse.sgcca, group = nutrimouse$diet, add.legend =TRUE,
main = 'my plot', ind.names = TRUE,position.names = 'start')
plotArrow(nutrimouse.sgcca, group = nutrimouse$diet, add.legend =TRUE,
main = 'my plot', ind.names = TRUE,position.names = 'end')
# ind.names indicates the diet
plotArrow(nutrimouse.sgcca, group = nutrimouse$diet, add.legend =TRUE,
main = 'my plot', ind.names = nutrimouse$diet, position.names= 'start')
# ind.names to visualise the unique individuals, start position
plotArrow(nutrimouse.sgcca, group = nutrimouse$diet, add.legend =TRUE,
main = 'my plot', ind.names = TRUE, position.names = 'start')
# end position
plotArrow(nutrimouse.sgcca, group = nutrimouse$diet, add.legend =TRUE,
main = 'my plot', ind.names = TRUE, position.names = 'end')
## variable representation for objects of class 'sgccda'
# ----------------------------------------------------
# Note: the code differs from above as we use a 'supervised' GCCA analysis
data(nutrimouse)
Y = nutrimouse$diet
data = list(gene = nutrimouse$gene, lipid = nutrimouse$lipid)
design1 = matrix(c(0,1,0,1), ncol = 2, nrow = 2, byrow = TRUE)
nutrimouse.sgccda1 <- wrapper.sgccda(blocks = data,
Y = Y,
design = design1,
ncomp = c(2, 2),
keep = list(c(10,10), c(15,15)),
scheme = "centroid",
verbose = FALSE,
bias = FALSE)
# default colors correspond to outcome Y
plotArrow(nutrimouse.sgccda1)
# with legend and title and indiv ID
plotArrow(nutrimouse.sgccda1, add.legend = TRUE, main = 'my sample plot',
ind.names = TRUE, position.names = 'start')
Run the code above in your browser using DataLab