Я хочу сгенерировать новую древовидную карту из некоторых заданных результатов программы REVIGO.Программа предоставляет скрипт R, но он устарел (использует tmplot вместо treemap), но я не могу понять, как обновить его для вывода графа treemap.У меня нулевой опыт работы с R, но это единственный вариант сделать фигуру самому.Мне нужно изменить окраску и расположение названий, чтобы их было легче увидеть и не перекрывать друг друга.
Я попытался проверить функцию помощи древовидной карты, но, обладая ограниченными знаниями, я очень быстро потерялся.
# 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()