helixmc.pose.HelixPose

class helixmc.pose.HelixPose(params, frame0=None, compute_tw_wr=False)

Pose object storing the state info of the helix.

Parameters:

params : ndarray of (N,6)

List of all bp-step parameters. A N bp helix has (N-1)*6 parameters.

frame0 : ndarray of (3,3), optional

The frame of the first base-pair, default is np.eye(3) (overlaps with global coordinate).

compute_tw_wr : bool, optional

Whether to compute twist and writhe (Fuller writhe) during system update. Should be set to True for link-constrained simulations.

Attributes

compute_tw_wr (bool) See Parameters section above.
writhe_exact (float) Exact writhe of the helix.
writhe_fuller (float) Fuller’s writhe of the helix.
twist (float) Supercoiling twist of the helix.
coord_terminal (1d array of (3)) Coordinate (x,y,z) of the center of last base-pair.
frame_terminal (ndarray of (3,3)) Coordinate frame of the last base-pair. Each column represent the cooresponding axis (frame[:,0] is the x-axis etc.)
z_terminal (float) Z-component of coord_terminal
link_fuller (float) Link of the helix computed using Fuller’s approximation.
link_exact (float) Exact link of the helix.
n_bp (int) Number of base-pairs in the helix.
coord (ndarray of (N,3)) Coordinates of all base-pairs in the helix (n_bp entries).
dr (ndarray of (N,3)) Delta-r vectors of the entire helix (n_bp-1 entries).
frames (ndarray of (N,3,3)) Frames of all base-pairs in the helix (n_bp entries).
params (ndarray of (N,6)) List of all bp-step parameters in the helix (n_bp-1 entries).
rb_vec (ndarray of (N,3)) Ribbon vectors of all base-pairs in the helix (n_bp entries).
__init__(params, frame0=None, compute_tw_wr=False)
accept_update()

Accept a trial update.

copy()

Return a copy of the current pose.

Returns:

pose_copy : HelixPose

Copy of the current pose.

classmethod from_file(input_file, compute_tw_wr=False)

Load pose data from an input file.

Parameters:

input_file : str

Input file (.npz) that stores the helix pose data.

compute_tw_wr : bool, optional

Whether to compute twist and writhe (Fuller writhe) during system update. Should be set to True for link-constrained simulations.

Raises:

ValueError

If n_bp < 2 in the input file.

guess_twist_center()

Attempt to guess the twist center value. Use circmean of the current twists.

plot_centerline(color='k', show=True, fig_ax=None)

Plot the helix center-line using matplotlib + mplot3d.

Parameters:

color : str, optional

Colors of the centerline (matplotlib color codes).

show : bool, optional

Whether to invoke pyplot.show() method at the end.

fig_ax : mplot3d.Axes3D, optional

Input mplot3d.Axes3D object. For ploting multiple helix on the same graph.

plot_helix(rb_width=5.0, color='kb', show=True, fig_ax=None)

Plot the helix using matplotlib + mplot3d.

Parameters:

rb_width : float, optional

Width of the helix ribbon in Å.

color : str, optional

Colors of the plot (matplotlib color codes), first letter for backbond and second letter for base-pair.

show : bool, optional

Whether to invoke pyplot.show() method at the end.

fig_ax : mplot3d.Axes3D, optional

Input mplot3d.Axes3D object. For ploting multiple helix on the same graph.

reject_update()

Reject a trial update.

set_params(params, frame0=None)

Set the bp-step params of the HelixPose.

Parameters:

params : ndarray of (N,6), optional

List of all bp-step parameters. Number of params should equal to n_bp - 1.

frame0 : ndarray of (3,3)

The frame of the first base-pair, default is np.eye(3).

update(i, params, o=None, R=None)

Full update of the i-th bp-step.

Parameters:

i : int

The index of the bp-step to be updated.

params : ndarray

Input base-pair step parameter set.

o : ndarray, optional

Coordiantes for the bp-centers of the 2nd base-pair.

R : ndarray, optional

Rotational matrix for the transformation.

Raises:

ValueError

If i < 0 or i >= n_bp.

update_trial(i, params, o=None, R=None)

Trial update of the i-th bp-step. Following accept_update or reject_update is required.

Parameters:

i : int

The index of the bp-step to be updated.

params : ndarray

Input base-pair step parameter set.

o : ndarray, optional

Coordiantes for the bp-centers of the 2nd base-pair.

R : ndarray, optional

Rotational matrix for the transformation.

Raises:

ValueError

If i < 0 or i >= n_bp.

write2disk(filename)

Write the current pose to disk.

Parameters:

filename : str

Name of the output file.