五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

科研代碼大全|R可視化:熱圖中標(biāo)注感興趣的基因

2022-05-23 10:07 作者:爾云間  | 我要投稿


科研有捷徑,輸入代碼,一鍵獲取科研成果!就是這么省事,來具體看下有多方便!

搜索http://985.so/a9kb查看全部代碼(目前共計(jì)50+持續(xù)新增中),也可以點(diǎn)擊右側(cè)【目錄】,可以看到更多有趣的代碼

最近看到一篇文獻(xiàn):Transcriptome Profiling of Adipose Tissue Reveals Depot-Specific Metabolic Alterations Among Patients with Colorectal Cancer,其中有個(gè)熱圖上標(biāo)注了作者比較感興趣基因(細(xì)胞因子和趨化因子),今天來解鎖一下該圖的畫法。

在差異基因過多的情況下,熱圖中無法展示基因的有效信息,基因名過多會(huì)造成重疊,不展示基因名又會(huì)導(dǎo)致熱圖信息不夠豐富,所以像這種只展示特定基因的情況就很受歡迎。接下來準(zhǔn)備作圖工具:R包ComplexHeatmap。

先來按照這個(gè)R包官方文檔里的教程數(shù)據(jù)來畫個(gè)圖試試:

#加載ComplexHeatmap包繪制這種類型的熱圖

library(ComplexHeatmap)

#加載R包

library(ComplexHeatmap)

m = matrix(rnorm(1000), nrow = 100)??## rnorm是其中一種隨機(jī)產(chǎn)生方式,其總體隨機(jī)數(shù)符合正態(tài)分布

head(m)

rownames(m) = 1:100

ha = rowAnnotation(foo = anno_mark(at = c(1:4, 20, 60, 97:100), labels = month.name[1:10]))

pdf("heatmap.pdf",width = 6,height = 7)

Heatmap(m, name = "mat", cluster_rows = FALSE, right_annotation = ha,

????????row_names_side = "left", row_names_gp = gpar(fontsize = 4))

dev.off()

看圖片效果還可以,接下來用自己的數(shù)據(jù)進(jìn)行測(cè)試:需要準(zhǔn)備兩個(gè)文件:

1)?差異基因表達(dá)量矩陣

2)?要進(jìn)行展示的基因列表文件

開始畫圖:

#讀取的示例文件

# diff.expr.txt 是差異基因表達(dá)量矩陣

# gene.txt是帶展示名稱的基因列表

#加載ComplexHeatmap包繪制這種類型的熱圖

library(ComplexHeatmap)

?

#表達(dá)矩陣,考慮到ComplexHeatmap沒有scale參數(shù),因此需事先手動(dòng)做個(gè)行標(biāo)準(zhǔn)化

rt?<- read.delim('diff.expr.txt', row.names = 1, check.names = FALSE)

for (i in 1:nrow(rt)) rt[i, ] <- scale(log(unlist(mat[i, ]) + 1, 2))

rt <- as.matrix(rt)

?

#定義樣本分組,例如示例文件中共 A、B?2個(gè)組

samples <- rep(c('A', 'B'), c(225, 142)) ???

?

#畫圖

pdf("complexheatmap.pdf",width = 8,height = 8)

heat <- Heatmap(rt,

????????col = colorRampPalette(c('SeaGreen4', 'white', 'IndianRed1'))(100), #定義熱圖由低值到高值的漸變顏色

????????heatmap_legend_param = list(grid_height = unit(10,'mm')), ?#圖例高度設(shè)置

????????show_row_names = FALSE, ?#不展示基因名稱

????????#cluster_columns= FALSE, ?#不作列聚類

????????show_column_names=FALSE, ?#不展示列名

????????top_annotation = HeatmapAnnotation(Group = samples,

??????????????????simple_anno_size = unit(2, 'mm'),

??????????????????col = list(Group = c('A' = '#00DAE0', 'B' = '#FF9289')), ?#定義樣本分組的顏色

??????????????????show_annotation_name = FALSE),

????????column_names_gp = gpar(fontsize = 10), row_names_gp = gpar(fontsize = 6))

?

#讀取待展示的基因名稱,并添加到熱圖中

name <- read.delim('gene.txt', header = FALSE, check.names = FALSE)

heat + rowAnnotation(link = anno_mark(at = which(rownames(mat) %in% name$V1),

????????labels = name$V1, labels_gp = gpar(fontsize = 10)))

dev.off()

參考文獻(xiàn)及網(wǎng)址:

[1]Haffa M, Holowatyj AN, Kratz M, Toth R, Benner A, Gigic B, Habermann N, Schrotz-King P, B?hm J, Brenner H, Schneider M, Ulrich A, Herpel E, Schirmacher P, Straub BK, Nattenmüller J, Kauczor HU, Lin T, Ball CR, Ulrich CM, Glimm H, Scherer D. Transcriptome Profiling of Adipose Tissue Reveals Depot-Specific Metabolic Alterations Among Patients with Colorectal Cancer. J Clin Endocrinol Metab. 2019 Nov 1;104(11):5225-5237. doi: 10.1210/jc.2019-00461. PMID: 31225875; PMCID: PMC6763280.

[2]https://jokergoo.github.io/ComplexHeatmap-reference/book/a-single-heatmap.html#plot-the-heatmap

[3]https://blog.csdn.net/u012110870/article/details/102730562

[4]https://www.jianshu.com/p/a1e2713cd906



科研代碼大全|R可視化:熱圖中標(biāo)注感興趣的基因的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
新乡市| 莎车县| 循化| 图木舒克市| 边坝县| 长海县| 澳门| 海盐县| 湘西| 中西区| 柯坪县| 江安县| 上虞市| 郓城县| 铜川市| 卓尼县| 息烽县| 曲靖市| 沅陵县| 延吉市| 尼勒克县| 西林县| 武强县| 长沙市| 阿克陶县| 江源县| 喀喇沁旗| 舞钢市| 江永县| 大同市| 南阳市| 武威市| 永吉县| 西充县| 玛纳斯县| 松阳县| 珠海市| 长武县| 漾濞| 阿克陶县| 辽阳县|