R: Find the event distribution defined by an oncogenetic tree
distribution.oncotree
R Documentation
Find the event distribution defined by an oncogenetic tree
Description
distribution.oncotree calculates the joint distribution
of the events defined by the tree, while marginal.distr
calculates the marginal probability of occurrence of each event.
A logical value specifying if only the set of
possible outcomes should be returned (if TRUE), or the associated
probabilities of occurrence as well.
with.errors
A logical value specifying whether false
positive and negative error rates should be incorporated into
the distribution.
edge.weights
A choice of whether the observed or estimated
edge transition probabilities should be used in the calculation
of probabilities. See oncotree.fit for explanation
of the difference. By default, estimated edge transition probabilies
if with.errors=TRUE and the observed ones if
with.errors=FALSE.
Value
For distribution.oncotree: a data frame each row of which
gives a possible outcome.
For marginal.distr: a named numeric vector - the names
are the event names (+ ‘Root’) and the values are the
corresponding marginal probability of occurrence.
Author(s)
Aniko Szabo
See Also
oncotree.fit
Examples
data(ov.cgh)
ov.tree <- oncotree.fit(ov.cgh)
#joint distribution
jj <- distribution.oncotree(ov.tree, edge.weights="obs")
head(jj)
jj.eps <- distribution.oncotree(ov.tree, with.errors=TRUE)
head(jj.eps)
#marginal distribution
marginal.distr(ov.tree, with.error=FALSE)
#marginal distribution calculated from the joint
apply(jj[1:ov.tree$nmut], 2, function(x){sum(x*jj$Prob)})
##Same with errors incorporated
#marginal distribution
marginal.distr(ov.tree, with.error=TRUE)
#marginal distribution calculated from the joint
apply(jj.eps[1:ov.tree$nmut], 2, function(x){sum(x*jj.eps$Prob)})
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/distribution.oncotree.Rd_%03d_medium.png", width=480, height=480)
> ### Name: distribution.oncotree
> ### Title: Find the event distribution defined by an oncogenetic tree
> ### Aliases: distribution.oncotree marginal.distr
> ### Keywords: models distribution
>
> ### ** Examples
>
> data(ov.cgh)
> ov.tree <- oncotree.fit(ov.cgh)
>
> #joint distribution
> jj <- distribution.oncotree(ov.tree, edge.weights="obs")
> head(jj)
Root 8q+ 3q+ 5q- 4q- 8p- 1q+ Xp- Prob
1 1 0 0 0 0 0 0 0 0.079322342
2 1 1 0 0 0 0 0 0 0.057966327
3 1 0 0 1 0 0 0 0 0.007065829
4 1 0 0 0 0 0 1 0 0.061515285
23 1 1 0 1 0 0 0 0 0.005163490
21 1 1 0 0 0 0 1 0 0.044953478
> jj.eps <- distribution.oncotree(ov.tree, with.errors=TRUE)
> head(jj.eps)
Root 8q+ 3q+ 5q- 4q- 8p- 1q+ Xp- Prob
1 1 0 0 0 0 0 0 0 0.029222901
2 1 1 0 0 0 0 0 0 0.027992097
3 1 0 1 0 0 0 0 0 0.009202964
4 1 1 1 0 0 0 0 0 0.062160896
5 1 0 0 1 0 0 0 0 0.008323722
6 1 1 0 1 0 0 0 0 0.007973145
>
> #marginal distribution
> marginal.distr(ov.tree, with.error=FALSE)
Root 8q+ 3q+ 5q- 4q- 8p- 1q+ Xp-
1.0000000 0.7011494 0.4827586 0.5287356 0.3908046 0.3678161 0.4367816 0.2422204
> #marginal distribution calculated from the joint
> apply(jj[1:ov.tree$nmut], 2, function(x){sum(x*jj$Prob)})
Root 8q+ 3q+ 5q- 4q- 8p- 1q+ Xp-
1.0000000 0.7011494 0.4827586 0.5287356 0.3908046 0.3678161 0.4367816 0.2422204
>
> ##Same with errors incorporated
> #marginal distribution
> marginal.distr(ov.tree, with.error=TRUE)
Root 8q+ 3q+ 5q- 4q- 8p- 1q+ Xp-
1.0000000 0.7011494 0.5550202 0.5287356 0.4943105 0.4736503 0.4367816 0.4286807
> #marginal distribution calculated from the joint
> apply(jj.eps[1:ov.tree$nmut], 2, function(x){sum(x*jj.eps$Prob)})
Root 8q+ 3q+ 5q- 4q- 8p- 1q+ Xp-
1.0000000 0.7011494 0.5550202 0.5287356 0.4943105 0.4736503 0.4367816 0.4286807
>
>
>
>
>
>
> dev.off()
null device
1
>