1. 是什么热图
热图是对实验数据分布情况进行分析的直观可视化方法,可以用来进行实验数据的质量控制和差异数据的具像化展示。
其基本原则是用颜色代表数字,让数据呈现更直观、对比更明显。还可以对数据和样本进行聚类,观测样品质量。
热图有多种形式,但基本的元素是一致的。
例如上图中的2张热图,每个格子表示每个基因,颜色表示这个基因的上/下调,红色为上调,蓝色/绿色为下调。颜色越深代表这个基因的表达量越高。每行表示每个基因在不同样本中的表达量情况,每列表示每个样品中所有基因的表达量情况。
图中上面两条彩色的横条,是用颜色标识出实验的不同分组。比如图A中,第一行的黄色表示肿瘤组织,蓝色表示正常组织;图B中第一行的蓝色表示正常组织,粉色表示肿瘤组织。
图A中上方树形图表示对来自不同实验分组的不同样品的聚类分析结果,图A和B中左侧树形图表示对来自不同样本的不同基因的聚类分析结果。但是分组和聚类树形图在热图中不一定会出现,要根据研究需要决定是否加上。
2. 热图的作用
(1) 呈现样本间或基因之间的聚类关系:
① 对样本进行聚类:
上图中的上方树形图就是对样本进行聚类,可以对数据质量进行控制。
如果样本来自于同一个组,组内个样本间的特征应该是相似的,那么在进行聚类的时候就很容易被聚在一起。通过样本的聚类可以观察到所收集的不同组别样本是否被聚类到一起了。
如上图中的2个组之间存在着很大的差异,左侧组基因大多呈现下调,而右侧组相反。而且组内样本间的表达模式相似,说明组内样本间差异较小。如果发现某一个/几个应该属于这一组的样本被聚类到其他的组了,或者某个样本的表达模式与本组内其他样本差异显著,那就说明这个样本本身的变异度很高,或者说在之前的样本采集或者测序过程中出了什么问题,这就需要考虑把这个异常样本剔除掉再进行分析,这也就实现了对数据的质量控制。
② 基因之间的聚类:
上图中左侧树形图就是对基因的聚类,聚类可以观察到基因之间的关系,因为基因的上下游调控会导致连锁反应,一个基因的表达增加或减少可能会带动一系列基因的表达变化。那么从图中就可以看到这个连锁的相关性,也是就看到表达模式相似的一群基因被聚集在了一起。
当关注样本/基因在检测到的表达量水平如何分类,相互之间的关系如何,那么可以选择聚类。可以选择:只在样本水平聚类、只在基因水平聚类或两者都进行。当然也可以选择不聚类。
(2) 直观展示多样本多个基因的差异表达变化:
这个很容易理解,就是通过使用颜色(比如红色/绿色的深浅)来展示多个样本多个基因的表达量高低。但是有一个问题,那就是生信分析会得到成千上万的基因或蛋白,这样会导致热图的行数非常多,即使拿着放大镜也没办法在图片中分辨单个基因的情况。那么就可以从数据中找出一些重点关注的基因绘制热图,这样能够清晰的向读者展示自己所研究的一些关键基因的表达情况,所以有些文章中的热图是这样子的(如上图)。
3. 一些热图
4. 热图的绘制
热图_样本分类
输入数据:数值型矩阵 / 数据框,样本分组
id GSM3325819 GSM3325820 GSM3325823 GSM3325825 GSM3325827 GSM3325829 GSM3325818 GSM3325821 GSM3325822 GSM3325824 GSM3325826 GSM3325828 SLC6A4 10.2790154 12.0014197364167 11.5830405141667 9.67216154858333 11.0841729208333 9.21662444141667 4.44045608358333 4.81108840941667 6.99765143083333 6.00964615416667 6.03208499416667 5.62817784166667 FLJ34503 7.35826503583333 8.73438759166667 7.56571767191667 7.61031364916667 9.59731241083333 7.47501336941667 1.93977552916667 5.83290972225 0.566909014166667 2.635413775 5.24356857333333 2.72272768333333 TMEM100 11.5028938725 12.8866491566667 12.8070366008333 11.3660599583333 12.38474576 11.8281083225 9.30754897441667 4.89115678666667 8.12515011775 8.07533610416667 8.02991233166667 7.0292106625 SGCG 7.45381075583333 8.76144678333333 6.6384574875 8.75060294083333 8.60547094166667 5.15092098166667 3.26663581 2.81855656666667 2.74013808166667 2.41791927358333 5.68402112808333 1.605853125 FCN3 11.2426962166667 11.1393133725 11.59793688225 9.83870065583333 11.6568733358333 10.37383195 6.88183068 7.77466290833333 8.38742424725 7.45381075583333 6.95686153833333 2.14102007916667 FABP4 9.44556533108333 10.4539284035 9.95310207333333 11.7297702216667 9.82816244858333 9.62540911083333 4.76939967666667 4.56338139 7.71683384583333 7.17356355166667 5.70634670833333 4.92492246666667 MME 10.0569225066667 10.9009659541667 9.34142982666667 10.9227288708333 10.204786935 9.95959348608333 6.03781415416667 5.68615953916667 5.4097290125 6.8319003025 5.02448836083333 7.00493966166667 LINC00968 7.22703337083333 8.117013878 7.27664695166667 8.57126690166667 9.08865539166667 7.44883593 0.397068076666667 1.58106110833333 5.3824569125 5.25733538958333 5.56573593333333 5.04790310833333 LOC101928161 7.31213299308333 7.840057835 7.72971270366667 8.73452805166667 8.66680205833333 7.99010304691667 2.6592403025 5.83516271416667 2.013063475 4.32695368333333 6.21921042058333 3.11260469166667 SLC19A3 9.10254879333333 9.33269241358333 8.72858142916667 9.6189554125 8.49773283916667 9.48712972083333 2.8540796375 5.08536016916667 8.3278824205 6.96594506858333 3.23004175833333 4.48509327083333 IGSF10 10.2267714375 10.2659630375 9.093945 10.71400674725 10.4155032458333 10.0268044194167 4.40089568583333 7.175175525 7.55383722083333 5.851623075 7.24715919166667 5.64745950166667 CXorf31 6.6871006875 7.86954131666667 7.66816592333333 7.80761504333333 6.98192265833333 6.58260338333333 3.52379041875 3.66660552083333 3.867264625 3.49023143333333 3.4636534125 2.78007404416667 LINC00551 8.49757209 10.769069475 9.74225618358333 8.449980345 9.72753374416667 9.52770761083333 1.83274905833333 5.54698795 7.60102346666667 6.46337097666667 7.31818832375 6.77712021916667 EDNRB 10.3616288916667 11.8022907496667 11.2131908708333 11.2464474055833 12.032056875 10.9628426416667 6.80964032358333 6.73861853666667 8.81819696833333 7.88377294666667 7.91552993916667 8.33392521416667 CADM3-AS1 8.1317605875 7.29241178333333 6.17973703333333 6.80332268333333 6.79018277 7.40999846083333 2.21355756416667 3.23171308333333 3.92213062458333 2.5772616025 6.69122156458333 2.88120256666667 SERTM1 6.54960289416667 8.03364936458333 6.8495519575 7.29241178333333 7.76678184775 6.54319473541667 1.91103223333333 6.73139104833333 2.58422171941667 3.20996331666667 6.05993819166667 1.7383533275 BEX1 7.43802866975 8.52811812225 6.91474796666667 6.65291787583333 7.86389896333333 7.67809592333333 3.39917174583333 3.58101139166667 4.20171439583333 4.76548111666667 5.08402127416667 3.42028435 PKHD1L1 8.52096433833333 7.83816161225 7.33748443 7.81602969191667 7.90051081225 6.63662880416667 5.1948316125 2.96045204166667 6.12185927 2.80861806666667 4.59401126108333 4.06472309625 LOC400568 7.61437324416667 8.45412479275 8.11386925916667 8.59093429166667 8.39918634583333 7.58813657225 6.01089106666667 3.80662214275 4.72523417333333 2.97923660833333 6.99215599166667 4.00240615166667 CLDN18 12.3215042433333 12.1445753360833 12.1369395416667 11.4712283708333 11.8281083225 11.4624539 7.0735602125 10.2144020225 8.188591005 8.619060665 8.83365937108333 8.22454263708333 GDF15 6.79186842 7.22094631 4.57300452666667 5.76369928891667 6.62393801083333 8.44561084833333 7.91692880691667 10.6529581233333 9.9212265475 9.35897586833333 9.42769180416667 8.96260101666667 C10orf91 3.4851225475 4.06037220208333 3.36892411666667 4.58521273083333 3.60778099 3.53442753166667 7.75562177583333 4.98959535625 7.10208118441667 6.2828701875 5.79827599166667 7.57737177666667 HCN3 5.66260523333333 4.03350374166667 4.9414449 2.79124468333333 6.05252840416667 3.85178560416667 7.87875477916667 4.93551260416667 7.596526225 8.57525503125 7.63159067916667 7.77912835558333 FAM111B 5.51343009558333 5.4766644975 4.77081165941667 2.4337983625 4.4389164375 6.87582391725 8.05232948166667 6.73368792916667 7.63723593 8.94947111775 7.14472385691667 9.0649206195 GJB2 7.25774277108333 5.25261369166667 4.21943182333333 7.11045739166667 5.20973059958333 3.09527707916667 9.78251989833333 8.00046514833333 7.75401379725 8.41522846416667 8.13019973608333 8.44100866641667 RPRM 5.83263597916667 3.9720808775 4.38789986916667 4.97718740833333 4.865009305 1.91103223333333 7.49964860416667 7.63592795166667 9.26472971941667 6.60286646041667 8.7060042625 4.802508375 PVRL4 4.95685980666667 6.60286646041667 7.550405255 4.59611394166667 6.09292623916667 9.09771305 9.40888825 9.7363276125 9.71874314141667 10.6951028958333 8.69947373833333 9.39528997108333 CP 8.8640721475 7.65936865208333 6.91052113083333 8.31329851375 7.22931042083333 9.91338081208333 10.2011076108333 12.4568289791667 10.2321475125 12.4070694791667 9.65485622308333 12.7341787858333 MUC3B 6.32084056666667 6.2099780275 6.9854850275 5.05859296416667 7.382848396 8.197960985 7.96729396 9.17337479116667 9.556299799 11.5929258083333 10.36043525975 10.77081142775 LOC101929486 1.250725775 3.77978720558333 1.3504145 4.96508849583333 2.425318645 1.07517040583333 4.6498840375 6.58145513925 6.60153932916667 4.84778644583333 5.87533878083333 5.74143719166667 FLJ13744 4.44761275833333 3.36986136941667 2.88003524166667 2.8619764625 4.33983239191667 3.47594405 7.39237029975 4.990000325 9.160727475 6.6905791525 6.28643260208333 6.416338645 TOX3 7.12929376583333 7.29223398 5.4535426825 6.3032847225 6.6859171625 7.45982792358333 9.78888141 10.6951028958333 7.88349037 10.980610875 10.2424286480833 10.6290471166667 KRT6A 1.04926865166667 1.2461490875 1.84992340416667 0.9432334975 3.77195915 1.50010925833333 6.7477884525 3.24045832083333 8.19696466891667 3.60288896916667 4.19016361833333 5.57636927775 MSMB 5.31047677083333 2.3188149625 4.27056247358333 3.90133065666667 2.96663602916667 5.578170685 7.5095568625 7.15040929116667 9.2452192475 9.09484889166667 5.52919265416667 7.27937762083333 LINC01021 4.38308837083333 2.56059448333333 0.292733796666667 1.45238518333333 0.0278696504166667 4.22853630833333 5.74143719166667 5.2919436875 6.28213648083333 5.25504549583333 5.2081466025 7.40974165833333 TMPRSS4 8.15328845 5.31178408 2.48408831666667 6.3645224525 4.83222413083333 8.98885644333333 10.4612623294167 10.0589189083333 10.4368363166667 10.4024882383333 7.95569365416667 10.0189098083333 MMP1 6.76379224166667 5.98912077458333 4.47551179833333 1.50010925833333 5.36866488333333 5.945240635 10.3075431458333 11.25352095 7.21967195691667 9.2837575115 7.26039153691667 7.97909578333333 MMP7 6.96566420166667 3.09701585416667 6.805228375 3.85917199583333 5.37901854166667 3.663908935 8.86433730416667 10.04533180025 7.98134272691667 8.62742686 9.2832412975 9.02702731141667 C12orf74 3.14668888166667 2.27439840416667 2.51270725833333 2.27180393333333 0.461881556666667 2.36323582416667 5.4703514375 7.84964717058333 5.41009004583333 8.25263112083333 7.32792188166667 6.6251894275 SPINK1 7.62697714941667 5.7421195875 6.02074538916667 5.76148253916667 7.40816433225 6.50510097225 11.21040858 13.1444367916667 10.4342765233333 13.7020031625 9.156340734 9.90802716
id Type GSM3325819 N GSM3325820 N GSM3325823 N GSM3325825 N GSM3325827 N GSM3325829 N GSM3325818 T GSM3325821 T GSM3325822 T GSM3325824 T GSM3325826 T GSM3325828 T
代码:
library(pheatmap) setwd("") inputFile <- "input.txt" # 基因表达文件,行名为基因,列名为样本 groupFile <- "group.txt" # 分组文件 outFile <- "heatmap.pdf" rt <- read.table(inputFile, header = T, row.names = 1,check.names = F) #读取文件 ann <- read.table(groupFile, header = T, row.names = 1,check.names = F) #读取样本属性文件 # 绘制 p <- pheatmap(mat = rt, # 输入数据 annotation_col = ann, # 样本注释(分组) cluster_cols = TRUE, # 对列进行聚类 color = colorRampPalette(c("blue", "white", "red"))(50), # 设置热图渐变颜色 show_colnames = TRUE, # 展示列名(样本名) scale = "row", # 字符指示值在行方向上居中和缩放 #border_color = "NA", # 热图上单元格边框的颜色,如果不应绘制边框,请使用 NA。 fontsize = 8, # 绘图的基本字体大小 fontsize_row = 6, # 行名的字体大小(默认值:fontsize) fontsize_col = 6) # 列名的字体大小(默认值:fontsize) pdf(file = outFile, width = 6, height = 5.5) print(p) dev.off()
热图_临床性状分类
输入数据:
id TCGA-VQ-A8E0 TCGA-VQ-A927 TCGA-BR-7704 TCGA-RD-A7BW TCGA-CD-A489 TCGA-BR-7722 TCGA-CD-5813 TCGA-CG-4466 TCGA-BR-7715 TCGA-BR-6801 TCGA-CG-5716 TCGA-VQ-A91A TCGA-CD-5801 TCGA-BR-4267 TCGA-BR-8369 TCGA-CG-5732 TCGA-BR-7196 TCGA-R5-A7ZE TCGA-CG-4460 TCGA-BR-8384 TCGA-BR-6563 TCGA-D7-6525 TCGA-CD-8525 TCGA-IN-A6RS TCGA-BR-6705 TCGA-D7-A6EX TCGA-VQ-A8E3 TCGA-RD-A7C1 TCGA-CG-5720 TCGA-BR-8686 TCGA-BR-8590 TCGA-VQ-AA6G TCGA-BR-8484 TCGA-BR-8487 TCGA-R5-A7ZI TCGA-VQ-A8DT TCGA-D7-A6EZ TCGA-BR-8372 TCGA-D7-6528 TCGA-VQ-A91V TCGA-VQ-A8E2 TCGA-BR-7707 TCGA-BR-8367 TCGA-HU-A4G9 TCGA-BR-8683 TCGA-CG-5734 TCGA-BR-A4CR TCGA-KB-A93H TCGA-D7-A6F2 TCGA-HU-A4G8 TCGA-VQ-A922 TCGA-BR-6452 TCGA-BR-8361 TCGA-VQ-A8PX TCGA-BR-8589 TCGA-D7-8573 TCGA-CG-5718 TCGA-CD-8526 TCGA-VQ-A91K TCGA-BR-6566 TCGA-HU-A4GJ TCGA-HU-A4H4 TCGA-HU-A4GD TCGA-D7-A4YX TCGA-HU-A4GX TCGA-BR-8060 TCGA-VQ-A924 TCGA-VQ-A8P2 YTHDC1 4.06435453045454 3.87111216090909 4.24334676181818 4.03566221590909 3.946877035 5.82877875909091 3.16569023090909 4.70597841818182 3.03646596409091 2.92429133454545 3.12125921136364 3.91555516636364 3.33470000545455 3.72766813136364 4.33199888681818 3.08742681954545 4.83860692727273 2.70829464590909 5.83003343181818 4.450729545 3.46918737818182 3.57516306409091 3.93865759363636 3.20906636636364 3.11045749818182 4.97039821363636 6.11907407272727 2.47724680363636 3.57992570954545 14.93966511 9.695689042 8.388380469 10.24386018 10.91300896 4.927073883 8.091974375 10.11640533 7.188566889 5.877338274 11.50899103 10.26789456 7.298127237 9.423931602 8.041537406 9.962660087 5.182297737 12.39472786 12.16566928 10.27191961 12.497268 8.401185643 8.587039336 7.756071186 11.41675348 12.5143307 8.947376421 6.768702969 11.5365993 9.82352852 5.841140541 14.48291015 11.03121397 11.22695799 11.59819836 11.21366449 10.78952683 9.773523194 11.05592863 YTHDF1 10.9835042954545 5.88152049545455 12.7795350363636 7.69597488181818 8.79601412727273 8.70354602727273 11.0688067681818 16.2174106772727 17.8715798772727 10.5608272409091 8.40160567727273 8.43612734090909 10.6333242409091 8.10447993181818 13.2774309181818 16.2052664727273 12.0617544818182 12.1841028909091 7.56732559545454 8.55914993636364 7.65313894090909 16.0492420954545 12.6415491954545 13.7820405863636 9.79671765454545 10.4109251681818 10.7117320545455 14.4128929818182 8.73180802727273 30.35708374 26.75257505 18.93551729 37.95689211 15.32627278 24.85566425 15.23603369 32.25693572 19.39554303 38.85390942 25.19778981 51.94761781 19.65250878 19.42333399 18.0111836 46.86413009 21.66607071 31.93992971 27.88721248 25.45785732 25.90294823 41.75736142 25.65642439 21.47271041 24.32492797 48.10082755 46.80753815 25.36150085 38.74998317 23.86823495 13.08103593 18.38679318 28.27584561 29.31585837 42.20356834 29.21061936 34.21826568 22.75147873 23.48711548 FTO 2.24142285409091 1.35546637545455 1.03768001227273 3.15449145818182 2.47124288909091 1.32669774363636 1.5899872 1.46837967409091 1.44218926772727 1.21511950227273 1.24900552727273 1.84948416045455 1.37182880181818 1.28006688227273 1.98403520272727 1.16810626272727 1.94835442136364 1.38014529727273 2.47511698454545 2.97333884818182 1.42796588545455 1.75766490681818 1.10737339909091 1.14089447545455 2.26287211727273 1.23905585227273 2.15064870636364 1.25359428454545 1.11015281681818 5.092057098 4.415482899 2.778510503 3.732083269 1.545202556 1.286609989 2.102746949 3.740934303 3.130241809 2.083924951 3.914779242 3.276867817 2.583022623 5.128708042 2.392070241 4.106285961 1.83036623 5.665092593 1.952261861 2.590740061 3.621926863 4.105531726 3.113210267 3.039370823 2.350884542 3.104662704 4.804420335 1.096253535 3.146103986 3.175273412 1.771048925 4.198951912 2.181320704 1.720651746 2.723868672 6.813822131 5.888400117 3.575259691 6.617514769 ALKBH5 11.8637082681818 9.88070838636364 7.16719443636364 10.1837715454545 8.5346616 9.30487122272727 7.92860504090909 8.3066504 7.87431227727273 9.58065916818182 10.1529637590909 12.5330973727273 9.43701447272727 4.70170369545454 10.7924914954545 7.88360484545455 11.4339265727273 7.70387459545455 8.11742745 14.8793481909091 8.43415064090909 6.83611768181818 5.55065404090909 5.16734088181818 11.27804345 10.1232778772727 11.9890914818182 6.75864493181818 7.94559953181818 30.7773543 29.11674021 12.50836486 26.3916696 17.97255953 18.86803144 19.66738079 29.20909927 20.63697277 18.38126581 22.24277303 25.41284611 21.84817186 32.10997204 23.03471779 24.99474405 17.71605138 52.78523119 16.42416807 15.85167635 29.51284169 20.26391465 35.32505807 25.17888273 22.170061 28.52429715 43.8372093 15.99609146 29.91470046 25.17764672 20.95944681 29.14287844 22.74855376 13.94847476 29.55967972 20.41271419 26.40719507 26.10203529 32.8481433 METTL3 2.12342316863636 1.506822415 4.151518135 1.35008286136364 1.72509146909091 1.89773681772727 1.008046725 2.81685510545455 1.34356032 1.59402589545455 1.61871665909091 1.90071001045455 0.866997726363636 1.25770576045455 1.80223820818182 1.86075737409091 1.58934878136364 1.52895102227273 2.23367641727273 1.69513006772727 1.07920017636364 1.89424019590909 1.89067082272727 2.15087055590909 1.82512170636364 2.24705423227273 1.55850052818182 1.78100550818182 1.58704642681818 4.298266915 4.873450192 2.05371884 3.32591811 3.204080265 3.362320916 3.274284325 4.741233127 6.729997082 6.683389462 4.442801418 5.156387747 4.840420511 4.007377095 3.530442273 3.626270176 1.686241063 7.22675626 5.558165949 3.830825884 7.815248296 8.942214847 4.533959745 6.052881231 3.182360963 4.725124783 4.744685899 3.897133439 4.781126119 3.248716473 1.919522908 5.953410914 3.782408846 5.077450365 5.741316004 6.678389723 6.871995712 4.059823314 5.745312065 HNRNPC 18.8966599409091 11.0113185590909 22.1994453772727 12.0128155636364 15.0454875454545 13.5403540954545 15.1414276636364 18.9641144863636 15.3210098727273 11.0224632227273 17.8050876045455 13.1154594909091 17.4834015909091 22.2328647409091 15.5674390090909 22.9818487045455 18.5310001409091 16.9670946181818 23.2440598272727 11.1168440636364 14.5407287045455 17.8961734545455 23.07190535 16.4461284863636 15.2676504454545 20.8355804318182 19.9077313954545 15.1049493636364 23.0786506318182 35.64066475 34.24021976 24.75718929 35.10022424 45.0584757 32.80227323 38.95334426 51.57456294 78.60826634 41.80255325 34.59213563 41.42739981 62.18878798 35.04198579 37.07784389 26.30072264 30.49306769 58.89417471 40.4345726 23.67783576 51.83291891 40.7336908 46.51634377 41.15376378 29.71666762 56.91572347 46.721717 39.96494254 51.65639307 34.27037805 41.87094267 53.18145085 43.19244973 36.63108349 50.82141199 45.68333229 41.63008736 52.68223325 49.69518918 YTHDC2 2.48003677818182 2.38224790272727 1.12414010090909 1.457125035 1.26649843727273 1.48540143136364 0.601102532272727 1.27142100772727 0.83230008 0.588965496818182 1.38427900409091 1.41062968545455 0.661438465 0.8224391 1.37771818136364 1.16546642772727 1.51021920545455 1.08107916363636 2.42515862590909 1.78076726545455 0.912684623636364 0.819970698181818 0.641989586818182 0.884589640454545 0.844504667727273 1.44398701454545 2.44240051363636 1.98289205363636 0.881440544090909 4.48392162 3.422866387 3.695493726 3.733292758 3.436506731 2.689556579 3.180847005 3.943744224 4.153929908 3.11806045 2.854070504 2.390261615 2.474026144 6.287275839 5.822968806 3.493692702 1.495447015 2.608836685 1.881466926 2.158604756 6.074352227 3.250162242 4.571994392 4.028364425 5.122406282 3.894925328 3.112500447 1.011490089 2.458326913 5.291654737 1.797107082 6.107979462 3.7756026 3.079526689 3.881179764 5.090847907 6.569819968 5.852428456 4.692916387 ZC3H13 6.43431679545454 7.31770860909091 7.28329918181818 8.10945477272727 9.51479848181818 8.4992727 3.17967974772727 4.06121085272727 2.98827341136364 7.1435621 3.22206352636364 9.09781649545454 4.07988136636364 4.17426959818182 7.73439463181818 3.35526652636364 4.36743784045454 4.45627233863636 3.52872989863636 7.54103881363636 4.90590945909091 2.213757055 10.8024702681818 5.48923973181818 6.41641262272727 9.62479323636364 9.80694835909091 4.15661832863636 3.10121285272727 15.58489071 11.12910603 11.07410304 12.74161643 9.596796925 7.781065526 17.59762374 12.17995428 4.577559253 7.083188996 15.84133882 14.20491523 9.892061378 13.07039642 5.954483007 11.46976736 7.581169836 58.33827671 43.30911419 21.467638 17.42120879 26.33569459 5.132810989 12.47872317 15.63928566 10.50404816 18.11263967 8.481933451 15.10353244 16.26126263 10.79504071 18.21337457 15.82426108 26.87758011 11.2137306 12.66189725 16.49435991 18.23534574 15.2433404 RBM15 1.79525376954545 1.59450639454545 0.960820737272727 0.989827803636364 0.958621575 1.03920964181818 1.086472215 1.78128531409091 1.56040047045455 0.901409196363636 1.4246812 1.57357938272727 0.933748506363636 1.54280802863636 2.08854919863636 1.59695218272727 1.79554552 1.22314226272727 1.82125537090909 2.16269869636364 1.15481846272727 1.45621654409091 1.62598219681818 1.97120234454545 1.68506639863636 1.10898367545455 2.321365375 1.76820818863636 1.40456769636364 6.74634806 5.008552301 5.655262844 6.535421974 3.985799147 3.003479896 2.922133655 5.135814223 6.149199147 4.644917781 5.696947314 5.627730102 3.17219378 6.41176099 6.414942358 6.855536089 2.962791462 7.967581074 3.885080427 4.185881638 9.695415128 7.145972112 5.631517248 7.38344201 7.173947724 6.531284213 6.460601291 3.164173207 5.332458311 4.474371466 2.288036597 8.437172534 5.268452496 3.626074343 7.714117645 5.722543698 7.571507588 4.953254087 4.906764305 KIAA1429 2.037200155 2.91496185045454 1.86759104818182 1.96170923136364 2.18534829954545 1.60832682363636 2.64692838727273 3.15120517181818 3.82842397727273 2.28131387954545 1.90934391954545 3.89174105909091 1.33789235636364 2.51912466681818 4.39303074045455 1.92590029363636 2.31044211545455 2.30595519136364 4.95286361818182 2.68093441 1.56033890909091 3.31160727272727 2.64107457 2.37870128090909 1.94029098636364 2.41468684227273 3.18922522681818 3.12959151863636 1.41739758136364 4.769517685 9.755343421 5.616950034 5.841211149 3.089413475 4.055851755 6.358676021 5.146621382 8.671978439 8.478957487 9.8624621 6.341825245 4.889376227 7.594572266 10.18152208 7.204268995 2.629473661 5.46817933 4.407263452 9.029968028 6.558121509 9.163760728 8.243455988 4.796890081 10.16693458 4.855124386 5.838672597 5.517767632 10.49313087 5.28073379 2.542800545 6.020980659 5.396604335 9.458944381 7.63502224 3.398545371 4.707456852 5.93486817 6.979243027 WTAP 4.93379968181818 4.11284914045455 7.12113284090909 5.07973857272727 4.89350264090909 2.60830330727273 4.112242435 7.32901452727273 5.38678813181818 3.01857350545455 3.86522513363636 5.18296494090909 4.55203648181818 5.44662808181818 6.28071150454545 4.30292095090909 6.15305626363636 3.93522790681818 5.90416775 4.25637771954545 4.64582371363636 3.14694834363636 4.76799943636364 8.26186002272727 3.49639077045455 4.80980246818182 5.96727724090909 5.30853831363636 5.55402438636364 14.66046266 8.568607781 9.842592186 14.37509516 10.36228953 10.22066219 9.160962572 16.13146163 20.16773988 14.68795187 11.53483017 13.24605454 9.8150377 9.066860999 8.394427722 12.84981158 7.520965209 13.75173511 9.594987522 6.477185833 13.12349242 11.83756272 11.47255281 12.40908507 10.55810094 15.54922561 8.471164747 9.329763349 15.38523377 13.2810991 9.107319478 14.43778611 10.52647177 14.57529139 11.20363058 11.84338966 14.46070125 12.9190412 11.48503458 METTL14 0.963515348181818 1.10497685227273 0.665595704545454 1.34539720954545 1.36233093909091 1.13024343136364 0.61617425 1.47240394227273 1.63597013409091 1.01737086090909 0.751829471363636 0.79981591 0.938313406363636 1.27699397090909 2.09827622318182 0.904162128636364 1.22096751681818 0.911746058636363 1.96128348318182 1.47472569136364 1.18861096045455 1.276844665 0.610413122272727 0.910282039545455 0.774856838181818 1.44429395409091 0.856288798636364 0.728616452272727 1.20193215318182 3.363388297 2.998350275 2.047985875 2.405090254 2.509342545 2.141614968 1.974391882 3.306187759 3.49548276 1.280167544 1.890462154 2.702271008 2.603688427 3.755777051 3.145840458 3.075813158 1.206973772 2.756080932 1.65183088 2.774776096 3.897389617 2.984106104 3.823221682 2.00564415 1.922774416 3.229130451 2.612636983 1.319525318 3.143449691 3.238729306 1.454098901 3.310479992 3.040500559 2.460349027 3.607944946 4.228503009 4.187157786 6.766463283 6.865103798 YTHDF2 6.84778351363636 7.70784595909091 8.68475716818182 4.78471917727273 6.77326702727273 9.82850545454545 6.36341943636364 10.5491475954545 10.6686461181818 7.88306338636364 7.98470563636364 7.87279869545454 7.26838211363636 6.37867648636364 9.77470780454545 8.24297951363636 9.12005882272727 8.68613537272727 9.31980055909091 7.56224375 7.44763673636364 8.64648350909091 10.8542494045455 8.64930812272727 7.19955365454545 11.02289215 8.75741152272727 5.58695965909091 10.2692389136364 22.71064304 20.94795805 18.30349884 27.22999366 23.40952847 14.6862111 18.04977544 28.92653878 28.90856898 21.1894887 19.62349124 22.31868563 22.60073685 22.97944947 24.65996703 20.69128398 10.84050341 29.03055542 21.87056907 26.42518374 25.03618335 21.18591265 25.45563714 22.19865336 20.88729628 27.54384623 24.30286539 26.35331223 31.27772024 21.48254498 15.88851912 20.51922233 15.65325276 19.92445099 27.62181678 20.60313617 28.13428018 24.10524952 25.65402547
id fustat age gender grade stage Risk TCGA-VQ-A8E0 Dead >65 MALE G3 Stage III high TCGA-VQ-A927 Dead >65 MALE G1 Stage III high TCGA-BR-7704 Alive >65 FEMALE G3 Stage II high TCGA-RD-A7BW Dead >65 FEMALE G3 Stage I high TCGA-CD-A489 Dead <=65 MALE G3 Stage II high TCGA-BR-7722 Dead <=65 MALE G3 Stage II high TCGA-CD-5813 Dead <=65 MALE G3 Stage II high TCGA-CG-4466 Alive >65 FEMALE G2 Stage I high TCGA-BR-7715 Alive <=65 MALE G2 Stage II high TCGA-BR-6801 Alive >65 MALE G2 Stage II high TCGA-CG-5716 Alive >65 MALE G2 Stage IV high TCGA-VQ-A91A Alive >65 MALE G1 Stage III high TCGA-CD-5801 Dead >65 MALE G3 Stage III high TCGA-BR-4267 Dead <=65 MALE G2 Stage I high TCGA-BR-8369 Alive >65 FEMALE G3 Stage III high TCGA-CG-5732 Dead >65 MALE G2 Stage IV high TCGA-BR-7196 Alive <=65 MALE G3 Stage IV high TCGA-R5-A7ZE Dead >65 FEMALE G2 Stage III high TCGA-CG-4460 Dead >65 FEMALE G2 Stage IV high TCGA-BR-8384 Alive >65 MALE G3 Stage III high TCGA-BR-6563 Alive <=65 MALE G3 Stage II high TCGA-D7-6525 Dead <=65 MALE G3 Stage III high TCGA-CD-8525 Alive >65 FEMALE G3 Stage III high TCGA-IN-A6RS Alive >65 MALE G2 Stage I high TCGA-BR-6705 Alive >65 FEMALE G3 Stage III high TCGA-D7-A6EX Alive >65 FEMALE G3 Stage III high TCGA-VQ-A8E3 Dead >65 MALE G3 Stage II high TCGA-RD-A7C1 Dead >65 MALE G3 Stage I high TCGA-CG-5720 Dead >65 MALE G3 Stage I high TCGA-BR-8686 Alive >65 MALE G3 Stage III low TCGA-BR-8590 Dead <=65 MALE G3 Stage III low TCGA-VQ-AA6G Dead >65 MALE G2 Stage II low TCGA-BR-8484 Dead <=65 MALE G2 Stage III low TCGA-BR-8487 Alive <=65 FEMALE G3 Stage II low TCGA-R5-A7ZI Alive <=65 FEMALE G3 Stage IV low TCGA-VQ-A8DT Alive <=65 MALE G3 Stage III low TCGA-D7-A6EZ Alive >65 MALE G3 Stage III low TCGA-BR-8372 Alive <=65 MALE G3 Stage III low TCGA-D7-6528 Alive >65 FEMALE G2 Stage I low TCGA-VQ-A91V Alive <=65 MALE G2 Stage III low TCGA-VQ-A8E2 Alive <=65 MALE G2 Stage III low TCGA-BR-7707 Alive >65 FEMALE G3 Stage I low TCGA-BR-8367 Alive <=65 MALE G3 Stage III low TCGA-HU-A4G9 Alive >65 FEMALE G2 Stage I low TCGA-BR-8683 Dead >65 MALE G3 Stage III low TCGA-CG-5734 Dead >65 MALE G3 Stage III low TCGA-BR-A4CR Alive >65 FEMALE G3 Stage III low TCGA-KB-A93H Alive >65 FEMALE G1 Stage II low TCGA-D7-A6F2 Alive <=65 MALE G3 Stage I low TCGA-HU-A4G8 Alive >65 FEMALE G3 Stage II low TCGA-VQ-A922 Dead >65 MALE G2 Stage IV low TCGA-BR-6452 Alive >65 FEMALE G3 Stage II low TCGA-BR-8361 Alive >65 FEMALE G3 Stage III low TCGA-VQ-A8PX Alive <=65 MALE G2 Stage I low TCGA-BR-8589 Alive <=65 MALE G3 Stage III low TCGA-D7-8573 Alive <=65 MALE G3 Stage II low TCGA-CG-5718 Dead >65 FEMALE G2 Stage II low TCGA-CD-8526 Alive >65 FEMALE G3 Stage III low TCGA-VQ-A91K Alive >65 MALE G2 Stage III low TCGA-BR-6566 Alive <=65 FEMALE G3 Stage II low TCGA-HU-A4GJ Alive <=65 FEMALE G3 Stage III low TCGA-HU-A4H4 Alive <=65 FEMALE G3 Stage II low TCGA-HU-A4GD Alive <=65 MALE G3 Stage II low TCGA-D7-A4YX Alive <=65 MALE G3 Stage II low TCGA-HU-A4GX Alive >65 FEMALE G3 Stage III low TCGA-BR-8060 Dead >65 FEMALE G3 Stage II low TCGA-VQ-A924 Dead >65 MALE G2 Stage II low TCGA-VQ-A8P2 Alive >65 MALE G2 Stage III low
代码:
library(pheatmap) setwd("") # 设置工作目录 # 输入的表达数据和临床数据中的样本不必完全一致,后续会取交集 expFile <- "input.txt" # 表达数据,行名为基因,列名为样本 cliFile <- "clinical.txt" # 临床数据,行名为样本,列名为临床性状。临床性状会在热图中依次从下往上展示 outFile <- "heatmap.pdf" var <- "Risk" # 按照临床性状(此处为风险)对样品排序 rt <- read.table(expFile, sep = "\t", header = T, row.names = 1, check.names = F) #读取表达文件 Type <- read.table(cliFile, sep = "\t", header = T, row.names = 1, check.names = F) #读取临床文件 # 样品取交集 sameSample <- intersect(colnames(rt), row.names(Type)) # 对表达数据和临床数据中的样本取交集 rt <- rt[,sameSample] # 取表达数据中的相同样本 Type <- Type[sameSample,] # 取临床数据中的相同样本 Type <- Type[order(Type[,var]),] # 按临床性状排序 rt <- rt[,row.names(Type)] # 调整样本顺序一致 # 绘制热图 p <- pheatmap(mat = rt, # 输入数据 annotation_col = Type, # 样本分类 color = colorRampPalette(c("blue", "white", "red"))(50), # 设置热图渐变颜色 cluster_cols = F, # 不对列进行聚类 scale = "row", # 基因矫正,字符指示值在行方向上居中和缩放 show_colnames = F, # 不展示列名(样本名) fontsize = 7.5, # 绘图的基本字体大小 fontsize_row = 7, # 行名的字体大小(默认值:fontsize) fontsize_col = 5) # 列名的字体大小(默认值:fontsize) pdf(outFile, height = 5, width = 8) print(p) dev.off()