input_custom_trees: Add a custom set of trees for a patient.

View source: R/input_custom_trees.R

input_custom_treesR Documentation

Add a custom set of trees for a patient.

Description

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.

Usage

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

Other Cohort creation: CCF_parser(), compute_clone_trees(), compute_mutation_trees(), revolver_check_cohort(), revolver_cohort()

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)

# Get scores for these matrices - vector format
scores = sapply(trees, function(x) x$score)

print(scores)

# 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
)

caravagn/revolver documentation built on May 21, 2022, 5:48 p.m.