Skip to contents

This class represents the forest of the ancestors of the cells sampled during the computation. The leaves of this forest are the sampled cells.

Fields

get_coalescent_cells

Retrieve most recent common ancestors

  • Parameter: cell_ids - The list of the identifiers of the cells whose most recent common ancestors are aimed (optional).

  • Return: A dataframe representing, for each of the identified cells, the identified (column "cell_id"), whenever the node is not a root, the ancestor identifier (column "ancestor"), whenever the node was sampled, i.e., it is one of the forest leaves, the name of the sample containing the node, (column "sample"), the mutant (column "mutant"), the epistate (column "epistate"), and the birth time (column "birth_time").

get_nodes

Get the forest nodes

  • Return: A dataframe representing, for each node in the forest, the identified (column "cell_id"), whenever the node is not a root, the ancestor identifier (column "ancestor"), whenever the node was sampled, i.e., it is one of the forest leaves, the name of the sample containing the node, (column "sample"), the mutant (column "mutant"), the epistate (column "epistate"), and the birth time (column "birth_time").

get_samples_info

Retrieve information about the samples

  • Returns: A dataframe containing, for each sample collected during the simulation, the columns "name", "time", "ymin", "xmin", "ymax", "xmax", "tumour_cells", and "tumour_cells_in_bbox". The columns "ymin", "xmin", "ymax", "xmax" report the boundaries of the sample bounding box, while "tumour_cells" and "tumour_cells_in_bbox" are the number of tumour cells in the sample and in the bounding box, respectively.

get_species_info

Gets the species data

  • Returns: A dataframe reporting "mutant" and "epistate" for each registered species.

get_sticks

Compute the forest sticks

  • Returns: The list of the forest sticks. Each stick is represented as the list of cell identifiers labelling the nodes in the stick from the higher to the deeper in the forest.

get_subforest_for

Build a subforest using as leaves some of the original samples

  • Parameter: sample_names - The names of the samples whose cells will be used as leaves of the new forest.

  • Returns: A samples forest built on the samples mentioned in sample_names.

save

Save a samples forest in a file

  • Parameter: filename - The path of the file in which the samples forest must be saved.