論文是
Environmental factors shaping the gut microbiome in a Dutch population
資料和代碼的github首頁連結
https://github.com/GRONINGEN-MICROBIOME-CENTRE/DMP
這個也是資料代碼的下載下傳連結,可以看目錄結構
https://zenodo.org/record/5910709#.YmAcp4VBzic
今天的推文重複一下論文中的 Extended Data Fig. 10

image.png
論文中做資料計算和做這個圖定義了一個很長很長的函數,這裡隻介紹作圖代碼,資料計算的過程我還看不懂
這裡主要有兩個資料,一個是熱圖顔色的資料,另外一個是加減号的文本資料,部分示例資料集如下
image.png
image.png
讀取資料
dat01<-read.csv("ExtendedFig10_01.csv",
header=TRUE,
row.names = 1)
dat02<-read.csv("ExtendedFig10_02.csv",
header=TRUE,
row.names = 1)
他這裡還設定了一些額外參數,我儲存到abc.Rdata這個資料集裡了,加載這個資料集
load("abc.Rdata")
作圖代碼
pheatmap(dat01,
annotation_row = NULL,
annotation_names_row = T,
labels_row = rownames(dat01),
legend = T,
show_rownames = T,
cluster_rows = clusterFeatures,
cluster_cols = clusterPhenos,
angle_col = 90,
fontsize_number = textSize,
border_color = "#EEEEEE",
na_col = "white",
fontsize = legendTextSize,
treeheight_row = 0,
treeheight_col = 0,
legend_labels = "sig*log(p-value)",
color = myColor,
fontsize_col = colTextSize,
fontsize_row = rowTextSize,
display_numbers = dat02,
breaks = myBreaks,
cellwidth = cellWidth,
cellheight = cellHeight,
filename = NA)
image.png
這裡參數有點多,就不在推文裡介紹了,争取錄制視訊介紹吧
示例資料和代碼可以在公衆号背景回複 20220531 擷取
歡迎大家關注我的公衆号
小明的資料分析筆記本