Created
May 31, 2023 08:28
-
-
Save richardjgowers/79451ed3d698618125f9fa1b3dd82e52 to your computer and use it in GitHub Desktop.
Create a radial network using OpenFE and Lomap Atom Mapper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"id": "6db2a96e", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import openfe\n", | |
"from rdkit import Chem\n", | |
"import glob" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"id": "e997da08", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"mols = [openfe.SmallMoleculeComponent(Chem.MolFromMol2File(f, removeHs=False))\n", | |
" for f in glob.glob('./radial/ejm*mol2')]" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"id": "5c3ca11d", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"# object that provides a mapping between pairs of molecules\n", | |
"mapper = openfe.LomapAtomMapper()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"id": "17af20d2", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"# create radial network \n", | |
"ln = openfe.ligand_network_planning.generate_radial_network(\n", | |
" ligands=mols[1:],\n", | |
" central_ligand=mols[0],\n", | |
" mappers=[mapper]\n", | |
")" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"id": "44be9b7c", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"ejm_45 ejm_48 {0: 0, 1: 5, 2: 4, 3: 3, 4: 2, 5: 1, 6: 19, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13, 14: 14, 15: 15, 16: 16, 17: 17, 18: 18, 20: 6, 24: 25, 25: 27, 26: 26, 27: 28, 28: 29, 29: 30, 30: 31, 31: 32}\n", | |
"ejm_45 ejm_43 {0: 0, 1: 5, 2: 4, 3: 3, 4: 2, 5: 1, 6: 20, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13, 14: 14, 15: 15, 16: 16, 17: 17, 18: 18, 19: 19, 20: 6, 24: 23, 25: 25, 26: 24, 27: 26, 28: 27, 29: 28, 30: 29, 31: 30, 32: 22, 33: 31}\n", | |
"ejm_45 ejm_42 {0: 0, 1: 5, 2: 4, 3: 3, 4: 2, 5: 1, 6: 20, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13, 14: 14, 15: 15, 16: 16, 17: 17, 18: 18, 19: 19, 20: 6, 24: 22, 25: 24, 26: 23, 27: 25, 28: 26, 29: 27, 30: 28, 31: 29, 32: 30, 33: 31}\n", | |
"ejm_45 ejm_54 {0: 0, 1: 5, 2: 4, 3: 3, 4: 2, 5: 1, 6: 19, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13, 14: 14, 15: 15, 16: 16, 17: 17, 18: 18, 19: 22, 20: 6, 24: 23, 25: 25, 26: 24, 27: 26, 28: 27, 29: 28, 30: 29, 31: 30, 32: 36, 33: 20}\n", | |
"ejm_45 ejm_44 {0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13, 14: 14, 15: 15, 16: 16, 17: 17, 18: 18, 19: 19, 20: 20, 24: 24, 25: 25, 26: 26, 27: 27, 28: 28, 29: 29, 30: 30, 31: 31, 32: 23, 33: 21}\n", | |
"ejm_45 ejm_50 {0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13, 14: 14, 15: 15, 16: 16, 17: 17, 18: 18, 19: 19, 20: 20, 24: 22, 25: 23, 26: 24, 27: 25, 28: 26, 29: 27, 30: 28, 31: 29, 32: 30, 33: 31}\n", | |
"ejm_45 ejm_49 {0: 0, 1: 5, 2: 4, 3: 3, 4: 2, 5: 1, 6: 19, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13, 14: 14, 15: 15, 16: 16, 17: 17, 18: 18, 20: 6, 24: 26, 25: 28, 26: 27, 27: 29, 28: 30, 29: 31, 30: 32, 31: 33}\n", | |
"ejm_45 ejm_47 {0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13, 14: 14, 15: 15, 16: 16, 17: 17, 18: 18, 20: 19, 24: 24, 25: 25, 26: 26, 27: 27, 28: 28, 29: 29, 30: 30, 31: 31}\n", | |
"ejm_45 ejm_46 {0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13, 14: 14, 15: 15, 16: 16, 17: 17, 18: 18, 20: 22, 24: 23, 25: 24, 26: 25, 27: 26, 28: 27, 29: 28, 30: 29, 31: 30}\n", | |
"ejm_45 ejm_55 {0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13, 14: 14, 15: 15, 16: 16, 17: 17, 18: 18, 19: 21, 20: 19, 24: 22, 25: 23, 26: 24, 27: 25, 28: 26, 29: 27, 30: 28, 31: 29, 33: 20}\n", | |
"ejm_45 ejm_31 {0: 0, 1: 5, 2: 4, 3: 3, 4: 2, 5: 1, 6: 20, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13, 14: 14, 15: 15, 16: 16, 17: 17, 18: 18, 19: 19, 20: 6, 21: 30, 24: 21, 25: 23, 26: 22, 27: 24, 28: 25, 29: 26, 30: 27, 31: 28, 32: 29, 33: 31}\n" | |
] | |
} | |
], | |
"source": [ | |
"for edge in ln.edges:\n", | |
" # name of A/B ligand, then dictionary mapping indices of atoms in A to atoms in B\n", | |
" print(edge.componentA.name, edge.componentB.name, edge.componentA_to_componentB)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"id": "9caef5e8", | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3 (ipykernel)", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.10.10" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 5 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment