Changing variable names for plots

Thanks for an amazing tool! It has helped me a lot in my projects so far. I also enjoy the great quality visualisations! However, my dataset contains partly very long names including ugly changes R does automatically, like turning every space or ‘(’ into a dot. In my circosplot, I therefore want to change the names of my 35 important metabolites (out of 987 in total). So I wonder if there is an easy way of doing this by somehow changing the names of keepX for that dataset instead of going back to my input and looking for those 35 metabolites amongst the unimportant one, changes these manually and rerun the analysis. That would be great!

Hi @stepra,

The var.names argument in circosPlot does exactly what you wish. Please see the following example:

Y = nutrimouse$diet
data = list(gene = nutrimouse$gene, lipid = nutrimouse$lipid)
gene_names <- colnames(data$gene)
lipid_names <- colnames(data$lipid)
## add custom feature names
var.names <- list(
    gene = paste0('GENE_', seq_len(ncol(data$gene))),
    lipid = paste0('LIPID_', seq_len(ncol(data$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")

circosPlot(nutrimouse.sgccda, cutoff = 0.7, ncol.legend = 2, size.legend = 1.1, var.names = var.names)

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

Thank you! I’ll try that.