Skip to content

Commit

Permalink
updated MOR tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
stefdoerr committed Jun 12, 2024
1 parent 8b89025 commit fe655d2
Showing 1 changed file with 165 additions and 36 deletions.
201 changes: 165 additions & 36 deletions tutorials/mu-opioid-receptor-gpcr-equilibration.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,65 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {
"collapsed": false,
"jupyter": {
"outputs_hidden": false
}
},
"outputs": [],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-06-12 13:36:44,454 - numexpr.utils - INFO - Note: NumExpr detected 20 cores but \"NUMEXPR_MAX_THREADS\" not set, so enforcing safe limit of 8.\n",
"2024-06-12 13:36:44,454 - numexpr.utils - INFO - NumExpr defaulting to 8 threads.\n",
"2024-06-12 13:36:44,569 - rdkit - INFO - Enabling RDKit 2022.09.1 jupyter extensions\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Please cite HTMD: Doerr et al.(2016)JCTC,12,1845. https://dx.doi.org/10.1021/acs.jctc.6b00049\n",
"HTMD Documentation at: https://software.acellera.com/htmd/\n",
"\n",
"You are on the latest HTMD version (2.3.28+20.g8b8902599).\n",
"\n"
]
}
],
"source": [
"from htmd.ui import *\n",
"from htmd.home import home\n",
"#get the files\n",
"shutil.copytree(home()+'/data/mor','/tmp/testmor/pdb')\n",
"\n",
"shutil.copytree(home(dataDir=\"mor\"),'/tmp/testmor/pdb')\n",
"os.chdir('/tmp/testmor')\n",
"path='./01_prepare/'"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {
"collapsed": false,
"jupyter": {
"outputs_hidden": false
}
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"4dkl.pdb ff.rtf MOL.cif QM-min.pdb\n",
"ff.prm membrane80by80C36.pdb MOL.frcmod sod.pdb\n"
]
}
],
"source": [
"%ls /tmp/testmor/pdb"
]
Expand All @@ -54,48 +88,124 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"metadata": {
"collapsed": false,
"jupyter": {
"outputs_hidden": false
}
},
"outputs": [],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-06-12 13:38:49,041 - moleculekit.molecule - INFO - Removed 5120 atoms. 2262 atoms remaining in the molecule.\n",
"2024-06-12 13:38:49,076 - moleculekit.tools.autosegment - INFO - Created segment P0 between resid 65 and 263.\n",
"2024-06-12 13:38:49,077 - moleculekit.tools.autosegment - INFO - Created segment P1 between resid 270 and 352.\n",
"2024-06-12 13:38:49,184 - moleculekit.tools.preparation - WARNING - Both chains and segments are defined in Molecule.chain / Molecule.segid, however they are inconsistent. Protein preparation will use the chain information.\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"---- Molecule chain report ----\n",
"Chain A:\n",
" First residue: HOH 717 \n",
" Final residue: HOH 717 \n",
"Chain B:\n",
" First residue: MET 65 \n",
" Final residue: HOH 735 \n",
"---- End of chain report ----\n",
"\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-06-12 13:38:51,090 - moleculekit.tools.preparation - INFO - Modified residue ASP 114 B to ASH\n",
"2024-06-12 13:38:51,091 - moleculekit.tools.preparation - INFO - Modified residue CYS 140 B to CYX\n",
"2024-06-12 13:38:51,091 - moleculekit.tools.preparation - INFO - Modified residue HIS 171 B to HID\n",
"2024-06-12 13:38:51,092 - moleculekit.tools.preparation - INFO - Modified residue CYS 217 B to CYX\n",
"2024-06-12 13:38:51,092 - moleculekit.tools.preparation - INFO - Modified residue HIS 223 B to HID\n",
"2024-06-12 13:38:51,092 - moleculekit.tools.preparation - INFO - Modified residue HIS 297 B to HID\n",
"2024-06-12 13:38:51,093 - moleculekit.tools.preparation - INFO - Modified residue HIS 319 B to HIE\n",
"2024-06-12 13:38:51,094 - moleculekit.tools.preparation - WARNING - Dubious protonation state: the pKa of 1 residues is within 1.0 units of pH 7.4.\n",
"2024-06-12 13:38:51,094 - moleculekit.tools.preparation - WARNING - Dubious protonation state: ASP 114 B (pKa= 7.85)\n"
]
}
],
"source": [
"#Protein 4dkl is taken from opm\n",
"\n",
"topos = charmm.defaultTopo() + ['pdb/ff.rtf']\n",
"params = charmm.defaultParam() + ['pdb/ff.prm']\n",
"prot = Molecule('pdb/4dkl.pdb')\n",
"prot.filter('protein and noh and chain B or water within 5 of (chain B and protein)')\n",
"prot.filter('(protein and noh and chain B) or (water and within 5 of (chain B and protein))')\n",
"pcenter = np.mean(prot.get('coords','protein'), axis=0)\n",
"prot = autoSegment(prot, sel='protein') \n",
"\n",
"prot = charmm.build(prot, topo=topos, param=params, outdir= path+'prot',ionize=False)"
"prot = systemPrepare(prot)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"outputs_hidden": true
}
},
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"prot.view()"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"metadata": {
"collapsed": false,
"jupyter": {
"outputs_hidden": false
}
},
"outputs": [],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-06-12 13:39:40,456 - moleculekit.molecule - INFO - Removed 327 residues from appended Molecule due to collisions.\n",
"2024-06-12 13:39:40,768 - htmd.builder.solvate - INFO - Using water pdb file at: /home/sdoerr/Work/htmd/htmd/share/solvate/wat.pdb\n",
"2024-06-12 13:39:41,223 - htmd.builder.solvate - INFO - Replicating 8 water segments, 2 by 2 by 2\n",
"Solvating: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 8/8 [00:10<00:00, 1.26s/it]\n",
"2024-06-12 13:39:51,927 - htmd.builder.solvate - INFO - 9644 water molecules were added to the system.\n",
"2024-06-12 13:39:54,236 - htmd.builder.amber - INFO - Detecting disulfide bonds.\n",
"2024-06-12 13:39:54,245 - htmd.builder.builder - INFO - One disulfide bond was added\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Disulfide Bond between: UniqueResidueID<resname: 'CYX', chain: 'B', resid: 78, insertion: '', segid: 'P0'>\n",
" and: UniqueResidueID<resname: 'CYX', chain: 'B', resid: 155, insertion: '', segid: 'P0'>\n",
"\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-06-12 13:39:55,271 - htmd.builder.amber - INFO - Starting the build.\n",
"2024-06-12 13:39:57,377 - htmd.builder.amber - INFO - Finished building.\n",
"2024-06-12 13:39:58,428 - moleculekit.writers - WARNING - Field \"resid\" of PDB overflows. Your data will be truncated to 4 characters.\n",
"2024-06-12 13:40:03,262 - htmd.builder.builder - WARNING - Found cis peptide bond in 1 frames: [0] in the omega diheral \"Angle of (HID 160 CA ) (HID 160 C ) (PRO 161 N ) (PRO 161 CA ) \" with indexes [2528, 2541, 2543, 2553]\n",
"2024-06-12 13:40:03,614 - htmd.builder.ionize - INFO - Adding 15 anions + 0 cations for neutralizing and 68 ions for the given salt concentration 0.15 M.\n",
"2024-06-12 13:40:13,210 - htmd.builder.amber - INFO - Starting the build.\n",
"2024-06-12 13:40:15,339 - htmd.builder.amber - INFO - Finished building.\n",
"2024-06-12 13:40:16,352 - moleculekit.writers - WARNING - Field \"resid\" of PDB overflows. Your data will be truncated to 4 characters.\n",
"2024-06-12 13:40:20,922 - htmd.builder.builder - WARNING - Found cis peptide bond in 1 frames: [0] in the omega diheral \"Angle of (HID 160 CA ) (HID 160 C ) (PRO 161 N ) (PRO 161 CA ) \" with indexes [2528, 2541, 2543, 2553]\n",
"2024-06-12 13:40:23,463 - moleculekit.tools.sequencestructuralalignment - INFO - Alignment #0 was done on 282 residues: 2-285\n"
]
}
],
"source": [
"#Add sodium in the receptor\n",
"sod = Molecule('pdb/sod.pdb')\n",
Expand All @@ -110,7 +220,7 @@
"mol.append(memb, collisions=True) # Append membrane and remove colliding atoms\n",
"\n",
"#Add ligand, previously parametrized using gaamp\n",
"lig = Molecule('pdb/QM-min.pdb') \n",
"lig = Molecule('pdb/MOL.cif') \n",
"lig.set('segid','L')\n",
"lcenter = np.mean(lig.get('coords'),axis=0)\n",
"newlcenter = [np.random.uniform(-10, 10), np.random.uniform(-10, 10), 43]\n",
Expand All @@ -125,7 +235,9 @@
"mol = solvate(mol, minmax=np.vstack((m,M)))\n",
"\n",
"#Build\n",
"mol = charmm.build(mol, topo=topos, param=params, outdir=os.path.join(path,'build'), saltconc=0.15)"
"topos = amber.defaultTopo() + ['pdb/MOL.cif']\n",
"params = amber.defaultParam() + ['pdb/MOL.frcmod']\n",
"mol = amber.build(mol, topo=topos, param=params, outdir=os.path.join(path,'build'), saltconc=0.15)"
]
},
{
Expand All @@ -137,13 +249,17 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"outputs_hidden": true
"execution_count": 9,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-06-12 13:40:35,913 - htmd.builder.builder - WARNING - Found cis peptide bond in 1 frames: [0] in the omega diheral \"Angle of (HID 160 CA ) (HID 160 C ) (PRO 161 N ) (PRO 161 CA ) \" with indexes [2528, 2541, 2543, 2553]\n"
]
}
},
"outputs": [],
],
"source": [
"from htmd.protocols.equilibration_v3 import Equilibration\n",
"from htmd.mdengine.acemd.acemd import GroupRestraint\n",
Expand All @@ -163,13 +279,23 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"outputs_hidden": true
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-06-12 13:40:37,971 - py.warnings - WARNING - /tmp/ipykernel_388679/442516882.py:3: RuntimeWarning: Mean of empty slice.\n",
" fbcentre = mol.get('coords', sel='segid L').mean(axis=0).squeeze()\n",
"\n",
"2024-06-12 13:40:37,990 - py.warnings - WARNING - /home/sdoerr/miniforge3/envs/htmd/lib/python3.10/site-packages/numpy/core/_methods.py:184: RuntimeWarning: invalid value encountered in divide\n",
" ret = um.true_divide(\n",
"\n",
"/usr/local/lib/vmd/vmd_LINUXAMD64: /lib/x86_64-linux-gnu/libGL.so.1: no version information available (required by /usr/local/lib/vmd/vmd_LINUXAMD64)\n"
]
}
},
"outputs": [],
],
"source": [
"# Visualize the flat bottom potential box\n",
"mol.view('not water')\n",
Expand All @@ -181,6 +307,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true,
"jupyter": {
"outputs_hidden": true
}
Expand Down Expand Up @@ -216,6 +343,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false,
"jupyter": {
"outputs_hidden": false
}
Expand Down Expand Up @@ -244,6 +372,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true,
"jupyter": {
"outputs_hidden": true
}
Expand All @@ -264,7 +393,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -278,7 +407,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.7"
"version": "3.10.13"
}
},
"nbformat": 4,
Expand Down

0 comments on commit fe655d2

Please sign in to comment.