Files
ROBITools/man/dbtree.Rd

53 lines
1.6 KiB
R

% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/taxoDBtree.R
\name{dbtree}
\alias{dbtree}
\title{Construct a taxonomic tree from a list of taxa}
\usage{
dbtree(x)
}
\arguments{
\item{x}{a table containing the taxonomic path of the references. Typically an output from get.classic.taxonomy}
}
\value{
g a directed graph displaying the taxonomy hierarchy of the input data. Stored in a \code{\link{igraph}} object
where the taxonomic ranks of the vertices are added to the vertices attributes
}
\description{
Construct a graph from a table containing the taxonomic path of sequences
}
\examples{
data(termes)
taxo=default.taxonomy()
termes.taxo.table = get.classic.taxonomy(termes, taxo, "taxid")
head(termes.taxo.table)
graph.tax.termes = dbtree(termes.taxo.table[,1:7])
library(igraph)
#plot the tree
coord = layout.reingold.tilford(graph.tax.termes, root=1, circular=F)
v.cex = as.factor(V(graph.tax.termes)$rank)
levels(v.cex) = match(levels(v.cex), colnames(termes.taxo.table))
plot(graph.tax.termes, vertex.size=1, vertex.label.cex=2*(as.numeric(as.vector(v.cex))^-1), edge.arrow.size=0, layout=coord)
#Vizualization with sequence counts
tax.count = log10(colSums(termes$reads)[match(as.vector(V(graph.tax.termes)$name), termes$motus$scientific_name)])
tax.count[is.na(tax.count)|tax.count<0] = 0.01
V(graph.tax.termes)$count = unname(tax.count)
plot(graph.tax.termes, vertex.size=V(graph.tax.termes)$count, vertex.label.cex=2*(as.numeric(as.vector(v.cex))^-1), edge.arrow.size=0, layout=coord)
}
\seealso{
\code{\link{get.classic.taxonomy}}
}
\author{
Lucie Zinger
}