mdciao.contacts.per_traj_ctc

mdciao.contacts.per_traj_ctc(top, itraj, ctc_residxs_pairs, chunksize, stride, traj_idx, progressbar_dict=None, nchars_fname=None, **kwargs_mdcontacts)

Wrapper for mdtraj.compute_contacts for strided, chunked computation of contacts.

Input can be directly mdtraj.Trajectory objects or trajectory files on disk (e.g. xtcs, dcds etc)

You can fine-tune the computation itself using kwargs_mdcontacts

Prints out progress report while working

Parameters:
  • top (Topology)

  • itraj (Trajectory or filename)

  • ctc_residxs_pairs (iterable of pairs of residue indices) – Pairs of residue indices for which lower bounds will be computed

  • chunksize (int) – Size (in frames) of the “chunks” in which the contacts will be computed. Decrease the chunksize if you run into memory errors

  • stride (int) – Stride with which the contacts will be streamed over

  • traj_idx (int) – The index of the trajectory being computed. For completeness of the progress report

  • progressbar_dict (dict, default is None) – A managed dictionary containing managed variables that allow concurrent threads to report their progress when mdciao.contacts.trajs2ctcs has been called with more than one cpu. If None, no progress will be reported.

  • kwargs_mdcontacts – Optional keyword arguments to pass to mdtraj.contacts.

    If “scheme” is contained in kwargs_mdcontacts and scheme==COM, the distances between residue centers of mass will be computed.

    The optional parameters of are:

Other Parameters:
  • scheme ({‘ca’, ‘closest’, ‘closest-heavy’, ‘sidechain’, ‘sidechain-heavy’}) –

    scheme to determine the distance between two residues:
    ‘ca’distance between two residues is given by the distance

    between their alpha carbons

    ‘closest’distance is the closest distance between any

    two atoms in the residues

    ‘closest-heavy’distance is the closest distance between

    any two non-hydrogen atoms in the residues

    ‘sidechain’distance is the closest distance between any

    two atoms in residue sidechains. For glycine, ‘sidechain’ tries to use sidechain hydrogens first

    and if none are present fall back to any atom of the glycine.

    ‘sidechain-heavy’distance is the closest distance between

    any two non-hydrogen atoms in residue sidechains For glycine, ‘sidechain-heavy’ tries to fall back first to sidechain hydrogens and if none are present to any atom of the glycine.

  • ignore_nonprotein (bool) – When using contact==all, don’t compute contacts between “residues” which are not protein (i.e. do not contain an alpha carbon).

  • periodic (bool, default=True) – If periodic is True and the trajectory contains unitcell information, we will compute distances under the minimum image convention.

  • soft_min (bool, default=False) – If soft_min is true, we will use a diffrentiable version of the scheme. The exact expression used

    is d =

    rac{eta}{logsum_i{exp( rac{eta}{d_i}})} where

    beta is user parameter which defaults to 20nm. The expression we use is copied from the plumed mindist calculator. http://plumed.github.io/doc-v2.0/user-doc/html/mindist.html

  • soft_min_beta (float, default=20nm) – The value of beta to use for the soft_min distance option. Very large values might cause small contact distances to go to 0.

Returns:

  • ictcs, itime, iatps

  • ictcs (2D np.ndarray (Nframes, Nctcs), where Nctcs= len(ctc_residxs_pairs)) – time traces of the wanted contacts, in

  • itime (1D np.ndarray of len Nframes) – timestamps of the computed contacts

  • iatps (2D np.ndarray (Nframes, 2*Nctcs)) – atom-indices yielding distances in ictcs, helps dis-aggregate the residue interaction into backbone-backbone, backbone-sidechain, or sidechain-sidechain