msmbuilder.MSMLib

Classes and functions for working with Transition and Count Matrices.

Notes

  • Assignments typically refer to a numpy array of integers such that Assignments[i,j] gives the state of trajectory i, frame j.
  • Transition and Count matrices are typically stored in scipy.sparse.csr_matrix format.

MSMLib functions generally relate to one of the following

  • Counting the number of transitions observed in Assignment data–e.g., constructing a Count matrix.
  • Constructing a transition matrix from a count matrix.
  • Performing calculations with Assignments, Counts matrices, or transition matrices.
apply_mapping_to_assignments(assignments, ...) Remap the states in an assignments file according to a mapping.
apply_mapping_to_vector(vector, mapping) Remap an observable vector after ergodic trimming
build_msm(counts[, symmetrize, ergodic_trimming]) Estimates the transition probability matrix from the counts matrix.
ergodic_trim(counts[, assignments]) Use Tarjan’s Algorithm to find maximal strongly connected subgraph.
ergodic_trim_indices(counts) Finds the indices of the largest strongly connected subgraph implied by the transitions in counts.
estimate_rate_matrix(count_matrix, assignments) MLE Rate Matrix given transition counts and dwell times
estimate_transition_matrix(count_matrix) Simple Maximum Likelihood estimator of transition matrix.
get_count_matrix_from_assignments(assignments) Calculate counts matrix from assignments.
get_counts_from_traj(states[, n_states, ...]) Computes the transition count matrix for a sequence of states (single trajectory).
invert_assignments(assignments) Invert an assignments array – that is, produce a mapping
log_likelihood(count_matrix, transition_matrix) log of the likelihood of an observed count matrix given a transition matrix
mle_reversible_count_matrix(count_matrix) Maximum likelihood estimate for a reversible count matrix
permute_mat(A, permutation) Permutes the indices of a transition probability matrix.
renumber_states(assignments) Renumber states to be consecutive integers (0, 1, ...
tarjan(\*args, \*\*kwargs)
trim_states(states_to_trim, counts[, ...]) Performs the necessary operations to reduce an MSM to a subset of the original states – effectively trimming those states out.
apply_mapping_to_assignments(assignments, ...) Remap the states in an assignments file according to a mapping.
apply_mapping_to_vector(vector, mapping) Remap an observable vector after ergodic trimming
build_msm(counts[, symmetrize, ergodic_trimming]) Estimates the transition probability matrix from the counts matrix.
ergodic_trim(counts[, assignments]) Use Tarjan’s Algorithm to find maximal strongly connected subgraph.
ergodic_trim_indices(counts) Finds the indices of the largest strongly connected subgraph implied by the transitions in counts.
estimate_rate_matrix(count_matrix, assignments) MLE Rate Matrix given transition counts and dwell times
estimate_transition_matrix(count_matrix) Simple Maximum Likelihood estimator of transition matrix.
get_count_matrix_from_assignments(assignments) Calculate counts matrix from assignments.
get_counts_from_traj(states[, n_states, ...]) Computes the transition count matrix for a sequence of states (single trajectory).
invert_assignments(assignments) Invert an assignments array – that is, produce a mapping
log_likelihood(count_matrix, transition_matrix) log of the likelihood of an observed count matrix given a transition matrix
mle_reversible_count_matrix(count_matrix) Maximum likelihood estimate for a reversible count matrix
permute_mat(A, permutation) Permutes the indices of a transition probability matrix.
renumber_states(assignments) Renumber states to be consecutive integers (0, 1, ...
tarjan(\*args, \*\*kwargs)
trim_states(states_to_trim, counts[, ...]) Performs the necessary operations to reduce an MSM to a subset of the original states – effectively trimming those states out.
Versions