close

前期圖文:

國人佳作 | 通過肺和血清的代謝組學解析羅漢果苷V減輕OVA誘導的肺部炎症機制

如何分析cell與cell之間的信號交流-通路傳導的關係?

買賣論文?科技部通報,多家大學被點名

Cell 一篇文章提出動態增強子的概念

那些年,我們經歷過的SCI投稿狀態

大集錦-{best}-生信知識-SCI論文寫作-大牛觀點--合集

Science新發現 RNA以m6A依賴方式調節染色質狀態和基因轉錄

#如下是一篇基於Kang et al. Nature 2014 大腦bulk-based 表達數據庫,進行大腦發育相關的分析,需要對不同的大腦發育階段的數據進行整合,然後再對Top-ranked genes進行聚類+熱圖展示,具體代碼如下:

#@ 2021-09-16#heatmap#install.packages("pheatmap")library(pheatmap)pearson_new<- read.delim("data_for_brainSpan.txt",header = T)pearson_new2<-pearson_new[,-1] ####去除第一列mat_pearson<-as.matrix(pearson_new2)row.names(mat_pearson)<- pearson_new[,1]###產生matrixl <- length(mat_pearson[1,])number <- seq (2, 15,1)new_mat <- c()for (j in 1:l) { for (i in number){ stage <- paste("Stage",i,sep="_") new_mat <- c(new_mat,mean(mat_pearson[,j][which(row.names(mat_pearson) == stage)])) } }new_mat2<-matrix(new_mat,ncol=25,byrow=T) colnames(new_mat2)<-colnames(mat_pearson)####定義stage rownamestage_name <- c()for (i in number){ stage <- paste("Stage",i,sep="_") stage_name <- c(stage_name,stage) }row.names(new_mat2)<-stage_namepearson_heatmap<-pheatmap(t(new_mat2),cellwidth =30, cellheight =20,fontsize=12,border_color="black",scale="row", fontsize_row=12, color=colorRampPalette(rev(c("red","white","blue")))(102), cluster_rows = T,cluster_cols = F,display_numbers = F)

通過利用R包中的pheatmap,結合for 循環語句就可以很好的處理數據,繪製發表高質量論文的圖啦。。。。

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 鑽石舞台 的頭像
    鑽石舞台

    鑽石舞台

    鑽石舞台 發表在 痞客邦 留言(0) 人氣()