fractaldna.dna_models.dnachain.SplineLinker

class fractaldna.dna_models.dnachain.SplineLinker(bp1, bp2, bp3, bp4, curviness=1.0, zrot=None, startkey=None, stopkey=None, method='corrected_quaternion', chain=0)

Bases: PlottableSequence

Inherits from PlottableSequence

Link two histones together via a cubic spline

linker = SplineLinker(bp1, bp2, bp3, bp4, curviness=1., zrot=None)

Create base pairs that link to sections of DNA as follows: bp1 bp2 <==== LINKER =====> bp3 bp4 Two base pairs on either side of the linker are needed to build splines low curviness = straighter high_curviness = smoother

startkey and stopkey act as keyframes for rotations

Parameters:
  • zrot (Optional[float]) –

    Describes the twist of bp3 relative to bp2
    • None: Determine automatically (experimental)

    • double: rotation in radians (mod 2*pi)

  • startkey (Optional[int]) –

    Starting keyframe for rotations
    • key = i will start/stop rotations after the i-th base pair

    • key = -i will start/stop rotations after the i-th last base pair

  • stopkey (Optional[int]) –

    Ending keyframe for rotations
    • key = i will start/stop rotations after the i-th base pair

    • key = -i will start/stop rotations after the i-th last base pair

  • method (str) –

    Method to handle rotational interpolation
    • ”quaternion”: Full use of quaternions

    • ”corrected_quaternion”: Full use of quaternions, with a correction to check that the base pair is aligned. This method is recommended

    • ”matrix”: Experimental method that doesn’t use quaternions. Currently incorrect.

  • chain (int) – Chain index assigned to linker and basepairs created therein

__init__(bp1, bp2, bp3, bp4, curviness=1.0, zrot=None, startkey=None, stopkey=None, method='corrected_quaternion', chain=0)

Constructor

Methods

__init__(bp1, bp2, bp3, bp4[, curviness, ...])

Constructor

setChain(chainIdx)

Set the Chain Index of all base pairs in the histone

to_frame([suppress_hash])

Return the molecules as a pandas data frame

to_line_plot([size])

Return a mayavi figure instance with histone and linkers shown

to_plot([plot_p, plot_b, plot_s])

Return a matplotlib.Figure instance with molecules plotted

to_strand_plot([plot_p, plot_b, plot_s, plot_bp])

Return a mayavi figure instance with strands plotted

to_surface_plot()

Plot the surfaces of each molecule in the chain.

to_text([seperator])

Return a description of the molecules in the chain as text

translate(translation)

Translate the histone spatially

Attributes

linker_bp_spacing

linker_rotation

setChain(chainIdx)

Set the Chain Index of all base pairs in the histone

Parameters:

chainIdx – Index for Chain

to_frame(suppress_hash=False)

Return the molecules as a pandas data frame

Parameters:

suppress_hash (bool) – Hide the hash in front of the ‘name’ column which is kept for compatibiilty with the Geant4 DNA simulation format

Return type:

DataFrame

Returns:

Pandas data frame with molecule information

to_line_plot(size=(400, 350))

Return a mayavi figure instance with histone and linkers shown

Parameters:

size (Tuple[int, int]) – Figure size (width, height)

Returns:

mayavi figure

Raises:

ImportError – MayaVi likely Not installed

to_plot(plot_p=True, plot_b=True, plot_s=True)

Return a matplotlib.Figure instance with molecules plotted

Parameters:
  • plot_p (bool) – Show Phosphates in plot

  • plot_b (bool) – Show Bases in plot

  • plot_s (bool) – Show sugars in plot

Return type:

Figure

Returns:

Matplotlib Figure

to_strand_plot(plot_p=True, plot_b=True, plot_s=True, plot_bp=False)

Return a mayavi figure instance with strands plotted

:param plot_p : plot phosphate strands :param plot_s : plot sugar strands :param plot_b : plot base strands :param plot_bp : join base pairs together

Returns:

Mayavi Figure

Raises:

ImportError – MayaVi not imported

to_surface_plot()

Plot the surfaces of each molecule in the chain. Avoid this with large chains, this assumes each molecule is an ellipse

Return type:

Figure

Returns:

Matplotlib figure (contour plot)

to_text(seperator=' ')

Return a description of the molecules in the chain as text

Parameters:

seperator (str) – column seperator

Return type:

str

translate(translation)

Translate the histone spatially

Parameters:

translation – 3-vector for translation