fgcz / prolfqua

Differential Expression Analysis tool box R lang package for omics data
https://pubs.acs.org/doi/pdf/10.1021/acs.jproteome.2c00441
MIT License
40 stars 7 forks source link

How can I re-arrange my samples in a plot in prolfqua #81

Open jjGG opened 3 months ago

jjGG commented 3 months ago

I have my lfqdata object generate the plotter from it and for example would like to generate the intensity_distribution.

lfqpl <- lfqdata_prot$get_Plotter()
lfqpl$intensity_distribution_violin()

image

or similar:

# get the stats
ss <- lfqdata_prot$get_Stats()
ss$violin()

image

How can I change the order of samples ..

btw: prolfqua rocks ;)

wolski commented 3 months ago

Hi @jjGG,

you need to get the data.frame with the statistics using lfqdata$get_Stats()$stats(). The returned table is a tidy table compatible with the grammar of graphics of ggplot.

bb <- prolfqua::sim_lfq_data_peptide_config()
> xx <- lfqdata$get_Stats()$stats()
completing cases
completing cases
> xx$group_ <- factor(xx$group_, levels = c("Ctrl", "B", "A", "All"))
> xx |> ggplot(aes(x = group_, y = CV)) + geom_violin() + ggplot2::stat_summary(fun.y = median,
                                          geom = "point", size = 1, color = "black")