lineage.Viterbi

This file contains the methods for the Viterbi algorithm implemented in an upward recursion.

Functions

get_deltas(X, E, T)

Delta matrix and base case at the leaves.

Viterbi(tHMMobj)

Runs the Viterbi algorithm and returns a list of arrays containing the optimal state of each cell.

Module Contents

lineage.Viterbi.get_deltas(X, E, T)

Delta matrix and base case at the leaves. Each element in this N by K matrix is the probability for the leaves \(P(x_n = x | z_n = k)\).

Then calculates delta values for non-leaf cells by filling out the delta matrix.

Parameters:
  • X (list) -- list of lineage trees

  • E (list) -- list of emission distributions

  • T (numpy.ndarray) -- transition probability matrix

Returns:

deltas and state pointers for each lineage

Return type:

tuple[list[numpy.ndarray], list[numpy.ndarray]]

lineage.Viterbi.Viterbi(tHMMobj)

Runs the Viterbi algorithm and returns a list of arrays containing the optimal state of each cell. This function returns the most likely sequence of states for each lineage.

Parameters:

tHMMobj -- a class object with properties of the lineages of cells

Returns:

assigned states to each cell in all lineages

Return type:

list[numpy.ndarray]