Skip to content

Commit 744b3ae

Browse files
committed
clean up hybrid top cells
1 parent 982322a commit 744b3ae

1 file changed

Lines changed: 24 additions & 47 deletions

File tree

cookbook/openfold3_to_openfe.ipynb

Lines changed: 24 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@
737737
"name": "stderr",
738738
"output_type": "stream",
739739
"text": [
740-
"Generating charges: 100%|█████████████████████████| 1/1 [00:00<00:00, 1.80it/s]\n"
740+
"Generating charges: 100%|█████████████████████████| 1/1 [00:00<00:00, 1.84it/s]\n"
741741
]
742742
}
743743
],
@@ -1246,7 +1246,7 @@
12461246
"name": "stderr",
12471247
"output_type": "stream",
12481248
"text": [
1249-
"Generating charges: 100%|███████████████████████| 10/10 [00:05<00:00, 1.78it/s]\n"
1249+
"Generating charges: 100%|███████████████████████| 10/10 [00:05<00:00, 1.81it/s]\n"
12501250
]
12511251
}
12521252
],
@@ -1456,7 +1456,7 @@
14561456
"\n",
14571457
"In addition to aligning the protein structures, we must also align the ligands.\n",
14581458
"\n",
1459-
"Again, as per the SepTop example above, we will do the transformation between `lig_jmc_27` and `lig_ejm_46`."
1459+
"We will again use the transformation between `lig_jmc_27` and `lig_ejm_46` as an example."
14601460
]
14611461
},
14621462
{
@@ -1474,56 +1474,25 @@
14741474
"name": "stdout",
14751475
"output_type": "stream",
14761476
"text": [
1477-
"Extracting ligand from lig_ejm_50_seed_42_sample_1_model.pdb\n",
1478-
"Extracting ligand from lig_jmc_23_seed_42_sample_1_model.pdb\n",
1479-
"Extracting ligand from lig_ejm_43_seed_42_sample_1_model.pdb\n",
1480-
"Extracting ligand from lig_ejm_42_seed_42_sample_1_model.pdb\n",
1481-
"Extracting ligand from lig_ejm_31_seed_42_sample_1_model.pdb\n",
1482-
"Extracting ligand from lig_ejm_47_seed_42_sample_1_model.pdb\n",
1483-
"Extracting ligand from lig_jmc_27_seed_42_sample_1_model.pdb\n",
1484-
"Extracting ligand from lig_ejm_46_seed_42_sample_1_model.pdb\n",
1485-
"Extracting ligand from lig_ejm_48_seed_42_sample_1_model.pdb\n",
1486-
"Extracting ligand from lig_jmc_28_seed_42_sample_1_model.pdb\n",
1477+
"Calculating volume of lig_ejm_50_seed_42_sample_1_model.pdb\n",
1478+
"Calculating volume of lig_jmc_23_seed_42_sample_1_model.pdb\n",
1479+
"Calculating volume of lig_ejm_43_seed_42_sample_1_model.pdb\n",
1480+
"Calculating volume of lig_ejm_42_seed_42_sample_1_model.pdb\n",
1481+
"Calculating volume of lig_ejm_31_seed_42_sample_1_model.pdb\n",
1482+
"Calculating volume of lig_ejm_47_seed_42_sample_1_model.pdb\n",
1483+
"Calculating volume of lig_jmc_27_seed_42_sample_1_model.pdb\n",
1484+
"Calculating volume of lig_ejm_46_seed_42_sample_1_model.pdb\n",
1485+
"Calculating volume of lig_ejm_48_seed_42_sample_1_model.pdb\n",
1486+
"Calculating volume of lig_jmc_28_seed_42_sample_1_model.pdb\n",
14871487
"\n",
1488-
"Largest ligand is lig_jmc_27 with volume 0.5209626577896912\n"
1488+
"Largest ligand_name is lig_jmc_27 with volume 0.521\n"
14891489
]
14901490
}
14911491
],
14921492
"source": [
1493-
"from MDAnalysis.analysis import align\n",
1494-
"from rdkit.Chem.Descriptors3D import Asphericity\n",
1495-
"\n",
1496-
"# gather all the complexes and align to a single structure\n",
1497-
"# which has the largest ligand by volume \n",
14981493
"of3_results_root = pathlib.Path(\"assets/of3_tyk2_output/\")\n",
1499-
"tmp_ligand_dir = pathlib.Path(output_root,\"temp_ligands\")\n",
1500-
"tmp_ligand_dir.mkdir(exist_ok=True,parents=True)\n",
1501-
"# load all the output pdbs and calculate ligand volumes\n",
1502-
"ligand_volumes = {}\n",
1503-
"\n",
1504-
"for output_file in of3_results_root.glob(\"*/*/*.pdb\"):\n",
1505-
" ligand_name = output_file.name.split('_seed')[0]\n",
1506-
" print(f\"Extracting ligand from {output_file.name}\")\n",
1507-
" with warnings.catch_warnings(): \n",
1508-
" warnings.simplefilter(\"ignore\")\n",
1509-
" u = mda.Universe(str(output_file))\n",
1510-
" ligand = u.select_atoms(\"resname LIG\")\n",
1511-
" # write the ligand to a temporary file\n",
1512-
" ligand.write(str(tmp_ligand_dir / f\"{ligand_name}.pdb\"))\n",
1513-
" # now load back with rdkit\n",
1514-
" rdkit_mol = Chem.MolFromPDBFile(str(tmp_ligand_dir / f\"{ligand_name}.pdb\"), removeHs=True)\n",
1515-
" # now use a template from the SMILES definitions to make sure the bond orders are correct\n",
1516-
" template_mol = Chem.MolFromSmiles(ligand_smiles[ligand_name])\n",
1517-
" # don't show rdkit's \"WARNING: More than one matching pattern found - picking one\" for every ligand\n",
1518-
" with rdBase.BlockLogs(): \n",
1519-
" rdkit_mol = AllChem.AssignBondOrdersFromTemplate(template_mol, rdkit_mol)\n",
1520-
" # calculate the volume\n",
1521-
" vsa = Asphericity(rdkit_mol)\n",
1522-
" ligand_volumes[ligand_name] = vsa\n",
1523-
"\n",
1524-
"# find the ligand with the largest volume\n",
1525-
"largest_ligand = max(ligand_volumes, key=ligand_volumes.get)\n",
1526-
"print(f\"\\nLargest ligand is {largest_ligand} with volume {ligand_volumes[largest_ligand]}\")"
1494+
"largest_ligand, largest_vol= find_largest_ligand(of3_results_root.glob(\"*/*/*.pdb\"))\n",
1495+
"print(f\"\\nLargest ligand_name is {largest_ligand} with volume {largest_vol:.3f}\")\n"
15271496
]
15281497
},
15291498
{
@@ -1833,6 +1802,14 @@
18331802
"In practice, one would create entire network of Transformations, and then run all the simulations.\n",
18341803
"This notebook will not cover these aspects. To find out more about this, please see the [OpenFE Tutorials](https://docs.openfree.energy/en/latest/tutorials/index.html)."
18351804
]
1805+
},
1806+
{
1807+
"cell_type": "code",
1808+
"execution_count": null,
1809+
"id": "fab60c32-e717-43b3-b8e7-81d2e2aaa9c9",
1810+
"metadata": {},
1811+
"outputs": [],
1812+
"source": []
18361813
}
18371814
],
18381815
"metadata": {

0 commit comments

Comments
 (0)