This constructor creates an object of class `'mtree'`, which represents a mutation tree. The tree is created from a set of binary clusters computed for a patient, here a cluster is defined as the set of alterations (e.g., mutations) that are detected as present or absent in the same set of sequenced biopsies.

To create a tree a list of drivers can be provided to be annotated to an input set of binary clusters. There are a minimum amount of information and formatting fields that are required for tree construction to operate successfully. Please refer to the package vignette and the provided input datasets for more instructions.

mtree(binary_clusters, drivers, samples, patient, M, score,
  annotation = paste0("Mutation tree for patient ", patient),
  evaluation = ">=")

Arguments

binary_clusters

Clusters of Cancer Cell Fractions available in the data of this patient. See the package vignette to see the format in which this should be specified.

drivers

A list of driver events that should be annotated to each one of the input clusters contained in the `CCF_clusters` parameter. See the package vignette to see the format in which this should be specified.

samples

A vector of samples names (e.g., the biopsies sequenced for this patient).

patient

A string id that represent this patient.

M

The adjacency matrix defined to connect all the nodes of this tree.

score

A scalar score that can be associated to this tree.

annotation

Any string annotation that one wants to add to this `ctree`. This will be used by some of the plotting functions that display `ctree` objects.

evaluation

How Suppes conditions should be evaluated (`>=` or `>`).

Value

An object of class "mtree" that represents this tree.

See also

This function requires the input tree to be specified in the format of an adjacency matrix; plese see function mtrees if you need to create de novo also the adjacency matrices that fit your data.

Examples

data(mtree_input) x = mtrees( mtree_input$binary_clusters, mtree_input$drivers, mtree_input$samples, mtree_input$patient, mtree_input$sspace.cutoff, mtree_input$n.sampling, mtree_input$store.max )
#> [ mtree ~ generate mutation trees for PD9193 ] #> Sampler : 10000 (cutoff), 5000 (sampling), 100 (max store) #> Suppes' conditions : >= #> # A tibble: 4 x 14 #> Misc patientID cluster is.driver is.clonal PD9193d PD9193e PD9193f PD9193g #> <chr> <chr> <chr> <lgl> <lgl> <dbl> <dbl> <dbl> <dbl> #> 1 cuto… PD9193 2 FALSE FALSE 1 1 1 0 #> 2 cuto… PD9193 3 TRUE FALSE 1 0 0 0 #> 3 cuto… PD9193 1 TRUE TRUE 1 1 1 1 #> 4 cuto… PD9193 4 TRUE FALSE 1 0 1 1 #> # … with 5 more variables: PD9193h <dbl>, PD9193i <dbl>, PD9193j <dbl>, #> # PD9193k <dbl>, nMuts <dbl> #> #> Structures 3 - search is exahustive #> Trees with non-zero sscore 3 storing 3 #>
x = x[[1]] # Adj matrix inside of the objects, we remove the GL # entry that is added as fake root by ctree M = x$adj_mat M = M[rownames(M) != 'GL', colnames(M) != 'GL'] print(M)
#> 4 1 3 2 #> 4 0 0 1 0 #> 1 1 0 0 1 #> 3 0 0 0 0 #> 2 0 0 0 0
# Manual construction y = mtrees( mtree_input$binary_clusters, mtree_input$drivers, mtree_input$samples, mtree_input$patient, M, score = 123456, annotation = paste0("Some mutation tree") )
#> Error in mtrees(mtree_input$binary_clusters, mtree_input$drivers, mtree_input$samples, mtree_input$patient, M, score = 123456, annotation = paste0("Some mutation tree")): unused arguments (score = 123456, annotation = paste0("Some mutation tree"))
# The same print(x)
#> [ mtree - mtree rank 1/3 for PD9193 ] #> #> # A tibble: 4 x 14 #> Misc patientID cluster is.driver is.clonal PD9193d PD9193e PD9193f PD9193g #> <chr> <chr> <chr> <lgl> <lgl> <dbl> <dbl> <dbl> <dbl> #> 1 cuto… PD9193 2 FALSE FALSE 1 1 1 0 #> 2 cuto… PD9193 3 TRUE FALSE 1 0 0 0 #> 3 cuto… PD9193 1 TRUE TRUE 1 1 1 1 #> 4 cuto… PD9193 4 TRUE FALSE 1 0 1 1 #> # … with 5 more variables: PD9193h <dbl>, PD9193i <dbl>, PD9193j <dbl>, #> # PD9193k <dbl>, nMuts <dbl> #> #> Tree shape (drivers annotated) #> #> \-GL #> \-1 [PD9193k] :: GATA3 #> |-4 :: +8q, -8p #> | \-3 :: SMARCA4 #> \-2 #> #> Information transfer #> #> +8q ---> SMARCA4 #> -8p ---> SMARCA4 #> GL ---> GATA3 #> GATA3 ---> +8q #> GATA3 ---> -8p #> #> Tree score 0.000697748027942915 #>
#> Error in print(y): object 'y' not found