Dear all,
I am wondering how to make a volcano plot including all features in a Seurat Object.
Following the Seurat tutorial for pbmc3k (https://satijalab.org/seurat/articles/pbmc3k_tutorial.html), the differentially expressed gene marker can be found by the FindMarkers command, and it will give a data.frame of marker genes and related log2(fold change) and p-value:
cluster2.markers <- FindMarkers(pbmc, ident.1 = 2, min.pct = 0.25)
head(cluster2.markers, n = 5)
## p_val avg_log2FC pct.1 pct.2 p_val_adj
## IL32 2.892340e-90 1.2013522 0.947 0.465 3.966555e-86
## LTB 1.060121e-86 1.2695776 0.981 0.643 1.453850e-82
## CD3D 8.794641e-71 0.9389621 0.922 0.432 1.206097e-66
## IL7R 3.516098e-68 1.1873213 0.750 0.326 4.821977e-64
## LDHB 1.642480e-67 0.8969774 0.954 0.614 2.252497e-63
Based on this a volcano plot can be made by ggplot2
ggplot(cluster2.markers, aes(x = avg_log2FC, y = -log10(p_val_adj))) +
geom_point(aes(color = ifelse(p_val_adj < 0.05, "Significant", "Not Significant")), alpha = 0.6) +
scale_color_manual(values = c("Significant" = "red", "Not Significant" = "black")) +
labs(x = "Log2(Fold Change)", y = "-log10(P-value)") +
theme_classic()
However, this plot only includes the markers. if all features are to include, I guess the log2(fold change) and p-value need to be calculated. Do you know the method used to calculate those of markers? or is there any other method that can be applied to all the features?
Thank you in advance!
1 answer
There are two issues. First min.pct=0.25 is restricting only to those markers expressed in at least 25% of the cells in each cluster; so if you want to run on all markers, you will need to lower this to 0. Second, by default, there is a minumum log2FC threshold in FindMarkers, which filters the output features to only those with avg_log2FC > 0.25, so you also need to set logfc.threshold=-Inf
Log in to answer this question.