zhouhj1994 / LinDA

33 stars 3 forks source link

Show only Debiased in plot.lfc #17

Open 16svale opened 4 months ago

16svale commented 4 months ago

Dear developer, I would like to add some more information on the lfc plots.

1) How to show only the Debiased point on the plot.lfc? 2) How to order the taxa on the y Axis according to the lfc value? 3) How to adjust the size of the shape according to the p.adj value?

Best regards, Vale

image

zhouhj1994 commented 4 months ago

Hello,

The package currently does not support for those adaptations. To achieve those goals, you need to modify some codes manually: change the codes of lines 553-565 to

Log2FoldChange = lfc[ind.rej] ind.ord <- order(Log2FoldChange) taxa.rej <- taxa[ind.rej][ind.ord] taxa.rej <- factor(taxa.rej, levels = taxa.rej) data.plot.lfc <- cbind.data.frame(Taxa =taxa.rej Log2FoldChange = Log2FoldChange[ind.ord], lfcSE = lfcSE[ind.rej][ind.ord], padj = pdaj[ind.rej][ind.ord]) ind <- order() plot.lfc.i <- ggplot(data.plot.lfc, aes(x = Log2FoldChange, y = Taxa)) + geom_point(aes(size = padj)) + geom_errorbar(aes(xmin = Log2FoldChange - 1.96 * lfcSE, xmax = Log2FoldChange + 1.96 * lfcSE), width = .2) + geom_vline(xintercept = 0, color = 'gray', linetype = 'dashed') + ggtitle(titles[i]) + theme_bw(base_size = 18)

zhouhj1994 commented 4 months ago

Change the codes of lines 553-565 to

Log2FoldChange = lfc[ind.rej] 
ind.ord <- order(Log2FoldChange) 
taxa.rej <- taxa[ind.rej][ind.ord] 
taxa.rej <- factor(taxa.rej, levels = taxa.rej) 

data.plot.lfc <- cbind.data.frame(Taxa =taxa.rej, Log2FoldChange = Log2FoldChange[ind.ord],  
                                                         lfcSE = lfcSE[ind.rej][ind.ord], padj = pdaj[ind.rej][ind.ord]) 

plot.lfc.i <- ggplot(data.plot.lfc, aes(x = Log2FoldChange, y = Taxa)) +
        geom_point(aes(size = padj)) +
        geom_errorbar(aes(xmin = Log2FoldChange - 1.96 * lfcSE,
                          xmax = Log2FoldChange + 1.96 * lfcSE), width = .2) +
        geom_vline(xintercept = 0, color = 'gray', linetype = 'dashed') +
        ggtitle(titles[i]) +
        theme_bw(base_size = 18)