Adding median value to VlnPlot in Seurat
1
0
Entering edit mode
10 weeks ago
Swati • 0

How to add median value to the code for vlnplot:

plot_list <- list()
for (i in gene_list) {
  plot_list[[i]] <- FeaturePlot(data, features = i, split.by = "sample", cols = c("grey","blue"))
}
vplot_list <- list()
data$clusternum <- Idents(data)
for (i in gene_list) {
  vplot_list[[i]] <- VlnPlot(data, features = i, split.by = "sample", group.by = "clusternum",
    pt.size = 0, combine = FALSE)
}
for (i in gene_list) {
  ggsave(paste0("/home/mitralab/featureplot/","map_", i, "_0.2_raw.pdf"),plot = plot_list[[i]], width = 11, height = 8.5)
  pdf(paste0("/home/mitralab/vlnplot/","vin_", i, "_0.2_raw.pdf"), width = 11, height = 8.5)
   print(vplot_list[[i]])
  dev.off()
}
Median Seurat • 541 views
ADD COMMENT
0
Entering edit mode
9 weeks ago
Ming Tommy Tang ★ 2.9k

If you know ggplot2, you can get_expression_data function in here https://divingintogeneticsandgenomics.rbind.io/post/how-to-do-gene-correlation-for-single-cell-rnaseq-data-part-1/ to get the dataframe and use ggplot2 to plot the violin plot and add median or mean. https://r-charts.com/distribution/violin-plot-mean-ggplot2/

ADD COMMENT

Login before adding your answer.

Traffic: 1410 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