For a patient it is possible to add a set of precomputed trees, which need to be stored as adjacency matrices, and must be scored and ranked by scoring. The trees must have as nodes all the clusters that are annotated in the data of the patient. If the patient has already some trees, these are overwritten.

input_custom_trees(x, patient, trees, scores)

Arguments

x

A REVOLVER cohort object.

patient

A patient in the cohort, for which the trees are created.

trees

A list a of precomputed adjacency matrices to describe the input trees.

scores

A vectore of scores for the input trees.

Value

A modififed REVOLVER cohort with available phylogeneis for patient.

See also

Examples

# Data released in the 'evoverse.datasets' data('TRACERx_NEJM_2017_REVOLVER', package = 'evoverse.datasets') # To make it simple we use some trees that are already available trees = Phylo(TRACERx_NEJM_2017_REVOLVER, p = "CRUK0001") # Get matrices from these objects, and remove the GL columns/ rows matrices = lapply(trees, function(x) x$adj_mat[rownames(x$adj_mat) != 'GL', colnames(x$adj_mat) != 'GL']) print(matrices)
#> $`1` #> 1 3 5 2 #> 1 0 0 1 0 #> 3 1 0 0 1 #> 5 0 0 0 0 #> 2 0 0 0 0 #> #> $`2` #> 2 3 5 1 #> 2 0 0 1 0 #> 3 1 0 0 1 #> 5 0 0 0 0 #> 1 0 0 0 0 #> #> $`3` #> 1 5 3 2 #> 1 0 1 0 0 #> 5 0 0 0 1 #> 3 1 0 0 0 #> 2 0 0 0 0 #>
# Get scores for these matrices - vector format scores = sapply(trees, function(x) x$score) print(scores)
#> 1 2 3 #> 0.1111111 0.1111111 0.1111111
# Add these trees - this function overwrites the original ones TRACERx_NEJM_2017_REVOLVER = input_custom_trees( TRACERx_NEJM_2017_REVOLVER, patient = "CRUK0001", trees = matrices, scores = scores )
#> #> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- #> Using custom trees for CRUK0001 #> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- #> #> Combinations of Information Transfer : 3 #>