waldronlab / lefser

R implementation of the LEfSe method
https://waldronlab.io/lefser/
43 stars 6 forks source link

Group in lefserPlot does not reflect levels in groupCol factor #15

Closed Jorisvansteenbrugge closed 11 months ago

Jorisvansteenbrugge commented 3 years ago

Hi,

I'm using the vignette as an example.

res <- lefser(zeller14, groupCol = "study_condition", blockCol = "age_category")

Here, the study_condition is a factor containing the levels CRC and control. When plotting the results using lefserPlot, the group labels are displayed as 0 and 1. Would it be possible for the plot labels to reflect the e.g. CRC and control labels?

esoadjah commented 3 years ago

Hi, I am having the same issue. Any solution to the above?

morganx commented 3 years ago

It looks to be hard-coded into the lefserPlot function but you can change the labels to whatever you want with scale_fill_discrete(). It does require knowing which group should be zero and which group should be one.

IE p<-lefserPlot(res)

p + scale_fill_discrete(name="Group", labels=c("Control", "Cancer"))

Note that this solution breaks lefse's default red/green color scheme and you'll have to do a bit more ggplot twiddling if you want to keep the red/green colours.