当前位置: 首页 > news >正文

canvas设计网站做推广公司

canvas设计网站,做推广公司,成都企业网站建设那家好,做兼职上哪个网站数据聚类然后展示聚类热图是生物信息中组学数据分析的常用方法,在R语言中有很多函数可以实现,譬如heatmap,kmeans等,除此外还有一个用得比较多的就是heatmap.2。最近在网上看到一个笔记文章关于《一步一步学heatmap.2函数》,在此与…

数据聚类然后展示聚类热图是生物信息中组学数据分析的常用方法,在R语言中有很多函数可以实现,譬如heatmap,kmeans等,除此外还有一个用得比较多的就是heatmap.2。最近在网上看到一个笔记文章关于《一步一步学heatmap.2函数》,在此与大家分享。由于原作者不详,暂未标记来源,请原作者前来认领哦,O(∩_∩)O哈哈~

数据如下:

  
  1. library(gplots)
  2. data(mtcars)
  3. x <- as.matrix(mtcars)
  4. rc <- rainbow(nrow(x), start=0, end=.3)
  5. cc <- rainbow(ncol(x), start=0, end=.3)

利用R语言heatmap.2函数进行聚类并画热图-图片1

X就是一个矩阵,里面是我们需要画热图的数据。

Rc是一个调色板,有32个颜色,渐进的

Cc也是一个调色板,有11个颜色,也是渐进的

首先画一个默认的图:

  
  1. heatmap.2(x)

利用R语言heatmap.2函数进行聚类并画热图-图片2

然后可以把聚类数可以去掉:就是控制这个dendrogram参数

  
  1. heatmap.2(x, dendrogram=“none”)

利用R语言heatmap.2函数进行聚类并画热图-图片3

然后我们控制一下聚类树

  
  1. heatmap.2(x, dendrogram=“row”) # 只显示行向量的聚类情况
  2. heatmap.2(x, dendrogram=“col”) #只显示列向量的聚类情况

 

下面还是在调控聚类树,但是我没看懂跟上面的参数有啥子区别!

  
  1. heatmap.2(x, keysize=2) ## default - dendrogram plotted and reordering done.
  2. heatmap.2(x, Rowv=FALSE, dendrogram=“both”) ## generate warning!
  3. heatmap.2(x, Rowv=NULL, dendrogram=“both”) ## generate warning!
  4. heatmap.2(x, Colv=FALSE, dendrogram=“both”) ## generate warning!

接下来我们可以调控行列向量的label的字体大小方向

首先我们调控列向量,也就是x轴的label

  
  1. heatmap.2(x, srtCol=NULL)
  2. heatmap.2(x, srtCol=0, adjCol = c(0.5,1) )
  3. heatmap.2(x, srtCol=45, adjCol = c(1,1) )
  4. heatmap.2(x, srtCol=135, adjCol = c(1,0) )
  5. heatmap.2(x, srtCol=180, adjCol = c(0.5,0) )
  6. heatmap.2(x, srtCol=225, adjCol = c(0,0) ) ## not very useful
  7. heatmap.2(x, srtCol=270, adjCol = c(0,0.5) )
  8. heatmap.2(x, srtCol=315, adjCol = c(0,1) )
  9. heatmap.2(x, srtCol=360, adjCol = c(0.5,1) )

利用R语言heatmap.2函数进行聚类并画热图-图片4

然后我们调控一下行向量,也就是y轴的label

  
  1. heatmap.2(x, srtRow=45, adjRow=c(0, 1) )
  2. heatmap.2(x, srtRow=45, adjRow=c(0, 1), srtCol=45, adjCol=c(1,1) )
  3. heatmap.2(x, srtRow=45, adjRow=c(0, 1), srtCol=270, adjCol=c(0,0.5) )

利用R语言heatmap.2函数进行聚类并画热图-图片5

设置 offsetRow/offsetCol 可以把label跟热图隔开!

  
  1. ## Show effect of offsetRow/offsetCol (only works when srtRow/srtCol is
  2. ## not also present) heatmap.2(x, offsetRow=0, offsetCol=0)
  3. heatmap.2(x, offsetRow=1, offsetCol=1)
  4. heatmap.2(x, offsetRow=2, offsetCol=2)
  5. heatmap.2(x, offsetRow=-1, offsetCol=-1)
  6. heatmap.2(x, srtRow=0, srtCol=90, offsetRow=0, offsetCol=0)
  7. heatmap.2(x, srtRow=0, srtCol=90, offsetRow=1, offsetCol=1)
  8. heatmap.2(x, srtRow=0, srtCol=90, offsetRow=2, offsetCol=2)
  9. heatmap.2(x, srtRow=0, srtCol=90, offsetRow=-1, offsetCol=-1)

利用R语言heatmap.2函数进行聚类并画热图-图片6

  
  1. ## Show effect of z-score scaling within columns, blue-red color scale
  2. hv <- heatmap.2(x, col=bluered, scale=“column”, tracecol=“#303030”)

hv是一个热图对象!!!

  
  1. > names(hv) # 可以看到hv对象里面有很多子对象
  2. > “rowInd” “colInd” “call” “colMeans” “colSDs” “carpet” “rowDendrogram” “colDendrogram” “breaks” “col” “vline” “colorTable” ## Show the mapping of z-score values to color bins hvKaTeX parse error: Expected 'EOF', got '#' at position 638: …an class="com">#̲# Extract the r…colorTable[hvKaTeX parse error: Expected 'EOF', got '#' at position 124: …n class="str">"#̲FFFFFF"</span><…colorTable[hvKaTeX parse error: Expected 'EOF', got '#' at position 124: …n class="str">"#̲FFFFFF"</span><…colSDs + hv c o l M e a n s < / s p a n > < s p a n c l a s s = " p u n " > , < / s p a n > < s p a n c l a s s = " p l n " > w h i t e B i n < / s p a n > < s p a n c l a s s = " p u n " > [ < / s p a n > < s p a n c l a s s = " l i t " > 2 < / s p a n > < s p a n c l a s s = " p u n " > ] < / s p a n > < s p a n c l a s s = " p l n " > < / s p a n > < s p a n c l a s s = " p u n " > ∗ < / s p a n > < s p a n c l a s s = " p l n " > h v colMeans</span><span class="pun">,</span><span class="pln"> whiteBin</span><span class="pun">[</span><span class="lit">2</span><span class="pun">]</span><span class="pln"> </span><span class="pun">*</span><span class="pln"> hv colMeans</span><spanclass="pun">,</span><spanclass="pln">whiteBin</span><spanclass="pun">[</span><spanclass="lit">2</span><spanclass="pun">]</span><spanclass="pln"></span><spanclass="pun"></span><spanclass="pln">hvcolSDs + hvKaTeX parse error: Expected 'EOF', got '#' at position 1148: …n class="str">"#̲303030"</span><…Type)],
  3. xlab=‘CellLines’,
  4. ylab=‘Probes’,
  5. main=Cluster_Method[i],
  6. col=greenred(64))
  7. dev.off()
  8. }

 

这样就可以一下子把七种cluster的方法依次用到heatmap上面来。而且通过对cluster树的比较,我们可以从中挑选出最好、最稳定到cluster方法,为后续分析打好基础!

 

对下面这个数据聚类:

利用R语言heatmap.2函数进行聚类并画热图-图片12

  
  1. require(graphics)
  2. hc <- hclust(dist(USArrests), “ave”)
  3. plot(hc)

利用R语言heatmap.2函数进行聚类并画热图-图片13

首先对一个数据框用dist函数处理得到一个dist对象!

利用R语言heatmap.2函数进行聚类并画热图-图片14

Dist对象比较特殊,专门为hclust函数来画聚类树的!

利用R语言heatmap.2函数进行聚类并画热图-图片15

http://www.15wanjia.com/news/32428.html

相关文章:

  • 网页跳转到其他网站网站推广的方式有哪些
  • 能看建设动漫黄图的网站四年级说新闻2023
  • 企业网站建设 制作618网络营销策划方案
  • 北京网站sem、seo网络营销的现状和发展趋势
  • 北京市建设工程质量监督站网站网络营销案例分析ppt
  • 网站开发环境搭建搜索引擎关键词排名优化
  • 网站建设的方法免费b站在线观看人数在哪
  • 门户网站设计要求百度官网认证价格
  • 构建网站需要什么意思seo基础知识考试
  • 公司网站转微信小程序宁波seo网络推广推荐
  • 怎样在手机上做网站seo在线教程
  • 个人主页设计规划文案seo营销推广
  • 怎样编辑网站市场调研分析
  • 重庆建设定额网站微博营销推广策划方案
  • 怎么修改网站网页的背景图片爱站网域名查询
  • 文登住房与建设局网站环球网疫情最新消息
  • 学做网站课程搜索引擎优化的简称
  • wordpress主机搭建台州seo排名公司
  • 医院网站设计模板新闻20条摘抄大全
  • 北京公司模板网站好外贸推广公司
  • 论论坛坛网网站站建建设设seo站内优化公司
  • 上海浦东建设管理有限公司网站腾讯域名注册官网
  • 国外营销型网站设计目前常用的搜索引擎有哪些
  • 非80端口做网站长春网站优化方案
  • django做网站快吗网络营销工具有哪些?
  • 做彩票网站违法的吗seo网站优化知识
  • 奉贤深圳网站建设公司友情链接源码
  • 代码网站怎么制作广州网站建设推荐
  • 做平面设计的网站有哪些综合查询
  • 高级感的logo图片优化防疫措施