Error in circosplot and Network

Hi,

Thanks for all your work. Recently I experienced a couple of issues. The first one is that when plotting a Circos figure in some cases i cannot select to plot only the component 1 (when my model have 2 o 3) and i obtain the following error:

Error in do.call(cbind, X)[, colnames(simMat)] : subscript out of bounds

The second is when creating a Network, the network only contain features from two blocks and none from the other blocks (regardless if i use cutoff or not). If i extract the CorMat all the variables from the different blocks are there.

Thanks in advance.
Oscar

hi @odrangel,

See the heading of this forum to report an issue as we won’t be able to trouble shoot otherwise. Make sure the examples work on your version before you move on to your own data.

For the CorMat, a quick fix is to input the similarity into Cytoscape (you can save this output as a .gml, e.g.

library(igraph)
myNetwork <- network(diablo.tcga, blocks = c(1,2,3), cutoff = 0.4)
write.graph(myNetwork$gR, file = "myNetwork.gml", format = "gml")

Kim-Anh

1 Like

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

hi @odrangel

thanks for sharing the code, although without data I cannot run it myself. Some suggestions here:

  • for circosPlot, it should be comp = 1 (not comp = 1, maybe that is a typo in your post)
  • it could be that there is a bug in our package. At the moment we don’t have a developer so fixing it would take some time. One quick fix would be that you simply run a block.splsda only on the first component and plot the circosPlot that way
  • for the network (I can’t see how you use the code), did you change the cutoff value? it could be that these variables are not shown if they dont pass the cutoff. Have a look at the values in your simMat.

You can send me your RData (including the objects saved) so that I can have a closer look, as I can only guess here.

Kim-Anh

1 Like