create_B: Create tumor phylogenetic tree topology

View source: R/generate_instances.R

create_BR Documentation

Create tumor phylogenetic tree topology

Description

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'.

Usage

create_B(n, k)

Arguments

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.

Value

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.

Examples


# Create a mutation matrix for a phylogenetic tree with 10 nodes and k = 2
B <- create_B(10, 2)


GeRnika documentation built on April 3, 2025, 7:48 p.m.