jax_dna.input.trajectory

Trajectory information for RNA/DNA strands.

Attributes

TRAJECTORY_TIMES_DIMS

TRAJECTORY_ENERGIES_SHAPE

NUCLEOTIDE_STATE_SHAPE

ERR_TRAJECTORY_FILE_NOT_FOUND

ERR_TRAJECTORY_N_NUCLEOTIDE_STRAND_LEGNTHS

ERR_TRAJECTORY_TIMES_TYPE

ERR_TRAJECTORY_ENERGIES_TYPE

ERR_TRAJECTORY_T_E_S_LENGTHS

ERR_TRAJECTORY_TIMES_DIMS

ERR_TRAJECTORY_ENERGIES_SHAPE

ERR_NUCLEOTIDE_STATE_TYPE

ERR_NUCLEOTIDE_STATE_SHAPE

ERR_FIXED_BOX_SIZE

Classes

Trajectory

Trajectory information for a RNA/DNA strand.

NucleotideState

State information for the nucleotides in a single state.

Functions

validate_box_size(→ None)

Validate the volume for a simulation is fixed.

from_file(→ Trajectory)

Parse a trajectory file.

_read_file_process_wrapper(...)

Wrapper for reading a trajectory file.

_read_file(→ tuple[list[jax_dna.utils.types.Scalar], ...)

Read a trajectory file object.

Module Contents

jax_dna.input.trajectory.TRAJECTORY_TIMES_DIMS = 1
jax_dna.input.trajectory.TRAJECTORY_ENERGIES_SHAPE = (None, 3)
jax_dna.input.trajectory.NUCLEOTIDE_STATE_SHAPE = (None, 15)
jax_dna.input.trajectory.ERR_TRAJECTORY_FILE_NOT_FOUND = 'Trajectory file not found: {}'
jax_dna.input.trajectory.ERR_TRAJECTORY_N_NUCLEOTIDE_STRAND_LEGNTHS = 'n_nucleotides and sum(strand_lengths) do not match'
jax_dna.input.trajectory.ERR_TRAJECTORY_TIMES_TYPE = 'times must be a numpy array'
jax_dna.input.trajectory.ERR_TRAJECTORY_ENERGIES_TYPE = 'energies must be a numpy array'
jax_dna.input.trajectory.ERR_TRAJECTORY_T_E_S_LENGTHS = 'times, energies, and states do not have the same length'
jax_dna.input.trajectory.ERR_TRAJECTORY_TIMES_DIMS = 'times must be a 1D array'
jax_dna.input.trajectory.ERR_TRAJECTORY_ENERGIES_SHAPE = 'energies must be a 2D array with shape (n_states, 3)'
jax_dna.input.trajectory.ERR_NUCLEOTIDE_STATE_TYPE = 'Invalid type for nucleotide states:'
jax_dna.input.trajectory.ERR_NUCLEOTIDE_STATE_SHAPE = 'Invalid shape for nucleotide states:'
jax_dna.input.trajectory.ERR_FIXED_BOX_SIZE = 'Only trajecories in a fixed box size are supported'
class jax_dna.input.trajectory.Trajectory[source]

Trajectory information for a RNA/DNA strand.

n_nucleotides: int
strand_lengths: list[int]
times: jax_dna.utils.types.Arr_States
energies: jax_dna.utils.types.Arr_States_3
states: list[NucleotideState]
__post_init__() None[source]

Validate the input.

property state_rigid_bodies: list[jax_md.rigid_body.RigidBody]

Convert the states to a list of rigid bodies.

property state_rigid_body: jax_md.rigid_body.RigidBody

Convert the states to a single rigid body.

slice(key: int | slice) Trajectory[source]

Get a subset of the trajectory.

__repr__() str[source]

Return a string representation of the trajectory.

class jax_dna.input.trajectory.NucleotideState[source]

State information for the nucleotides in a single state.

array: jax_dna.utils.types.Arr_Nucleotide_15
__post_init__() None[source]

Validate the input array.

property com: jax_dna.utils.types.Arr_Nucleotide_3

Center of mass of the nucleotides.

property back_base_vector: jax_dna.utils.types.Arr_Nucleotide_3

Backbone base vector.

property base_normal: jax_dna.utils.types.Arr_Nucleotide_3

Base normal to the base plane.

property velocity: jax_dna.utils.types.Arr_Nucleotide_3

Velocity of the nucleotides.

property angular_velocity: jax_dna.utils.types.Arr_Nucleotide_3

Angular velocity of the nucleotides.

property euler_angles: tuple[jax_dna.utils.types.Arr_Nucleotide, jax_dna.utils.types.Arr_Nucleotide, jax_dna.utils.types.Arr_Nucleotide]

Convert principal axes to Tait-Bryan Euler angles.

property quaternions: jax_dna.utils.types.Arr_Nucleotide_4

Convert Euler angles to quaternions.

to_rigid_body() jax_md.rigid_body.RigidBody[source]

Convert the nucleotide state to jax-md rigid bodies.

jax_dna.input.trajectory.validate_box_size(state_box_sizes: list[jax_dna.utils.types.Vector3D]) None[source]

Validate the volume for a simulation is fixed.

jax_dna.input.trajectory.from_file(path: jax_dna.utils.types.PathOrStr, strand_lengths: list[int], *, is_oxdna: bool = True, n_processes: int = 1) Trajectory[source]

Parse a trajectory file.

Trajectory files are in the following format: t = number b = number number number E = number number number com_x com_y com_z a1_x a1_y a1_z a3_x a3_y a3_z v_x v_y v_z L_x L_y L_z …repeated n_nucleotides times in total com_x com_y com_z a1_x a1_y a1_z a3_x a3_y a3_z v_x v_y v_z L_x L_y L_z

where the com_x, …, L_z are all floating point numbers.

This can be repeated a total of “timestep” number of times.

In oxDNA the states are stored in 3’->5’ order so we flip the order per strand and need the topology to get the boundaries of each strand.

Parameters:
  • path (PathOrStr) – path to the trajectory file

  • strand_lengths (list[int]) – if this is an oxDNA trajectory, the lengths of each strand, so that they can be flipped to 5’->3’ order

  • is_oxdna (bool) – whether the trajectory is in oxDNA format

  • n_processes (int) – number of processors to use for reading the file

Returns:

trajectory information

Return type:

Trajectory

jax_dna.input.trajectory._read_file_process_wrapper(args: tuple[pathlib.Path, int, int, list[int], bool]) tuple[list[jax_dna.utils.types.Scalar], list[jax_dna.utils.types.Vector3D], list[jax_dna.utils.types.Vector3D], list[jax_dna.utils.types.Arr_Nucleotide_15]][source]

Wrapper for reading a trajectory file.

jax_dna.input.trajectory._read_file(file_path: pathlib.Path, start: int, end: int, strand_lengths: list[int], *, is_3p_5p: bool) tuple[list[jax_dna.utils.types.Scalar], list[jax_dna.utils.types.Vector3D], list[jax_dna.utils.types.Vector3D], list[jax_dna.utils.types.Arr_Nucleotide_15]][source]

Read a trajectory file object.