pylipid.func.cal_contact_residues

pylipid.func.cal_contact_residues(dist_matrix, cutoff)[source]

Obtain contact residues as a function of time.

This function takes a distance matrix that records the measured distance for molecules at each trajectory frame, then returns the indices of molecules the distance of which are smaller than the provided cutoff at each frame. It also returns the molecule indices the frame indices in which the molecule is within the cutoff.

Parameters
  • dist_matrix (list or numpy.ndarray, shape=(n_residues, n_frames)) – The measured distance for molecules at each trajectory frame.

  • cutoff (scalar) – The distance cutoff to define a contact. A distance to the target equal or lower to the cutoff is considered as in contact.

Returns

  • contact_list (list) – A list that records the indices of molecules that are within the given cutoff in each frame

  • frame_id_set (list) – A list of frame indices for contacting molecules.

  • residue_id_set (lsit) – A list of contacting molecules indices.

Examples

>>> dr0 = [0.9, 0.95, 1.2, 1.1, 1.0, 0.9] # the distances of R0 to the target as a function of time
>>> dr1 = [0.95, 0.9, 0.95, 1.1, 1.2, 1.1] # the distances of R1
>>> dr2 = [0.90, 0.90, 0.85, 0.95, 1.0, 1.1] # the distances of R2
>>> dist_matrix = [dr0, dr1, dr2]
>>> contact_list, frame_id_set, residue_id_set = cal_contact_residues(dist_matrix, 1.0)
>>> print(contact_list)
[[0, 1, 2], [0, 1, 2], [1, 2], [2], [0, 2], [0]]
>>> print(frame_id_set)
array([0, 1, 4, 5, 0, 1, 2, 0, 1, 2, 3, 4])
>>> print(residue_id_set)
array([0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 2])