torch_pgn.graphs package
Submodules
torch_pgn.graphs.graph_utils module
torch_pgn.graphs.proximal_residues module
- torch_pgn.graphs.proximal_residues.extract_cross_edges(protein_atoms, ligand_atoms)
Creates a set of cross edges formatted in pytorch geometric compatible format. :param protein_atoms: Numpy atom_dict of the form output by get_interacting atoms (see close_contract documentation for ODDT: https://oddt.readthedocs.io/en/0.1.1/rst/oddt.html) for the interaction protein atoms :param ligand_atoms: Numpy atom_dict of the form output by get_interacting atoms (see close_contract documentation for ODDT: https://oddt.readthedocs.io/en/0.1.1/rst/oddt.html) for the interaction ligand atoms :return: A numpy array of edge formatted for pytorch. Format is [[s1, s2, s3...], [d1, d2, d3, ...]]. All source vertices will be in the ligand and all dest vectices will be in protein. Final processing will be done in order to make graph undirected if desired. And have correct numbering
- torch_pgn.graphs.proximal_residues.get_interacting_atoms(ligand, protein, distance_cutoff=4.5, ignore_hoh=True)
Protein ligand interacting atom extractor. Takes a ligand and protein pair and uses the built in ODDT functions to output the interacting residue. NOTE: The exact format needs to be decided on in order to be as general as possible. Will start with just being a helped function and the exact form can be finalized as the MPNN frameworks become more clear. :param ligand: oddt.toolkit.Molecule object
Molecules, which are analysed in order to find interactions.
- Parameters:
protein -- oddt.toolkit.Molecule object Molecules, which are analysed in order to find interactions.
distance_cutoff -- float (default=4.5) Cutoff distance for close contacts.
ignore_hoh -- bool (default = True) Should the water molecules be ignored. This is based on the name of the residue ('HOH').
- Returns:
???? (Probably start with the interacting residues for testing and then move on for there (Need to figure this out.)
- torch_pgn.graphs.proximal_residues.get_molecule_graph(molecule, molecule_atoms, depth=1)
Constructs the ligand portion of the interaction graph (intra-ligand edges and nodes) and returns them as a set of node index values and an edge array. :param molecule: oddt.toolkit.Molecule object
Molecule, which are analysed in order to find interactions.
- Parameters:
molecule_atoms -- The molecule atoms involved in an interaction with the interaction partner formatted as a
numpy atom_dict (See https://oddt.readthedocs.io/en/0.1.1/rst/oddt.html) :param depth: The depth away from interacting atoms to go in the molecular graph to construct the final interaction graph. i.e. if molecule atom 5 is interacting and has neighbors 3, and 4 that don't interact, if the depth is == 1 then 3 and 4 will not be included in the interaction graph if depth is == 2 then both 3 and 4 will be added to the interaction graph. For depth > 2 this process is repeated iteratively for the new atoms added to the interaction graph. If depth == 0 no intra-molecule edges will be added. (This may be a poor initial choice, but it seems like this may be the best approximation to PLEC) :return: nodes, edges:
nodes = a set() of nodes to be included in the interaction graph. edges = A numpy array of edge formatted for pytorch. Format is [[s1, s2, s3...], [d1, d2, d3, ...]]. All edges will be bidirectional i.e. iff i -> j exists j -> i exists.
- torch_pgn.graphs.proximal_residues.get_proximal_atoms(ligand, protein, distance_cutoff=4.5, ignore_hoh=True)
Protein ligand interacting atom extractor. Takes a ligand and protein pair and uses the built in ODDT functions to output the interacting residue. NOTE: The exact format needs to be decided on in order to be as general as possible. Will start with just being a helped function and the exact form can be finalized as the MPNN frameworks become more clear. :param ligand: oddt.toolkit.Molecule object
Molecules, which are analysed in order to find interactions.
- Parameters:
protein -- oddt.toolkit.Molecule object Molecules, which are analysed in order to find interactions.
distance_cutoff -- float (default=4.5) Cutoff distance for close contacts.
ignore_hoh -- bool (default = True) Should the water molecules be ignored. This is based on the name of the residue ('HOH').
- Returns:
???? (Probably start with the interacting residues for testing and then move on for there (Need to figure this out.)
torch_pgn.graphs.proximity_graph module
- torch_pgn.graphs.proximity_graph.yield_full_interaction_graph(ligand, protein, name, distance_cutoff=4.5, lig_depth=2, receptor_depth=4, ignore_hoh=True, visualize=False)
Takes in the receptor and the docked ligand and produces a graph working_data. :param ligand: oddt.toolkit.Molecule object
Molecules, which are analysed in order to find interactions.
- Parameters:
protein -- oddt.toolkit.Molecule object Molecules, which are analysed in order to find interactions.
distance_cutoff -- float (default=4.5) Cutoff distance for close contacts.
ignore_hoh -- bool (default = True) Should the water molecules be ignored. This is based on the name of the residue ('HOH').
visualize -- whether to visualize the final output graph using matplotlib projection into 2d space
maintain_lig -- If True the entire ligand will be maintained regardless of atom proximity. Otherwise the ligand
will be allowed to fragment based on the proximity graph. :return: A networkx graph of featurized nodes and edges representing the interaction of the protein and ligand.
- torch_pgn.graphs.proximity_graph.yield_tree_reduction(ligand, protein, name, distance_cutoff=4.5, lig_depth=2, receptor_depth=4, ignore_hoh=True, visualize=False, local_connect=True)
Takes in the receptor and the docked ligand and produces a tree version of this working_data. Calculated using Kruskal's and networkx. Note: This could likely be done much more efficiently, but not sure if this will be the bottleneck so can refactor if required. :param ligand: oddt.toolkit.Molecule object
Molecules, which are analysed in order to find interactions.
- Parameters:
protein -- oddt.toolkit.Molecule object Molecules, which are analysed in order to find interactions.
distance_cutoff -- float (default=4.5) Cutoff distance for close contacts.
ignore_hoh -- bool (default = True) Should the water molecules be ignored. This is based on the name of the residue ('HOH').
visualize -- whether to visualize the final output graph using matplotlib projection into 2d space
local_connect -- bool (default=True) Boolean flag to reestablish intra-ligand/protein connectivity after tree
reduction. :return: A networkx graph of featurized nodes and edges representing the interaction of the protein and ligand.