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.

Dear Al,
I think the script needs a list of ALL names and this is exactly what I want to avoid. I only want to change the names of the handfull variables I am plotting in the circosPlot. How can I do that?
All the best,

Hi @stepra,

Unfortunately, this is not a feature we could priorities at the moment since it is rarely useful and could introduce complications. You can define a custom function that does that based on the selected variables. You can define a var.names that replaces the selected ones and leaves the other ones as is.

Hope it helps