API Documentation

class helanal.helanal.HELANAL(universe, select='name CA', ref_axis=[0, 0, 1], verbose=False, flatten_single_helix=True, split_residue_sequences=True)[source]

Bases: AnalysisBase

Perform HELANAL helix analysis on your trajectory.

Parameters:
  • universe (Universe or AtomGroup) – The Universe or AtomGroup to apply the analysis to.

  • select (str or iterable of str, optional) – The selection string to create an atom selection that the HELANAL analysis is applied to. Note that HELANAL is designed to work on the alpha-carbon atoms of protein residues. If you pass in multiple selections, the selections will be analysed separately.

  • ref_axis (array-like of length 3, optional) – The reference axis used to calculate the tilt of the vector of best fit, and the local screw angles.

  • flatten_single_helix (bool, optional) – Whether to flatten results if only one selection is passed.

  • split_residue_sequences (bool, optional) – Whether to split the residue sequence into individual helices. This keyword only applies if a residue gap is present in the AtomGroup generated by a select string. If False, the residues will be analysed as a single helix. If True, each group of consecutive residues will be treated as a separate helix.

  • verbose (bool, optional) – Turn on more logging and debugging.

Variables:
  • results.local_twists (array or list of arrays) – The local twist angle from atom i+1 to i+2. Each array has shape (n_frames, n_residues-3)

  • results.local_nres_per_turn (array or list of arrays) – Number of residues per turn, based on local_twist. Each array has shape (n_frames, n_residues-3)

  • results.local_axes (array or list of arrays) – The length-wise helix axis of the local window. Each array has shape (n_frames, n_residues-3, 3)

  • results.local_heights (array or list of arrays) – The rise of each local helix. Each array has shape (n_frames, n_residues-3)

  • results.local_helix_directions (array or list of arrays) – The unit vector from each local origin to atom i+1. Each array has shape (n_frames, n_residues-2, 3)

  • results.local_origins (array or list of arrays) – The projected origin for each helix. Each array has shape (n_frames, n_residues-2, 3)

  • results.local_screw_angles (array or list of arrays) – The local screw angle for each helix. Each array has shape (n_frames, n_residues-2)

  • results.local_bends (array or list of arrays) – The angles between local helix axes, 3 windows apart. Each array has shape (n_frames, n_residues-6)

  • results.all_bends (array or list of arrays) – The angles between local helix axes. Each array has shape (n_frames, n_residues-3, n_residues-3)

  • results.global_axis (array or list of arrays) – The length-wise axis for the overall helix. This points at the first helix window in the helix, so it runs opposite to the direction of the residue numbers. Each array has shape (n_frames, 3)

  • results.global_tilts (array or list of arrays) – The angle between the global axis and the reference axis. Each array has shape (n_frames,)

  • results.summary (dict or list of dicts) – Summary of stats for each property: the mean, the sample standard deviation, and the mean absolute deviation.

run(start=None, stop=None, step=None, frames=None, verbose=None, *, progressbar_kwargs={})

Perform the calculation

Parameters:
  • start (int, optional) – start frame of analysis

  • stop (int, optional) – stop frame of analysis

  • step (int, optional) – number of frames to skip between each analysed frame

  • frames (array_like, optional) – array of integers or booleans to slice trajectory; frames can only be used instead of start, stop, and step. Setting both frames and at least one of start, stop, step to a non-default value will raise a ValueError.

    Added in version 2.2.0.

  • verbose (bool, optional) – Turn on verbosity

  • progressbar_kwargs (dict, optional) – ProgressBar keywords with custom parameters regarding progress bar position, etc; see MDAnalysis.lib.log.ProgressBar for full list.

Changed in version 2.2.0: Added ability to analyze arbitrary frames by passing a list of frame indices in the frames keyword argument.

Changed in version 2.5.0: Add progressbar_kwargs parameter, allowing to modify description, position etc of tqdm progressbars

universe_from_origins()[source]

Create MDAnalysis Universe from the local origins.

Return type:

Universe or list of Universes

helanal.helanal.helix_analysis(positions, ref_axis=[0, 0, 1])[source]

Calculate helix properties from atomic coordinates.

Each property is calculated from a sliding window of 4 atoms, from i to i+3. Any property whose name begins with ‘local’ is a property of a sliding window.

Parameters:
  • positions (numpy.ndarray of shape (N, 3)) – Atomic coordinates.

  • ref_axis (array-like of length 3, optional) – The reference axis used to calculate the tilt of the vector of best fit, and the local screw angles.

Returns:

local_twistsarray, shape (N-3,)

local twist angle from atom i+1 to i+2

local_nres_per_turnarray, shape (N-3,)

number of residues per turn, based on local_twist

local_axesarray, shape (N-3, 3)

the length-wise helix axis of the local window

local_bendsarray, shape (N-6,)

the angles between local helix angles, 3 windows apart

local_heightsarray, shape (N-3,)

the rise of each local helix

local_helix_directionsarray, shape (N-2, 3)

the unit vector from each local origin to atom i+1

local_originsarray, shape (N-2, 3)

the projected origin for each helix

all_bendsarray, shape (N-3, N-3)

angles between each local axis

global_axisarray, shape (3,)

vector of best fit through origins, pointing at the first origin.

local_screw_anglesarray, shape (N-2,)

cylindrical azimuth angle to plane of global_axis and ref_axis

Return type:

dict with the following keys

helanal.helanal.local_screw_angles(global_axis, ref_axis, helix_directions)[source]

Cylindrical azimuth angles between the local direction vectors, as projected onto the cross-section of the helix, from (-pi, pi]. The origin (angle=0) is set to the plane of global_axis and ref_axis.

Parameters:
  • global_axis (numpy.ndarray of shape (3,)) – Vector of best fit. Screw angles are calculated perpendicular to this axis.

  • ref_axis (numpy.ndarray of shape (3,)) – Reference length-wise axis. One of the reference vectors is orthogonal to this axis.

  • helix_directions (numpy.ndarray of shape (N, 3)) – array of vectors representing the local direction of each helix window.

Returns:

Array of screw angles.

Return type:

numpy.ndarray of shape (N,)

helanal.helanal.vector_of_best_fit(coordinates)[source]

Fit vector through the centered coordinates, pointing to the first coordinate (i.e. upside-down).

Parameters:

coordinates (numpy.ndarray of shape (N, 3))

Returns:

Vector of best fit.

Return type:

numpy.ndarray of shape (3,)