luna.interaction.filter module

class BindingModeCondition(condition)[source]

Bases: object

Define binding mode conditions to filter interactions.

Parameters

condition (str) – A string defining which chains, compounds, or atoms should be accepted. If condition is the wildcard ‘*’, then all chains, compounds, and atoms will be considered valid. Otherwise, condition should have the format ‘<CHAIN ID>/<COMPOUND NAME>/<COMPOUND NUMBER>/<ATOM>’. Wildcards are accepted for each one of these fields. For example:

  • ‘*/HIS/*/*’: represents all histidines’ atoms from all chains.

  • ‘A/CBL/*/*’ represents all ligands named CBL from chain A.

  • ‘B/HIS/*/N*’ represents all histidines’ nitrogens from chain B.

Variables
  • ~BindingModeCondition.accept_all (bool) – If True, all chains, compounds, and atoms will be considered valid.

  • ~BindingModeCondition.accept_all_chains (bool) – If True, all chains will be considered valid.

  • ~BindingModeCondition.accept_all_comps (bool) – If True, all compound names will be considered valid.

  • ~BindingModeCondition.accept_all_comp_nums (bool) – If True, all compound numbers (residue sequence number in the PDB format) will be considered valid.

  • ~BindingModeCondition.accept_all_atoms (bool) – If True, all atoms will be considered valid.

  • ~BindingModeCondition.chain_id (str or None) – If provided, accept only chains whose id matches chain_id.

  • ~BindingModeCondition.comp_name (str or None) – If provided, accept only compounds whose name matches comp_name.

  • ~BindingModeCondition.comp_num (int or None) – If provided, accept only compounds whose sequence number matches comp_num.

  • ~BindingModeCondition.comp_icode (str or None) – If provided, accept only compounds whose insertion code matches comp_icode.

  • ~BindingModeCondition.atom (str or None) – If provided, accept only atoms whose name matches atom.

is_valid(atm_grp)[source]

Check if an atom group is valid or not based on this condition.

atm_grp : luna.mol.groups.AtomGroup

class BindingModeFilter(config)[source]

Bases: object

Filter interactions based on a set of binding mode conditions.

Parameters

config (dict of {str : iterable}) – A dict defining binding modes and how interactions should be validated. Each key represents an interaction type and values are an iterable of BindingModeCondition instances.

classmethod from_config_file(config_file)[source]

Initialize from a configuration file.

Parameters

``config_file`` (str) – The configuration file pathname.

Return type

BindingModeFilter

Examples

It follows an example of a configuration file:

; To configurate an interaction type, create a new line and define the interaction: [New interaction].
; Then you can define whether or not all interactions must be accepted by setting 'accept_only' to True or False.

; If you want to specify binding modes, use the variable 'accept_only', which expects a list of strings             in the format: <CHAIN ID>/<COMPOUND NAME>/<COMPOUND NUMBER>/<ATOM>
; Wildcards are accepted for the expected fields.
; For example, "*/HIS/*/*" represents all histidines' atoms from all chains.
;               "A/CBL/*/*" represents all ligands named CBL from chain A.
;               "B/HIS/*/N*" represents all histidines' nitrogens from chain B.

[Hydrogen bond]
accept_only=["A/LYS/245/*", "*/HIS/*/*"]

[Hydrophobic]
accept_all=True

[Cation-pi]
accept_only=["*"]
accept_all=False

[Weak hydrogen bond]
accept_all=False
accept_only=["*/THR/434/O*"]

[Face-to-edge pi-stacking]
accept_all=False

[Aromatic stacking]
accept_all=True

[*]
accept_all=False
is_valid(inter)[source]

Check if an interaction is valid or not based on this binding mode configuration.

inter : luna.interaction.type.InteractionType

class InteractionFilter(ignore_self_inter=True, ignore_intra_chain=True, ignore_inter_chain=True, ignore_res_res=True, ignore_res_nucl=True, ignore_res_hetatm=True, ignore_nucl_nucl=True, ignore_nucl_hetatm=True, ignore_hetatm_hetatm=True, ignore_h2o_h2o=True, ignore_any_h2o=False, ignore_multi_comps=False, ignore_mixed_class=False)[source]

Bases: object

Filter interactions based on their components.

Parameters
  • ignore_self_inter (bool) – If True, ignore interactions involving atoms of the same compound.

  • ignore_intra_chain (bool) – If True, ignore intra-chain interactions (e.g., interactions between residues in the same protein chain).

  • ignore_inter_chain (bool) – If True, ignore interactions between different chains.

  • ignore_res_res (bool) – If True, ignore residue-residue interactions.

  • ignore_res_nucl (bool) – If True, ignore residue-nucleotide interactions.

  • ignore_res_hetatm (bool) – If True, ignore residue-ligand interactions.

  • ignore_nucl_nucl (bool) – If True, ignore nucleotide-nucleotide interactions.

  • ignore_nucl_hetatm (bool) – If True, ignore nucleotide-ligand interactions.

  • ignore_hetatm_hetatm (bool) – If True, ignore ligand-ligand interactions.

  • ignore_h2o_h2o (bool) – If True, ignore water-water interactions.

  • ignore_any_h2o (bool) – If True, ignore all interactions involving water.

  • ignore_multi_comps (bool) – If True, ignore interactions established by atom groups composed of multiple compounds (e.g.: amides formed by peptide bonds involve two residues).

  • ignore_mixed_class (bool) – If True, ignore interactions established by atom groups comprising mixed compound classes (e.g. residues and ligands bound by a covalent bond).

is_valid_pair(src_grp, trgt_grp)[source]

Evaluate if a pair of atom groups are valid according to the flags defined in this class.

src_grp, trgt_grp : luna.mol.groups.AtomGroup

classmethod new_nli_filter(ignore_nucl_hetatm=False, ignore_hetatm_hetatm=False, ignore_any_h2o=False, ignore_self_inter=False, **kwargs)[source]

Initialize the default filter for nucleotide-ligand interactions.

Return type

InteractionFilter

classmethod new_nni_filter(ignore_nucl_nucl=False, ignore_inter_chain=False, ignore_intra_chain=False, ignore_any_h2o=False, ignore_self_inter=False, **kwargs)[source]

Initialize the default filter for nucleotide-nucleotide interactions.

Return type

InteractionFilter

classmethod new_pli_filter(ignore_res_hetatm=False, ignore_hetatm_hetatm=False, ignore_any_h2o=False, ignore_self_inter=False, **kwargs)[source]

Initialize the default filter for protein-ligand interactions.

Return type

InteractionFilter

classmethod new_pni_filter(ignore_res_nucl=False, ignore_inter_chain=False, ignore_intra_chain=False, ignore_any_h2o=False, ignore_self_inter=False, **kwargs)[source]

Initialize the default filter for protein-nucleotide interactions.

Return type

InteractionFilter

classmethod new_ppi_filter(ignore_res_res=False, ignore_inter_chain=False, ignore_intra_chain=False, ignore_any_h2o=False, ignore_self_inter=False, **kwargs)[source]

Initialize the default filter for protein-protein interactions.

Return type

InteractionFilter