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