contact_map.DaskContactFrequency

class contact_map.DaskContactFrequency(client, filename, query=None, haystack=None, cutoff=0.45, n_neighbors_ignored=2, **kwargs)[source]

Dask-based parallelization of contact frequency.

The contact frequency is the fraction of a trajectory that a contact is made. See ContactFrequency for details. This implementation parallelizes the contact frequency calculation using dask.distributed, which must be installed separately to use this object.

Notes

The interface for this object closely mimics that of the ContactFrequency object, with the addition requiring the dask.distributed.Client as input. However, there is one important difference. Whereas ContactFrequency takes an mdtraj.Trajectory object as input, DaskContactFrequency takes a file name, plus any extra kwargs that MDTraj needs to load the file.

Parameters
  • client (dask.distributed.Client) – Client object connected to the dask network.

  • filename (str) – Name of the file where the trajectory is located. File must be accessible by all workers in the dask network.

  • query (list of int) – Indices of the atoms to be included as query. Default None means all atoms.

  • haystack (list of int) – Indices of the atoms to be included as haystack. Default None means all atoms.

  • cutoff (float) – Cutoff distance for contacts, in nanometers. Default 0.45.

  • n_neighbors_ignored (int) – Number of neighboring residues (in the same chain) to ignore. Default 2.

__init__(client, filename, query=None, haystack=None, cutoff=0.45, n_neighbors_ignored=2, **kwargs)[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(client, filename[, query, …])

Initialize self.

add_contact_frequency(other)

Add results from other to the internal counter.

contact_map(trajectory, frame_number, …)

Returns atom and residue contact maps for the given frame.

convert_atom_contacts(atom_contacts)

from_dict(dct)

Create object from dict.

from_file(filename)

Load this object from a given file

from_json(json_string)

Create object from JSON string

idx_to_s_idx(idx)

function to convert a real atom index to a sliced one

most_common_atoms_for_contact(contact_pair)

Most common atom contacts for a given residue contact pair

most_common_atoms_for_residue(residue)

Most common atom contact pairs for contacts with the given residue

s_idx_to_idx(idx)

function to convert a sliced atom index back to real index

save_to_file(filename[, mode])

Save this object to the given file.

slice_trajectory(trajectory)

subtract_contact_frequency(other)

Subtracts results from other from internal counter.

to_dict()

Convert object to a dict.

to_json()

JSON-serialized version of this object.

Attributes

all_atoms

all atom indices used in the contact map

atom_contacts

Atoms pairs mapped to fraction of trajectory with that contact

contacts

contact dict for these contacts

cutoff

cutoff distance for contacts, in nanometers

haystack

indices of atoms to include as haystack

haystack_residue_range

min and (max + 1) of haystack residue indices

haystack_residues

residues for atoms in the haystack

n_frames

Number of frames in the mapped trajectory

n_neighbors_ignored

number of neighbor residues (in same chain) to ignore

parameters

query

indices of atoms to include as query

query_residue_range

min and (max + 1) of query residue indices

query_residues

residues for atoms in the query

residue_contacts

Residue pairs mapped to fraction of trajectory with that contact

residue_ignore_atom_idxs

maps query residue index to atom indices to ignore

residue_query_atom_idxs

maps query residue index to atom indices in query

run_info

topology

mdtraj.Topology: topology object for this system

use_atom_slice

Indicates if mdtraj.atom_slice() is used before calculating the contact map