From a cohort object, this function extracts the tree objects that are available for a patient. Parameters can be set to retrieve a particular tree, or the fit tree which is however availble only after fitting the cohort data. This function can either return a phylogenetic clone tree (R object ctree), or mutation trees (R object btree).

Phylo(x, p, rank = NULL, data = "trees")

Arguments

x

A REVOLVER cohort.

p

The id of a patient in the cohort.

rank

The rank of the tree to extract.

data

Either `trees` or `fit`, which requires to have already computed the fit of the input cohort.

Value

Phylogenetic or mutation trees data for the patient.

Examples

# Data released in the 'evoverse.datasets'
data('TRACERx_NEJM_2017_REVOLVER', package = 'evoverse.datasets')

# Get all the trees for a patient
Phylo(TRACERx_NEJM_2017_REVOLVER, 'CRUK0002')
#> $`1`
#>  [ ctree - ctree rank 1/2 for CRUK0002 ] 
#> 
#> # A tibble: 4 × 7
#>   cluster nMuts is.driver is.clonal    R1    R2    R3
#>   <chr>   <int> <lgl>     <lgl>     <dbl> <dbl> <dbl>
#> 1 1           3 TRUE      FALSE      0     0.92  0   
#> 2 2           2 TRUE      TRUE       0.99  0.98  0.99
#> 3 5           1 TRUE      FALSE      0.78  0     0   
#> 4 6           1 TRUE      FALSE      0.96  0.03  0.98
#> 
#> Tree shape (drivers annotated)  
#> 
#>   \-GL
#> This graph was created by an old(er) igraph version.
#>  Call `igraph::upgrade_graph()` on it to use with the current igraph version.
#> For now we convert it on the fly...
#> 
#>    \-2 :: MET, TERT
#>     |-6 :: EP300
#>     | \-5 :: NF1
#>     \-1 :: RB1, IKZF1, KRAS
#> 
#> Information transfer  
#> 
#>    MET ---> RB1 
#>    MET ---> IKZF1 
#>    MET ---> KRAS 
#>    TERT ---> RB1 
#>    TERT ---> IKZF1 
#>    TERT ---> KRAS 
#>    GL ---> MET 
#>    GL ---> TERT 
#>    EP300 ---> NF1 
#>    MET ---> EP300 
#>    TERT ---> EP300 
#> 
#> Tree score 0.75 
#> 
#> $`2`
#>  [ ctree - ctree rank 2/2 for CRUK0002 ] 
#> 
#> # A tibble: 4 × 7
#>   cluster nMuts is.driver is.clonal    R1    R2    R3
#>   <chr>   <int> <lgl>     <lgl>     <dbl> <dbl> <dbl>
#> 1 1           3 TRUE      FALSE      0     0.92  0   
#> 2 2           2 TRUE      TRUE       0.99  0.98  0.99
#> 3 5           1 TRUE      FALSE      0.78  0     0   
#> 4 6           1 TRUE      FALSE      0.96  0.03  0.98
#> 
#> Tree shape (drivers annotated)  
#> 
#>   \-GL
#> This graph was created by an old(er) igraph version.
#>  Call `igraph::upgrade_graph()` on it to use with the current igraph version.
#> For now we convert it on the fly...
#> 
#>    \-2 :: MET, TERT
#>     \-1 :: RB1, IKZF1, KRAS
#>      \-6 :: EP300
#>       \-5 :: NF1
#> 
#> Information transfer  
#> 
#>    MET ---> RB1 
#>    MET ---> IKZF1 
#>    MET ---> KRAS 
#>    TERT ---> RB1 
#>    TERT ---> IKZF1 
#>    TERT ---> KRAS 
#>    GL ---> MET 
#>    GL ---> TERT 
#>    EP300 ---> NF1 
#>    RB1 ---> EP300 
#>    IKZF1 ---> EP300 
#>    KRAS ---> EP300 
#> 
#> Tree score 0.0833333333333333 
#> 

# Get a specific tree for a patient
Phylo(TRACERx_NEJM_2017_REVOLVER, 'CRUK0002', rank = 2)
#>  [ ctree - ctree rank 2/2 for CRUK0002 ] 
#> 
#> # A tibble: 4 × 7
#>   cluster nMuts is.driver is.clonal    R1    R2    R3
#>   <chr>   <int> <lgl>     <lgl>     <dbl> <dbl> <dbl>
#> 1 1           3 TRUE      FALSE      0     0.92  0   
#> 2 2           2 TRUE      TRUE       0.99  0.98  0.99
#> 3 5           1 TRUE      FALSE      0.78  0     0   
#> 4 6           1 TRUE      FALSE      0.96  0.03  0.98
#> 
#> Tree shape (drivers annotated)  
#> 
#>   \-GL
#>    \-2 :: MET, TERT
#>     \-1 :: RB1, IKZF1, KRAS
#>      \-6 :: EP300
#>       \-5 :: NF1
#> 
#> Information transfer  
#> 
#>    MET ---> RB1 
#>    MET ---> IKZF1 
#>    MET ---> KRAS 
#>    TERT ---> RB1 
#>    TERT ---> IKZF1 
#>    TERT ---> KRAS 
#>    GL ---> MET 
#>    GL ---> TERT 
#>    EP300 ---> NF1 
#>    RB1 ---> EP300 
#>    IKZF1 ---> EP300 
#>    KRAS ---> EP300 
#> 
#> Tree score 0.0833333333333333 
#> 
# Get the fit tree for a patient