[DIABLO]: cimDiablo - export matrix

Hello,

A similar question is asked by RafaSilva. I am using the DIABLO approach to integrate 2 different omics datasets and came across the cimDiablo function, and have a problem to export the color-coded matrices

My suggestion is that it would be great if those inner-produced correlation matrices could be accessible as an optional output.

Nevertheless, mixOmics package is really a useful package.

Kai

PS: In the meantime, would it be possible to show me how to calculate the matrix using other R function?

Hello @Kai,

We are very glad that mixOmics is helpful in your work!

cimDiablo invisibly returns the correlation matrix and you only need to save it. As an example:

library(mixOmics)
data(nutrimouse)
Y = nutrimouse$diet
data = list(gene = nutrimouse$gene, lipid = nutrimouse$lipid)
design = matrix(c(0,1,1,1,0,1,1,1,0), ncol = 3, nrow = 3, byrow = TRUE)


nutrimouse.sgccda <- block.splsda(X = data,
                                  Y = Y,
                                  design = design,
                                  keepX = list(gene = c(10,10), lipid = c(15,15)),
                                  ncomp = 2,
                                  scheme = "centroid")

par(mar=c(1,1,1,1)) ## adjust the margins for plot so hopefully no RStudio error
## if you got plot.new() error with the following, manually expand your plot area, remove previous plots and run: graphics.off()
cor.mat <- cimDiablo(nutrimouse.sgccda) ## save the output
cor.mat ## the correlation matrix

Let me know if you have further questions.

1 Like

Hey @aljabadi:
Thanks for your help. Really helpful.
Best wishes
Kai

Hey @aljabadi,
Thank you for this great support forum for all mixOmics tools and especially Diablo!

I have a related question regarding saving a cimDiablo() into an an object. Is there an option to obtain/access the dendrogram as well?
In addition, is there a way to change clustering settings in cimDiablo() as it is possible in the basic cim() function, e.g. switching off column clustering or color annotating samples?

Best regards,
julius

Hi @julius,

I just pushed some changes so cimDiablo would accept all cim args and also provide same outputs

You can run the following to try:

BiocManager::install('mixOmicsTeam/mixOmics@devel')
library(mixOmics)
data(nutrimouse)
Y = nutrimouse$diet
data = list(gene = nutrimouse$gene, lipid = nutrimouse$lipid)
design = matrix(c(0,1,1,1,0,1,1,1,0), ncol = 3, nrow = 3, byrow = TRUE)


nutrimouse.sgccda <- block.splsda(X = data,
                                  Y = Y,
                                  design = design,
                                  keepX = list(gene = c(10,10), lipid = c(15,15)),
                                  ncomp = 2,
                                  scheme = "centroid")

par(mar=c(1,1,1,1)) ## adjust the margins for plot so hopefully no RStudio error
## if you got plot.new() error with the following, manually expand your plot area, remove previous plots and run: graphics.off()
cimDiablo(nutrimouse.sgccda, cluster= 'row') ## cluster rows only
res <- cimDiablo(nutrimouse.sgccda) ## save the output
res$ddr

Hope it helps

1 Like

Thank you @aljabadi!

Hi @aljabadi

I had a similar question, though when I run this code you have provided, I get the error:

unused argument (cluster= ‘row’)

Do you have any suggestions for this? Thank you in advance.

Hi @allison,

I don’t seem to get that error. Can you ensure mixOmics >= 6.15.44 is loaded after iinstallation & try again?

That works – easy fix! thank you