View source: R/generate_instances.R
create_B | R Documentation |
This function generates a mutation matrix (B matrix) for a tumor phylogenetic tree with a given number of nodes. This matrix represents the topology and it is created randomly, with the probability of a node to be chosen as a parent of a new node being proportional to the number of its ascendants raised to the power of a constant 'k'.
create_B(n, k)
n |
An integer representing the number of nodes in the phylogenetic tree. |
k |
A numeric value representing the constant used to calculate the probability of a node to be chosen as a parent of a new node. |
A square matrix representing the mutation relationships between the nodes in the phylogenetic tree. Each row corresponds to a node, and each column corresponds to a mutation. The value at the i-th row and j-th column is 1 if the i-th node has the j-th mutation, and 0 otherwise.
# Create a mutation matrix for a phylogenetic tree with 10 nodes and k = 2
B <- create_B(10, 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.