Hi again Kim-Anh,
Apologies for the lack of context, here i copy my code:
library(BiocParallel)
library(mixOmics)
BPPARAM ← BiocParallel::SnowParam(workers = 12)
###DIABLO SCRIPT
XCAEP ← list(metabolomicsU = log(murineCAEP),
metabolomicsP = log(mplasmaCAEP),
oxidation = oxidationCAEP,
inflammation = plasmaCAEP,
hta = htaCAEP
)
YCAEP ← as.factor(metadataCAEP$Group)
summary(YCAEP)
designCAEP = matrix(1, ncol = length(XCAEP), nrow = length(XCAEP),
dimnames = list(names(XCAEP), names(XCAEP)))
diag(designCAEP) = 0
designCAEP
sgccda.resCAEP = block.splsda(X = XCAEP, Y = YCAEP, ncomp = 4,
design = designCAEP)
sgccda.resCAEP
t1 ← proc.time()
perf.diabloCAEP ← perf(sgccda.resCAEP, validation = ‘Mfold’, folds = 7, nrepeat = 100, cpus = 14, progressBar = TRUE)
perf.diabloCAEP
t2 ← proc.time()
running_time ← t2 - t1; running_time
plot(perf.diabloCAEP)
perf.diabloCAEP$choice.ncomp$WeightedVote
ncompCAEP = perf.diabloCAEP$choice.ncomp$WeightedVote[“Overall.BER”, “centroids.dist”]
ncompCAEP
test.keepXCAEP = list (metabolomicsU = c(seq(5, 30, 10)),
metabolomicsP = c(seq(5, 30, 10)),
oxidation = c(1:4),
inflammation = c(1:10),
hta = c(1:5))
####for tuning consider more than 10 repeats, perhaps 100
t1 ← proc.time()
tune.BBMCAEP ← tune.block.splsda(X = XCAEP, Y = YCAEP, ncomp = 2, test.keepX = test.keepXCAEP,
design = designCAEP, validation = ‘Mfold’, near.zero.var = TRUE,
folds = 7, nrepeat = 1, dist = “max.dist”, progressBar = TRUE,
BPPARAM = BPPARAM)
t2 = proc.time()
running_time = t2 - t1; running_time
list.keepXCAEP = tune.BBMCAEP$choice.keepX
list.keepXCAEP
###end
sgccda.resCAEP = block.splsda(X = XCAEP, Y = YCAEP, ncomp = 2, ####use two components to facilitate interpretation
keepX = list.keepXCAEP, design = designCAEP)
sgccda.resCAEP # list the different functions of interest related to that object
sgccda.resCAEP$design
####Metabolomics Urine variables selected on component 1
selectVar(sgccda.resCAEP, block = “metabolomicsU”, comp = 1)$metabolomicsU$name
####Metabolomics Plasma variables selected on component 1
selectVar(sgccda.resCAEP, block = “metabolomicsP”, comp = 1)$metabolomicsP$name
###Oxidation variables selected on component 1
selectVar(sgccda.resCAEP, block = ‘oxidation’, comp = 1)$oxidation$name
#Inflammation variables selected on component 1
selectVar(sgccda.resCAEP, block = ‘inflammation’, comp = 1)$inflammation$name
#hta variables selected on component 1
selectVar(sgccda.resCAEP, block = ‘hta’, comp = 1)$hta$name
####plots for Diablo Interpretation
plotDiablo(sgccda.resCAEP, ncomp = 1)
plotIndiv(sgccda.resCAEP, ind.names = TRUE, legend = TRUE, title = ‘DIABLO’)
plotArrow(sgccda.resCAEP, ind.names = TRUE, legend = TRUE, title = ‘DIABLO’)
plotVar(sgccda.resCAEP, style = ‘graphics’, legend = TRUE,
var.names = c(FALSE, FALSE, FALSE, TRUE, TRUE))
par(mfrow=c(1,1))
plotLoadings(sgccda.resCAEP, comp = 1, contrib = ‘max’, method = ‘median’)
circosPlot(sgccda.resCAEP, cutoff=0.01, line = TRUE,
color.blocks= c(‘darkorchid’, ‘brown1’, ‘lightgreen’,‘blue’, “yellow”),
color.cor = c(“chocolate3”,“grey20”), size.labels = 0.2, size.variables = 0.5,
var.adj = 0., block.labels.adj = -0.5)
Everything runs correctly, the problem is that when i try to plot the circosplot, it plots the variables from both components 1 and 2. When I add the ncomp =1, to plot only those features from the 1st component, i receive the following error:
Error in do.call(cbind, X)[, colnames(simMat)] : subscript out of bounds
Also, when i create my network, the network only includes variables from the metabolomics in urine and metabolomics in plasma block but any feature from the other blocks. When i extract the similarity matrix, i obtained everything correct.
I hope this description is better and thanks for your support.
Regards,
Oscar