lineage.LineageTree =================== .. py:module:: lineage.LineageTree .. autoapi-nested-parse:: This file contains the LineageTree class. Classes ------- .. autoapisummary:: lineage.LineageTree.LineageTree Functions --------- .. autoapisummary:: lineage.LineageTree.get_Emission_Likelihoods lineage.LineageTree.lineage_to_tree Module Contents --------------- .. py:class:: LineageTree(list_of_cells, E, obs = None, states = None) A class for lineage trees. This class also handles algorithms for walking the tree to calculate various properties. .. py:attribute:: pi :type: numpy.typing.NDArray[numpy.float64] .. py:attribute:: T :type: numpy.typing.NDArray[numpy.float64] .. py:attribute:: leaves_idx :type: numpy.ndarray .. py:attribute:: _output_lineage :type: list[lineage.CellVar.CellVar] | None .. py:attribute:: obs :type: numpy.ndarray .. py:attribute:: tree :type: scipy.sparse.csr_array .. py:attribute:: states :type: numpy.ndarray .. py:attribute:: E :type: collections.abc.Sequence[lineage.states.StateDistributionGamma.StateDistribution | lineage.states.StateDistributionGaPhs.StateDistribution | lineage.states.StateDistributionCR.StateDistributionPhase] .. py:property:: output_lineage :type: list[lineage.CellVar.CellVar] Backwards compatibility property constructing CellVar list from arrays. .. py:method:: _build_cellvar_list() .. py:property:: non_leaves_idx :type: numpy.ndarray Return array of non-leaf cell indices. .. py:property:: edges :type: tuple[numpy.ndarray, numpy.ndarray] Return (parents, daughters) edge arrays. .. py:property:: cell_to_daughters :type: numpy.ndarray Compatibility helper returning (N, 2) array of daughter indices. .. py:method:: rand_init(pi, T, E, desired_num_cells, censor_condition=0, desired_experiment_time=2000000000000.0, rng=None) :classmethod: Constructor method generating pure array representation. :param :math:`\pi`: The initial probability matrix. :param T: The transition probability matrix. :param E: A list containing state distribution objects. :param desired_num_cells: The desired number of cells. :param censor_condition: An integer in {0, 1, 2, 3} deciding censoring type. .. py:method:: __len__() Defines the length of a lineage by returning the number of cells it contains. .. py:function:: get_Emission_Likelihoods(X, E) Emission Likelihood (EL) matrix. Each element in this N by K matrix represents the probability :math:`P(x_n = x | z_n = k)`, for all :math:`x_n` and :math:`z_n` in our observed and hidden state tree and for all possible discrete states k. :param X: list of lineage trees :param E: The emissions likelihood :return: The marginal state distribution .. py:function:: lineage_to_tree(lineage) Build a directed adjacency CSR array (parent -> daughter) from a lineage.