deg=read.table('/Users/zhangzhishuai/Downloads/32 R热图/32_eatmap/MIR_DEG_fc_2.5_pval_0.01.txt',header = T,sep = '\t',row.names = 1)
expr=read.table('/Users/zhangzhishuai/Downloads/32 R热图/32_eatmap/miRNA_expr.txt',header = T,sep = '\t',row.names = 1)
type=factor(rep(c('RR','CC'),each=3))
miRNA=rownames(deg)
data=as.matrix(expr[miRNA,])
heatmap(data)
heatmap(
data,
cexCol = 0.8, # 控制字体大小 col/row
scale = 'row' # 对不同数据按照行进行尺度转换
)
# R原生配色方案
heatmap(data,col=cm.colors(256))
heatmap(data,col=terrain.colors(256))
# Rcolorbrewer 配色方案
library(RColorBrewer)
par(mfrow=c(1,1)) #几行几列个图
barplot(1:8,col = brewer.pal(8,'PiYG'))
coul <- colorRampPalette(brewer.pal(8,'PiYG'))(25) # 将8个变成25个,渐变色
heatmap(
data,
col=coul,
# Rowv = NA, # 不显示左边的线
# Colv = NA # 不显示上边的线
)
# 颜色标注样本
colside <- c('red','blue')[type]
p = heatmap(
data,
cexCol = 0.8,
#labCol = '', #不显示下面的组名
ColSideColors = colside
)
legend(
'topright',
legend = levels(type),
col = c('red','blue'),
pch = 15,
bty = 'n',
cex = 0.7
)
MIR_DEG_fc_2.5_pval_0.01.txt:文章来源:https://www.toymoban.com/news/detail-540907.html
logFC AveExpr t PValue FDR B
hsa-miR-375 1.075435 8.828953 9.548597 9.252706e-06 0.002965144 4.164644
hsa-miR-100-5p 6.992545 10.098290 9.347675 1.089106e-05 0.002965144 3.999978
hsa-miR-205-5p -1.453240 5.571316 -8.990997 1.465475e-05 0.002965144 3.720600
hsa-miR-194-5p -1.468509 9.701050 -8.603322 2.046487e-05 0.003105544 3.353541
hsa-miR-302b-3p -1.401613 4.024086 -6.560525 1.494008e-04 0.010720480 1.468262
miRNA_expr.txt:文章来源地址https://www.toymoban.com/news/detail-540907.html
CC.CR.rep1 CC.CR.rep2 CC.CR.rep3 CC.rep1 CC.rep2 CC.rep3
hsa-miR-576-3p 3.0179 2.3151 2.6573 2.3487 2.7519 2.7336
hsa-miR-140-5p 7.3453 7.2257 7.4967 6.8609 7.2546 7.3039
hsa-miR-522-5p -2.9822 -3.2561 -3.8133 -2.5675 -3.5901 -3.6494
hsa-miR-4743-3p -2.9822 -3.2561 -3.8133 -2.5675 -3.5901 -2.0644
hsa-miR-548av-5p -1.9822 -1.2561 -1.9388 -0.9825 -2.5901 -2.6494
到了这里,关于R语言学习——绘制热图的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!