|
737 | 737 | "name": "stderr", |
738 | 738 | "output_type": "stream", |
739 | 739 | "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" |
741 | 741 | ] |
742 | 742 | } |
743 | 743 | ], |
|
1246 | 1246 | "name": "stderr", |
1247 | 1247 | "output_type": "stream", |
1248 | 1248 | "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" |
1250 | 1250 | ] |
1251 | 1251 | } |
1252 | 1252 | ], |
|
1456 | 1456 | "\n", |
1457 | 1457 | "In addition to aligning the protein structures, we must also align the ligands.\n", |
1458 | 1458 | "\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." |
1460 | 1460 | ] |
1461 | 1461 | }, |
1462 | 1462 | { |
|
1474 | 1474 | "name": "stdout", |
1475 | 1475 | "output_type": "stream", |
1476 | 1476 | "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", |
1487 | 1487 | "\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" |
1489 | 1489 | ] |
1490 | 1490 | } |
1491 | 1491 | ], |
1492 | 1492 | "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", |
1498 | 1493 | "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" |
1527 | 1496 | ] |
1528 | 1497 | }, |
1529 | 1498 | { |
|
1833 | 1802 | "In practice, one would create entire network of Transformations, and then run all the simulations.\n", |
1834 | 1803 | "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)." |
1835 | 1804 | ] |
| 1805 | + }, |
| 1806 | + { |
| 1807 | + "cell_type": "code", |
| 1808 | + "execution_count": null, |
| 1809 | + "id": "fab60c32-e717-43b3-b8e7-81d2e2aaa9c9", |
| 1810 | + "metadata": {}, |
| 1811 | + "outputs": [], |
| 1812 | + "source": [] |
1836 | 1813 | } |
1837 | 1814 | ], |
1838 | 1815 | "metadata": { |
|
0 commit comments