Build a directed tree structure to model the process of occurrence
of genetic alterations (events) in carcinogenesis. The model is
described in more detail in Oncotree-package. Methods for
printing a short summary, displaying the tree on an R plot, and producing
latex code for drawing the tree (using the ‘pstricks’ and ‘pst-tree’ LaTeX packages)
are provided.
A data frame or a matrix with variable names as
a listing of genetic events taking on binary values indicating
missing (0) or present (1). Each row is an independent sample.
error.fun
A function of two variables that measures the
deviation of the observed marginal frequencies of the events
(which will be the first argument in the call) from the estimated ones.
The false positive and negative error rates are obtained by minimizing
error.fun. If error.fun=NULL is used, the error rates are not estimated.
x
An object of class oncotree.
edge.weights
Choice of edge weights to show on the plot.
edge.digits
The number of significant digits to use when displaying edge weights.
node.coords
A matrix with node-coordinates or NULL if the coordinates should be
computed automatically (default).
plot
Logical; indicates whether the tree should be plotted.
cex
Scaling factor for the text in the nodes.
col.edge
color of the tree edges.
col.text
color of the node label.
col.weight
color of the edge weights.
...
Ignored for print. For plot these can
be graphical parameters passed to lines when the edges are
drawn
shape
The shape of the node in the pst-tree representation.
pstree.options
Additional options for pst-tree. See the pstricks
documentation for possible values.
Details
‘pst-tree’ is a very flexible package, and very detailed formatting of the tree
is possible. pstree.oncotree provides some default settings for drawing
trees, but they can be easily overridden: most options can be set in
pstree.options, while the appearance of the tree nodes can be controlled
by defining a one-parameter lab command that gives the desired appearance.
For example, if red, non-mathematical test is desired in an oval, you could use
\newcommand{lab}[1]{Toval[name=#1]{{
ed #1}}}.
Value
For oncotree.fit:
an object of class oncotree which has components
data
data frame used, after dropping events with zero observed frequency,
and adding a column for the artificial ‘Root’ node
nmut
number of tree nodes: the number genetic events present in data +1 for the ‘Root’ node
parent
a list containing information about the tree structure with the following components
childa character vector of the event names starting with ‘Root’
parenta character vector of the names of the parents of child
parent.numa numeric vector with column indices corresponding to parent
est.weightsedge transition probabilities adjusted for the error rates eps
level
a numeric vector of the depth of each node in the tree (1 for the root, 2 for its children, etc.)
numchild
a numeric vector giving the number of children for each node
levelnodes
a numeric vector of the number of nodes found at each level of the tree
levelgrp
a character matrix with its rows giving the ordered nodes at each level
eps
a numeric vector of length two showing the estimated false positive and negative error rates (if error.fun is not NULL). Do not modify directly, but rather through error.rates<-.
For print.oncotree:
the original object is returned invisibly. It prints a summary showing the number of nodes, the parent-child relationships, and the false positive and negative error rates.
For plot.oncotree:
a matrix with node-coordinates is returned invisibly. The column names of the matrix are the
names of the nodes/events (including 'Root'), the rows gives the x- and y-coordinates, respectively.
This matrix provides a valid input for node.coords. If plot=TRUE, a plot of the tree is produced.
For pstree.oncotree:
a character string with the LaTeX code needed to draw a tree. usepackage{pstricks,pst-tree}
is required in the preamble of the LaTeX file, and it should be processed through
a PostScript intermediary (DVIPS or similar) and not through PDFLaTeX.
Author(s)
Lisa Pappas
References
Szabo, A. and Boucher, K. (2002) Estimating an oncogenetic tree when false negative and positives are present. Mathematical Biosciences, 176/2, 219-236.
data(ov.cgh)
ov.tree <- oncotree.fit(ov.cgh, error.fun=function(x,y){max(abs(x-y))})
ov.tree
nodes <- plot(ov.tree, edge.weights="est")
#move the Root node to the left
nodes["x","Root"] <- nodes["x","8q+"]
plot(ov.tree, node.coords=nodes)
#output for pstricks+pst-tree
pstree.oncotree(ov.tree, edge.weights="obs", shape="oval")
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(Oncotree)
Loading required package: boot
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/Oncotree/oncotree.fit.Rd_%03d_medium.png", width=480, height=480)
> ### Name: oncotree
> ### Title: Build and display an oncogenetic tree
> ### Aliases: oncotree.fit print.oncotree plot.oncotree pstree.oncotree
> ### Keywords: models tree graphs hplot
>
> ### ** Examples
>
> data(ov.cgh)
> ov.tree <- oncotree.fit(ov.cgh, error.fun=function(x,y){max(abs(x-y))})
> ov.tree
Oncogenetic tree from 7 events
Parent function:
8q+ <- Root
3q+ <- 8q+
5q- <- Root
4q- <- 5q-
8p- <- 5q-
1q+ <- Root
Xp- <- 8p-
Estimated error rates: epos= 0.2065369 , eneg= 0.03838967
> nodes <- plot(ov.tree, edge.weights="est")
> #move the Root node to the left
> nodes["x","Root"] <- nodes["x","8q+"]
> plot(ov.tree, node.coords=nodes)
> #output for pstricks+pst-tree
> pstree.oncotree(ov.tree, edge.weights="obs", shape="oval")
providecommand{lab}[1]{Toval[name=#1]{$#1$}}
psset{arrows=->, treefit=loose, arrowscale=1.5 0.8, nodesep=3pt}
pstree{%
lab{Root}\ncput*{1.0}}{pstree{%
lab{8q+}\ncput*{0.70}}{pstree{%
lab{3q+}\ncput*{0.69}}{}}pstree{%
lab{5q-}\ncput*{0.53}}{pstree{%
lab{4q-}\ncput*{0.74}}{}pstree{%
lab{8p-}\ncput*{0.70}}{pstree{%
lab{Xp-}\ncput*{0.66}}{}}}pstree{%
lab{1q+}\ncput*{0.44}}{}}
>
>
>
>
>
> dev.off()
null device
1
>