Var.names in circosPlot

Dear Mixomics team,
it is me again still analyzing my data with Mixomics and I wanted to get the graphs ready for a publication now. However for that I need to plot the circosplots with other variable names than the ones given in the matrix. Therefore I use var.names in the circosPlot command. I input a list with 3 vectors that have the same length as the corresponding data. I constructed them in the same way I did construct the data (e.g. names=list(metabolomics=namesm,bacteria=names03,fungi=namesf) ). However I always get an error: Error: var.names must be either a vector of length 3 or a list of 3 vector components of length 243, 4362 and 742 respectively.
I checked for examples on how to use var.names in circosplot but I could not find any example where is used. Can you maybe provide an example so I can check if that works?
Best regards and thanks in advance
Marine

Hi @marine,

Each element of var.names should have the same length as the blocks in X.

See following example for which it works:

suppressMessages(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 <- wrapper.sgccda(X=data,
                                    Y = Y,
                                    design = design,
                                    keepX = list(gene=c(10,10), lipid=c(15,15)),
                                    ncomp = 2,
                                    scheme = "horst")
#>  create var.names
var.names <- lapply(data, function(x){
    paste0("prefix-", colnames(x), "-suffix")
})
str(var.names)
#> List of 2
#>  $ gene : chr [1:120] "prefix-X36b4-suffix" "prefix-ACAT1-suffix" "prefix-ACAT2-suffix" "prefix-ACBP-suffix" ...
#>  $ lipid: chr [1:21] "prefix-C14.0-suffix" "prefix-C16.0-suffix" "prefix-C18.0-suffix" "prefix-C16.1n.9-suffix" ...
circosPlot(nutrimouse.sgccda, cutoff = 0.7, ncol.legend = 2, size.legend = 1.1, var.names = var.names, line = FALSE)

Created on 2020-04-17 by the reprex package (v0.3.0)

Please let us know if you continue to have problems.

Thanks Al for your quick response indeed now I got it to work.
Two more questions

  1. is there a way to increase the distance between the circos plot and the line around it? Since my variable names are big they overlap with the lines so I would like to increase the distance. Is that possible?
  2. It seems that if there are more variables (f.e 40 per block) there is a problem with the labeling that either the labels are covered by the blockcolouring or turned the wrong way. Is that a bug?


Thanks!

I also checked this error with the labeling (e.g. they are on top of each other or covered by the coloring of the block remains even if I make the font smaller or if I change the settings of how I save the picture (.f.e making it rather broad than wide). Did anyone ever encounter the same problem and has a solution for it?

Hi @marine,

Thanks for reporting this and sorry I missed your follow-up. It is in fact a bug and I’m looking into it. I’ll update you once I have it fixed.

Best,

Al

Hi @marine,

I made it possible to adjust the location of variable names using a hidden var.adj argument in the latest devel version: https://github.com/mixOmicsTeam/mixOmics/tree/devel#development-version
See the example provided below.

The variable labels change direction at certain degrees for increased readability. Also, when you Zoom you might see masking of labels but when you save it to file or look into the plot pane, that should not be the case. See the example below.

Additionally, since lines do not add much insights in this plot I’d use lines=FALSE. I cannot see any links (high correlations) b/w variables in the provided plot. I’m not sure if that is because you have chosen a strict correlation threshold or something else such as your design matrix. I recommend you look into that.

suppressMessages(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 <- wrapper.sgccda(X=data,
                                    Y = Y,
                                    design = design,
                                    keepX = list(gene=c(30,10), lipid=c(21,10)),
                                    ncomp = 2,
                                    scheme = "horst")
var.names <- lapply(data, function(x){
    paste0("prefix-", colnames(x), "-suffix")
})

## plot with adjustment - I recommend no lines as they do not add much to your visualisation
circosPlot(nutrimouse.sgccda, cutoff = 0.7, ncol.legend = 2, size.legend = 1.1, var.names = var.names, line = FALSE, var.adj = 1)

## save without adjustment - variable names should not be masked when saved to file
png('circosPlot.png')
circosPlot(nutrimouse.sgccda, cutoff = 0.7, ncol.legend = 2, size.legend = 1.1, var.names = var.names, line = FALSE)
dev.off()

Please let us know if you have further questions/issues.

Best,

Al