Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从tmplot切换到treemap的简单R代码更新(无经验)_R - Fatal编程技术网

从tmplot切换到treemap的简单R代码更新(无经验)

从tmplot切换到treemap的简单R代码更新(无经验),r,R,我想从一个名为REVIGO的程序的一些给定输出结果生成一个新的树映射。该程序提供了R脚本,但它已经过时(使用tmplot而不是treemap),但我无法确定如何更新它以输出treemap图。我对R没有任何经验,但这是我自己制作这个数字的唯一选择。我需要改变一些颜色和名称的位置,使它们更容易看到,不重叠 我试着查看treemap帮助函数,但由于知识有限,我很快就迷路了 # A treemap R script produced by the REVIGO server at http://revi

我想从一个名为REVIGO的程序的一些给定输出结果生成一个新的树映射。该程序提供了R脚本,但它已经过时(使用tmplot而不是treemap),但我无法确定如何更新它以输出treemap图。我对R没有任何经验,但这是我自己制作这个数字的唯一选择。我需要改变一些颜色和名称的位置,使它们更容易看到,不重叠

我试着查看treemap帮助函数,但由于知识有限,我很快就迷路了

# A treemap R script produced by the REVIGO server at http://revigo.irb.hr/
# If you found REVIGO useful in your work, please cite the following reference:
# Supek F et al. "REVIGO summarizes and visualizes long lists of Gene Ontology
# terms" PLoS ONE 2011. doi:10.1371/journal.pone.0021800

# author: Anton Kratz <anton.kratz@gmail.com>, RIKEN Omics Science Center, Functional Genomics Technology Team, Japan
# created: Fri, Nov 02, 2012  7:25:52 PM
# last change: Fri, Nov 09, 2012  3:20:01 PM

# -----------------------------------------------------------------------------
# If you don't have the treemap package installed, uncomment the following line:
# install.packages( "treemap" );
library(treemap)                                # treemap package by Martijn Tennekes

# Set the working directory if necessary
# setwd("C:/Users/username/workingdir");

# --------------------------------------------------------------------------
# Here is your data from REVIGO. Scroll down for plot configuration options.

revigo.names <- c("term_ID","description","freqInDbPercent","abslog10pvalue","uniqueness","dispensability","representative");
revigo.data <- rbind(c("GO:0007610","behavior",3.020,22.1857,0.994,0.000,"behavior"),
c("GO:0009636","response to toxic substance",1.002,11.2504,0.969,0.000,"response to toxic substance"),
c("GO:0042493","response to drug",1.899,7.1516,0.967,0.275,"response to toxic substance"),

c("GO:0045893","positive regulation of transcription, DNA-templated",6.515,9.0725,0.754,0.670,"positive regulation of cell proliferation"),
c("GO:0050673","epithelial cell proliferation",1.733,4.2276,0.949,0.609,"positive regulation of cell proliferation"),
c("GO:0009893","positive regulation of metabolic process",14.098,8.8944,0.800,0.607,"positive regulation of cell proliferation"),
c("GO:0034645","cellular macromolecule biosynthetic process",21.549,3.0485,0.862,0.696,"positive regulation of cell proliferation"),
c("GO:0009058","biosynthetic process",26.682,3.7369,0.947,0.085,"biosynthesis"),
c("GO:0060255","regulation of macromolecule metabolic process",26.302,5.1473,0.811,0.689,"regulation of biological quality"),
c("GO:0051171","regulation of nitrogen compound metabolic process",19.403,6.6062,0.816,0.240,"regulation of biological quality"));

stuff <- data.frame(revigo.data);
names(stuff) <- revigo.names;

stuff$abslog10pvalue <- as.numeric( as.character(stuff$abslog10pvalue) );
stuff$freqInDbPercent <- as.numeric( as.character(stuff$freqInDbPercent) );
stuff$uniqueness <- as.numeric( as.character(stuff$uniqueness) );
stuff$dispensability <- as.numeric( as.character(stuff$dispensability) );

# by default, outputs to a PDF file
pdf( file="revigo_treemap.pdf", width=16, height=9 ) # width and height are in inches

# check the tmPlot command documentation for all possible parameters - there are a lot more
tmPlot(
    stuff,
    index = c("representative","description"),
    vSize = "abslog10pvalue",
    type = "categorical",
    vColor = "representative",
    title = "REVIGO Gene Ontology treemap",
    inflate.labels = FALSE,      # set this to TRUE for space-filling group labels - good for posters
    lowerbound.cex.labels = 0,   # try to draw as many labels as possible (still, some small squares may not get a label)
    bg.labels = "#CCCCCCAA",     # define background color of group labels
                                                       # "#CCCCCC00" is fully transparent, "#CCCCCCAA" is semi-transparent grey, NA is opaque
    position.legend = "none"
)

dev.off()
#由位于的REVIGO服务器生成的树映射R脚本http://revigo.irb.hr/
#如果您发现REVIGO对您的工作有用,请引用以下参考资料:
#REVIGO总结并可视化了基因本体的长列表
#术语“PLoS ONE 2011”。doi:10.1371/journal.pone.0021800
#作者:Anton Kratz,日本功能基因组学技术团队理研组学科学中心
#创建时间:2012年11月2日星期五下午7:25:52
#最后更改:2012年11月9日星期五下午3:20:01
# -----------------------------------------------------------------------------
#如果没有安装treemap包,请取消注释以下行:
#安装软件包(“treemap”);
图书馆(treemap)#Martijn Tennekes的treemap软件包
#如有必要,设置工作目录
#setwd(“C:/Users/username/workingdir”);
# --------------------------------------------------------------------------
#这是您从REVIGO获得的数据。向下滚动查看打印配置选项。
复习你的名字