這次和大家分享下利用ggmaplot繪制差異基因篩選后的火山圖允扇,用到的基因集是ggpubr里面自帶的數(shù)據(jù)集diff_express數(shù)據(jù)集
可以看到basemean為所有樣本數(shù)中特定基因的表達量的平均值,detection_all為一個數(shù)字型向量,用以確定特定基因集(筆者理解類似GSEA里面的基因集,可以指定特定基因集繪制其火山圖)
以下是ggmaplot主要參數(shù)的用法
以下代碼實戰(zhàn)
library(ggpubr)
data(diff_express)
View(diff_express)
后面的代碼中沒有指定映射眷唉,所以筆者認為防止報錯佩微,需要檢查并把列名改為模擬數(shù)據(jù)集中的同樣的名稱
colnames(diff_express)
ggmaplot(diff_express,#數(shù)據(jù)集
main = expression("Group 1" %->% "Group 2"),#定義比較組及標題
fdr = 0.05, #校驗P值水平
fc = 2, #foldchange
size = 0.4,#點大小
palette = c("#B31B21", "#1465AC", "darkgray"),#色板
genenames = as.vector(diff_express$name),#指定特定行為基因名
legend = "top", #圖例位置
top = 20,#顯示上下調(diào)前20位基因
font.label = c("bold", 11),#顯示基因標簽字號大小及加粗
font.legend = "plain",#圖例的設(shè)置,這里設(shè)置為不加粗
font.main = "bold",#主要主題設(shè)置為加粗(就是那個Group圖例加粗)
ggtheme = ggplot2::theme_minimal())#設(shè)置色板主題
以下 給選出的基因繪制方框
ggmaplot(diff_express,
main = expression("Group 1" %->% "Group 2"),
fdr = 0.05,
fc = 2,
size = 0.4,
palette = c("#B31B21", "#1465AC", "darkgray"),
genenames = as.vector(diff_express$name),
legend = "top",
top = 20,
font.label = c("bold", 11),
label.rectangle = T,#給選出的基因繪制方框
font.legend = "bold",
font.main = "bold",
ggtheme = ggplot2::theme_minimal())
指定特定基因以顯示
ggmaplot(diff_express,
main = expression("Group 1" %->% "Group 2"),
fdr = 0.05,
fc = 2,
size = 0.4,
genenames = as.vector(diff_express$name),
ggtheme = ggplot2::theme_minimal(),
top = 0,
label.rectangle = T,
label.select = c("BUB1", "CD83","TP53")#指定基因集
)