Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plotDiablo - group colours #119

Closed
chongchunwie opened this issue Jan 16, 2021 · 5 comments
Closed

plotDiablo - group colours #119

chongchunwie opened this issue Jan 16, 2021 · 5 comments

Comments

@chongchunwie
Copy link

Just wondering how to change the colours of the group under plotDiablo. I have tried col.per.group and col, but to no avail.

@aljabadi
Copy link
Collaborator

Hi @chongchunwie,

Thanks for reporting this. I think I fixed it in my devel which will soon be available on all platforms. You can install using BiocManager::install('aljabadi/mixOmics@devel') . Following is an example:

data('breast.TCGA')
Y = breast.TCGA$data.train$subtype

data = list(mrna =  breast.TCGA$data.train$mrna,
mirna =  breast.TCGA$data.train$mirna, prot =  breast.TCGA$data.train$protein)

# set number of component per data set
ncomp = 3
# set number of variables to select, per component and per data set (arbitrarily set)
list.keepX = list(mrna = rep(20, 3), mirna = rep(10,3), prot = rep(10,3))

# DIABLO using a full design where every block is connected
BC.diablo = block.splsda(X = data, Y = Y, ncomp = ncomp, keepX = list.keepX, design = 'full')
## default col.per.group
plotDiablo(BC.diablo, ncomp = 1, legend = TRUE, col.per.group = NULL)

## custom col.per.group
col.per.group <- viridisLite::viridis(3)
names(col.per.group) <- levels(Y)
plotDiablo(BC.diablo, ncomp = 1, legend = TRUE, col.per.group = col.per.group)

Created on 2021-01-18 by the reprex package (v0.3.0)

@Christoab
Copy link

@aljabadi It seems like there is a mismatch between colors and group in the devel.

Version 6.15.26:
image

Version 6.15.33:
image

@SchererFIMM
Copy link

@aljabadi
Hi, thank you so much for your excellent work and help but I have the same problem, that the coloring of the samples gets screwed up when applying the color.per.group. The ellipses are now in the right colour, but the samples are mixed up. I had installed the mixomics development version and ran:
col.per.group <- c("blue","red")
names(col.per.group) <- levels(Y)
plotDiablo(MyResult.diablo, ncomp = 1, legend = TRUE, col.per.group = col.per.group)

Before
After

best,
Andreas

aljabadi added a commit to aljabadi/mixOmics that referenced this issue Apr 10, 2021
@aljabadi
Copy link
Collaborator

@SchererFIMM @Christoab thanks for pointing this out, not sure how I missed that obvious bug. This should work as expected now. Please follow the installation instruction above.

data('breast.TCGA')
Y = breast.TCGA$data.train$subtype

data = list(mrna =  breast.TCGA$data.train$mrna,
            mirna =  breast.TCGA$data.train$mirna, prot =  breast.TCGA$data.train$protein)

# set number of component per data set
ncomp = 3
# set number of variables to select, per component and per data set (arbitrarily set)
list.keepX = list(mrna = rep(20, 3), mirna = rep(10,3), prot = rep(10,3))

# DIABLO using a full design where every block is connected
BC.diablo = block.splsda(X = data, Y = Y, ncomp = ncomp, keepX = list.keepX, design = 'full')
## default col.per.group
plotDiablo(BC.diablo, ncomp = 1, legend = TRUE, col.per.group = NULL)

## custom col.per.group
col.per.group <- viridisLite::viridis(3)
names(col.per.group) <- levels(Y)
plotDiablo(BC.diablo, ncomp = 1, legend = TRUE, col.per.group = col.per.group)

Created on 2021-04-10 by the reprex package (v2.0.0)

@SchererFIMM
Copy link

Thank you so much for your great help, it works well for me now.
Great toolbox!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants