jax_dna.observables.persistence_length

Persistence length observable.

Attributes

TARGETS

get_all_l_vectors

Classes

LpMetadata

Computes the metadata relevant for computing the persistence length (Lp) for each state.

Functions

persistence_length_fit(→ tuple[float, float])

Computes the Lp given correlations in alignment decay and average distance between base pairs.

compute_l_vector(→ tuple[jax.numpy.ndarray, float])

Computes the distance between two adjacent base pairs.

vector_autocorrelate(→ jax.numpy.ndarray)

Computes the average correlations in alignment decay between a list of vector.

compute_metadata(→ tuple[jax.numpy.ndarray, float])

Computes (i) average correlations in alignment decay and (ii) average distance between base pairs.

Module Contents

jax_dna.observables.persistence_length.TARGETS
jax_dna.observables.persistence_length.persistence_length_fit(correlations: jax.numpy.ndarray, l0_av: float) tuple[float, float][source]

Computes the Lp given correlations in alignment decay and average distance between base pairs.

Lp obeys the following equality: <l_n * l_0> = exp(-n<l_0> / Lp), where <l_n * l_0> represents the average correlation between adjacent base pairs (l_0) and base pairs separated by a distance of n base pairs (l_n). This relationship is linear in log space, log(<l_n * l_0>) = -n<l_0> / Lp. So, given the average correlations across distances and the average distance between adjacent base pairs, we compute Lp via a linear fit.

Parameters:
  • correlations (jnp.ndarray) – a (max_dist,) array containing the average correlation between base pairs separated by distances up to max_dist

  • l0_av (jnp.ndarray) – the average distance between adjacent base pairs

jax_dna.observables.persistence_length.compute_l_vector(base_sites: jax.numpy.ndarray, quartet: jax.numpy.ndarray) tuple[jax.numpy.ndarray, float][source]

Computes the distance between two adjacent base pairs.

jax_dna.observables.persistence_length.get_all_l_vectors
jax_dna.observables.persistence_length.vector_autocorrelate(vecs: jax.numpy.ndarray) jax.numpy.ndarray[source]

Computes the average correlations in alignment decay between a list of vector.

Given an ordered list of n vectors (representing vectors between adjacent base pairs), computes the average correlation between all pairs of vectors separated by a distance d for all distances d < n. Note that multiple pairs of vectors are included for all values < n-1.

Parameters:

vecs (jnp.ndarray) – a (n, 3) array of vectors corresponding to displacements between midpoints of adjacent base pairs.

jax_dna.observables.persistence_length.compute_metadata(base_sites: jax.numpy.ndarray, quartets: jax.numpy.ndarray) tuple[jax.numpy.ndarray, float][source]

Computes (i) average correlations in alignment decay and (ii) average distance between base pairs.

class jax_dna.observables.persistence_length.LpMetadata[source]

Bases: jax_dna.observables.base.BaseObservable

Computes the metadata relevant for computing the persistence length (Lp) for each state.

To model Lp, we assume an infinitely long, semi-flexible polymer, in which correlations in alignment decay exponentially with separation. So, to compute Lp, we need the average correlations across many states, as well as the average distance between adjacent base pairs. This observable computes these two quantities for a single state, and the average of these quantities across a trajectory can be postprocessed to compute a value for Lp.

Parameters:
  • quartets – a (n_bp, 2, 2) array containing the pairs of adjacent base pairs for which to compute the Lp

  • displacement_fn – a function for computing displacements between two positions

quartets: jax.numpy.ndarray
displacement_fn: collections.abc.Callable
__post_init__() None[source]

Validate the input.

__call__(trajectory: jax_dna.simulators.io.SimulatorTrajectory) tuple[jax.numpy.ndarray, jax_dna.utils.types.ARR_OR_SCALAR][source]

Calculate aligment decay and average distance correlations for adjacent base pairs.

Parameters:

trajectory (jd_traj.Trajectory) – the trajectory to calculate the rise for

Returns:

the correlations in alignment decay and the the average distance between adjacent base pairs for each state. The former will have shape (n_states, n_quartets-1) and the latter will have shape (n_states,).

Return type:

Tuple[jnp.ndarray, jd_types.ARR_OR_SCALAR]