P-value calculation between groups in split violin plot
1
0
Entering edit mode
3 months ago
AB ▴ 390

Hi All,

I'd like to create a Violin plot of my single cell data split by experimental group with pvalues calculated between each group. Like this example here enter image description here

So far I have the following plot using this code

VlnPlot(seurat_obj,features = "Seurat_module_Score1", group.by = "celltype",split.by = "exp_group",pt.size = 0,split.plot = T,cols=brewer.pal(n=8,name = "Accent"))

enter image description here

I've tried stat_comapare_means and the ggsignif package, but they give me pvalues between the groups in the x-axis and not between the splits. Appreciate any help here.

Thanks

violinplot ggplot singlecellRnaseq • 607 views
ADD COMMENT
0
Entering edit mode
3 months ago

Can you not just do a set of t-tests between the groups you are plotting and label the adjusted p-values? Or is your question specifically related to looking for a ggplot2-type function which will plot and label the data all in one? Because I'm not aware of one that will do everything you would like.

If it was me, I would precalculate the stats and add an annotation to the plot.

ADD COMMENT
0
Entering edit mode

That's what i did. Do a ttest and add that as a label. But I was just wondering if there is a ggplot function to do the same like ggpubr or ggsignif does.

ADD REPLY
0
Entering edit mode

I usually just add it in as another geom, via

gp <- gp + geom_label(aes(x=celltype, y=ypos, label=signif), data=signif_df)

where signif.df might look like

celltype,ypos,signif
"Plasma B cells",0.4,"***"
"Naive B cells",0.4,""
...
ADD REPLY

Login before adding your answer.

Traffic: 2794 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6