moleculekit.interactions.interactions module#
- moleculekit.interactions.interactions.cationpi_calculate(mol, rings, cations, dist_threshold=5, angle_threshold_min=60, return_rings=False)#
Detect cation-pi interactions in each frame of a Molecule.
A cation-pi interaction is reported when a cation lies within dist_threshold of an aromatic ring centroid and the angle between the ring plane and the centroid-to-cation vector is above angle_threshold_min (i.e. the cation sits roughly above the ring face).
- Parameters:
mol (
Molecule) – The Molecule (one or more frames) in which to detect cation-pi interactions.rings (
listofnumpy.ndarray) – The aromatic rings, where each ring is an array of its atom indices, as returned by e.g.get_protein_rings()orget_ligand_rings().cations (
listornumpy.ndarray) – A 1D collection of cation atom indices, as returned by e.g.get_protein_charged()(positive indices),get_ligand_charged()orget_metal_charged().dist_threshold (
float) – The maximum centroid-to-cation distance in angstroms.angle_threshold_min (
float) – The minimum angle in degrees ([0, 90]) between the ring plane and the centroid-to-cation vector.return_rings (
bool) – If True, the first returned value contains the ring atom-index array for each interacting pair instead of the ring index into rings.
- Returns:
index_list (
list) – A list with one entry per frame. By default each entry is a list of[i, cation_idx]pairs, whereiindexes into rings andcation_idxis the cation atom index. If return_rings is True, each entry is instead a list of[ring_atoms, cation_idx]pairs.dist_ang_list (
list) – A list with one entry per frame, each a list of[distance, angle]pairs (centroid-to-cation distance in angstroms and angle in degrees) aligned with index_list.
- moleculekit.interactions.interactions.filter_props(props, exclude_idx=None, include_idx=None)#
Remove atoms from the properties based on their index
- moleculekit.interactions.interactions.get_donors_acceptors(mol, exclude_water=True, exclude_backbone=False)#
- moleculekit.interactions.interactions.get_ligand_aryl_halides(sm, start_idx=0)#
- moleculekit.interactions.interactions.get_ligand_charged(sm, start_idx=0)#
- moleculekit.interactions.interactions.get_ligand_donors_acceptors(smol, start_idx=0)#
- moleculekit.interactions.interactions.get_ligand_props(mol, offset_idx=0)#
- moleculekit.interactions.interactions.get_ligand_rings(sm, start_idx=0)#
- moleculekit.interactions.interactions.get_metal_charged(mol)#
- moleculekit.interactions.interactions.get_nucleic_charged(mol)#
- moleculekit.interactions.interactions.get_nucleic_rings(mol)#
- moleculekit.interactions.interactions.get_protein_aryl_halides(mol)#
- moleculekit.interactions.interactions.get_protein_charged(mol)#
- moleculekit.interactions.interactions.get_protein_rings(mol)#
- moleculekit.interactions.interactions.get_receptor_props(mol)#
- moleculekit.interactions.interactions.get_receptor_rings(mol, rec_type)#
- moleculekit.interactions.interactions.hbonds_calculate(mol, donors, acceptors, sel1='all', sel2=None, dist_threshold=2.5, angle_threshold=120, ignore_hs=False)#
Detect hydrogen bonds in each frame of a Molecule.
A hydrogen bond is reported when a donor hydrogen lies within dist_threshold of an acceptor atom and the donor-heavy / hydrogen / acceptor angle is greater than angle_threshold.
- Parameters:
mol (
Molecule) – The Molecule (one or more frames) in which to detect hydrogen bonds. Itsboxmust have the same number of frames as itscoords.donors (
ndarray) – An array of shape (n_donors, 2) of donor pairs, where each row holds the index of the donor heavy atom and the index of its bonded hydrogen, as returned byget_donors_acceptors()orget_ligand_donors_acceptors().acceptors (
ndarray) – A 1D array of acceptor atom indices.sel1 (
str|ndarray) – An atom selection string, a boolean mask, or an integer index array for the first group of atoms taking part in the hydrogen bonds. See more here.sel2 (
str|ndarray|None) – An atom selection string, a boolean mask, or an integer index array for the second group of atoms taking part in the hydrogen bonds. If None, sel1 is used for both groups and only intra-selection hydrogen bonds are computed.dist_threshold (
float) – The maximum hydrogen-to-acceptor distance in angstroms for a hydrogen bond.angle_threshold (
float) – The minimum donor-hydrogen-acceptor angle in degrees for a hydrogen bond.ignore_hs (
bool) – If True, hydrogens are ignored and only the donor heavy atoms are used, with distances measured between donor heavy atoms and acceptors. The reported hydrogen index will be -1 in this case.
- Returns:
hbonds – A list with one entry per frame of mol. Each entry is an array of shape (n_hbonds, 3) where each row holds the indices of the donor heavy atom, the donor hydrogen (or -1 if ignore_hs is True) and the acceptor atom.
- Return type:
- moleculekit.interactions.interactions.hydrophobic_calculate(mol, sel1, sel2, dist_threshold=4.0)#
Detect hydrophobic contacts in each frame of a Molecule.
A hydrophobic contact is reported when a carbon atom in sel1 lies within dist_threshold of a carbon atom in sel2. Both selections are intersected with the carbon atoms of the molecule before computing contacts.
- Parameters:
mol (
Molecule) – The Molecule (one or more frames) in which to detect hydrophobic contacts.sel1 (
str|ndarray) – An atom selection string, a boolean mask, or an integer index array for the first group of atoms. See more here.sel2 (
str|ndarray) – An atom selection string, a boolean mask, or an integer index array for the second group of atoms.dist_threshold (
float) – The maximum carbon-to-carbon distance in angstroms.
- Returns:
contacts – A list with one entry per frame of mol. Each entry is an array of shape (n_contacts, 2) of carbon atom-index pairs in contact.
- Return type:
- moleculekit.interactions.interactions.metal_coordination_calculate(mol, sel1, sel2, dist_threshold=3.5)#
Detect metal coordination contacts in each frame of a Molecule.
A metal coordination contact is reported when a metal atom lies within dist_threshold of a coordinating atom (one of N, O, S or a halogen). Contacts are detected in both directions: metals in sel1 against coordinating atoms in sel2, and coordinating atoms in sel1 against metals in sel2.
- Parameters:
mol (
Molecule) – The Molecule (one or more frames) in which to detect metal coordination.sel1 (
str|ndarray) – An atom selection string, a boolean mask, or an integer index array for the first group of atoms. See more here.sel2 (
str|ndarray) – An atom selection string, a boolean mask, or an integer index array for the second group of atoms.dist_threshold (
float) – The maximum metal-to-coordinating-atom distance in angstroms.
- Returns:
contacts – A list with one entry per frame of mol. Each entry is an array of shape (n_contacts, 2) of atom-index pairs in coordination contact.
- Return type:
- moleculekit.interactions.interactions.offset_ligand_props(props, offset_idx=0, idx_mapping_fn=None)#
- moleculekit.interactions.interactions.pipi_calculate(mol, rings1, rings2, dist_threshold1=4.4, angle_threshold1_max=30, dist_threshold2=5.5, angle_threshold2_min=60, return_rings=False)#
Detect pi-pi (aromatic ring stacking) interactions in each frame of a Molecule.
A pi-pi interaction is reported when the distance between two ring centroids and the angle between the two ring planes satisfy one of two criteria, which together capture both parallel (sandwich/offset-stacked) and perpendicular (T-shaped) arrangements:
centroid distance below dist_threshold1 and inter-plane angle below angle_threshold1_max (near-parallel stacking), or
centroid distance below dist_threshold2 and inter-plane angle above angle_threshold2_min (near-perpendicular / T-shaped).
- Parameters:
mol (
Molecule) – The Molecule (one or more frames) in which to detect pi-pi interactions.rings1 (
listofnumpy.ndarray) – The first group of aromatic rings, where each ring is an array of its atom indices, as returned by e.g.get_protein_rings()orget_ligand_rings().rings2 (
listofnumpy.ndarray) – The second group of aromatic rings, in the same format as rings1.dist_threshold1 (
float) – The maximum centroid-to-centroid distance in angstroms for the near-parallel criterion.angle_threshold1_max (
float) – The maximum inter-plane angle in degrees ([0, 90]) for the near-parallel criterion.dist_threshold2 (
float) – The maximum centroid-to-centroid distance in angstroms for the near-perpendicular criterion.angle_threshold2_min (
float) – The minimum inter-plane angle in degrees ([0, 90]) for the near-perpendicular criterion.return_rings (
bool) – If True, the first returned value contains the ring atom-index arrays for each interacting pair instead of the ring indices into rings1/rings2.
- Returns:
pp_list (
list) – A list with one entry per frame. By default each entry is a list of[i, j]pairs, whereiindexes into rings1 andjindexes into rings2. If return_rings is True, each entry is instead a list of[ring1_atoms, ring2_atoms]pairs holding the atom-index arrays of the two interacting rings.dist_ang_list (
list) – A list with one entry per frame, each a list of[distance, angle]pairs (centroid distance in angstroms and inter-plane angle in degrees) aligned with pp_list.
- moleculekit.interactions.interactions.saltbridge_calculate(mol, pos, neg, sel1='all', sel2=None, threshold=4)#
Detect salt bridges (charged contacts) in each frame of a Molecule.
A salt bridge is reported when a positively charged atom and a negatively charged atom lie within threshold of each other. Each reported pair contains exactly one positive and one negative atom.
- Parameters:
mol (
Molecule) – The Molecule (one or more frames) in which to detect salt bridges.pos (
ndarray) – A 1D array of positively charged atom indices, as returned by e.g.get_protein_charged()orget_ligand_charged().neg (
ndarray) – A 1D array of negatively charged atom indices.sel1 (
str|ndarray) – An atom selection string, a boolean mask, or an integer index array for the first group of atoms taking part in the salt bridges. See more here.sel2 (
str|ndarray|None) – An atom selection string, a boolean mask, or an integer index array for the second group of atoms. If None, sel1 is used for both groups.threshold (
float) – The maximum distance in angstroms between the two charged atoms.
- Returns:
salt_bridges – A list with one entry per frame of mol. Each entry is an array of shape (n_bridges, 2) of atom-index pairs forming a salt bridge.
- Return type:
- moleculekit.interactions.interactions.sigmahole_calculate(mol, rings, halides, dist_threshold=4.5, angle_threshold_min=60, return_rings=False)#
Detect sigma-hole (halogen-pi) interactions in each frame of a Molecule.
A sigma-hole interaction is reported when an aryl-halide halogen lies within dist_threshold of an aromatic ring centroid and the angle between the ring plane and the centroid-to-halogen vector is above angle_threshold_min.
- Parameters:
mol (
Molecule) – The Molecule (one or more frames) in which to detect sigma-hole interactions.rings (
listofnumpy.ndarray) – The aromatic rings, where each ring is an array of its atom indices, as returned by e.g.get_protein_rings()orget_ligand_rings().halides (
numpy.ndarray) – An array of shape (n_halides, 2) of aryl-halide bonds (halogen atom index, bonded ring carbon index), as returned byget_ligand_aryl_halides().dist_threshold (
float) – The maximum centroid-to-halogen distance in angstroms.angle_threshold_min (
float) – The minimum angle in degrees ([0, 90]) between the ring plane and the centroid-to-halogen vector.return_rings (
bool) – If True, the first returned value contains the ring atom-index array for each interacting pair instead of the ring index into rings.
- Returns:
index_list (
list) – A list with one entry per frame. By default each entry is a list of[i, halogen_idx]pairs, whereiindexes into rings andhalogen_idxis the halogen atom index. If return_rings is True, each entry is instead a list of[ring_atoms, halogen_idx]pairs.dist_ang_list (
list) – A list with one entry per frame, each a list of[distance, angle]pairs (centroid-to-halogen distance in angstroms and angle in degrees) aligned with index_list.
- moleculekit.interactions.interactions.view_hbonds(mol, hbonds)#
- moleculekit.interactions.interactions.waterbridge_calculate(mol, donors, acceptors, sel1, sel2, order=1, dist_threshold=2.5, angle_threshold=120, ignore_hs=False)#
Detect water-mediated hydrogen-bond bridges between two selections.
A water bridge is a chain of hydrogen bonds that connects an atom in sel1 to an atom in sel2 through one or more intervening water molecules. The chain of hydrogen bonds is built by iteratively detecting hydrogen bonds (see
hbonds_calculate()) starting from sel1, hopping through waters, and a network is then searched for paths whose intermediate atoms are all water.- Parameters:
mol (
Molecule) – The Molecule (one or more frames) in which to detect water bridges. It must contain the waters that can mediate the bridges.donors (
ndarray) – An array of shape (n_donors, 2) of donor pairs (donor heavy atom index, bonded hydrogen index), as returned byget_donors_acceptors(). The waters must not be excluded (i.e. call it withexclude_water=False).acceptors (
ndarray) – A 1D array of acceptor atom indices, including water acceptors.sel1 (
str|ndarray) – An atom selection string, a boolean mask, or an integer index array for the source group of atoms (one end of the bridge). See more here.sel2 (
str|ndarray) – An atom selection string, a boolean mask, or an integer index array for the target group of atoms (other end of the bridge).order (
int) – The maximum number of bridging water molecules allowed between sel1 and sel2.order=1finds bridges through a single water,order=2finds bridges through up to two waters, and so on.dist_threshold (
float) – The maximum hydrogen-to-acceptor distance in angstroms for each hydrogen bond in the bridge.angle_threshold (
float) – The minimum donor-hydrogen-acceptor angle in degrees for each hydrogen bond in the bridge.ignore_hs (
bool) – If True, hydrogens are ignored and the bridge paths are expressed in terms of donor/acceptor heavy atoms only.
- Returns:
water_bridges – A list with one entry per frame of mol. Each frame entry is a list of bridges, where each bridge is a list of atom indices describing the path from a sel1 atom to a sel2 atom; every intermediate atom in the path belongs to a water molecule.
- Return type: