package
#
Classes:
-
RInterface
–This is a shared interface for a molecule and a list of molecules.
-
RMol
–RMol is essentially a wrapper around RDKit Mol with
-
DaskTasks
– -
ChemSpace
–Streamline working with many RMols or a specific chemical space by employing a pandas dataframe,
-
RGroups
–The default R-Group library with visualisation (mols2grid).
-
Linkers
–A linker library presented as a grid molecules using mols2grid library.
Functions:
-
build_molecule
–:param scaffolds:
RInterface
#
This is a shared interface for a molecule and a list of molecules.
The main purpose is to allow using the same functions on a single molecule and on a group of them.
RMol
#
RMol(*args, id=None, template=None, **kwargs)
Bases: RInterface
, Mol
RMol is essentially a wrapper around RDKit Mol with tailored functionalities for attaching R groups, etc.
:param rmol: when provided, energies and additional metadata is preserved. :type rmol: RMol :param template: Provide the original molecule template used for this RMol.
Methods:
-
toxicity
–Assessed various ADMET properties, including
-
generate_conformers
–Generate conformers using the RDKIT's ETKDG. The generated conformers
-
optimise_in_receptor
–Enumerate the conformers inside of the receptor by employing
-
sort_conformers
–For the given molecule and the conformer energies order the energies
-
rep2D
–Use RDKit and get a 2D diagram.
-
rep3D
–Use py3Dmol to obtain the 3D view of the molecule.
-
remove_clashing_confs
–Removing conformations that class with the protein.
-
set_gnina
–Set the location of the binary file gnina. This could be your own compiled directory,
-
gnina
–Use GNINA to extract CNNaffinity, which we also recalculate to Kd (nM)
-
to_file
–Write the molecule and all conformers to file.
-
df
–Generate a pandas dataframe row for this molecule with SMILES.
Source code in fegrow/package.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
|
toxicity
#
toxicity()
Assessed various ADMET properties, including - Lipinksi rule of 5 properties, - the presence of unwanted substructures - problematic functional groups - synthetic accessibility
:return: a row of a dataframe with the descriptors :rtype: dataframe
Source code in fegrow/package.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
|
generate_conformers
#
generate_conformers(num_conf: int, minimum_conf_rms: Optional[float] = [], **kwargs)
Generate conformers using the RDKIT's ETKDG. The generated conformers are embedded into the template structure. In other words, any atoms that are common with the template structure, should have the same coordinates.
:param num_conf: fixme :param minimum_conf_rms: The minimum acceptable difference in the RMS in any new generated conformer. Conformers that are too similar are discarded. :type minimum_conf_rms: float :param flexible: A list of indices that are common with the template molecule that should have new coordinates. :type flexible: List[int]
Source code in fegrow/package.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
|
optimise_in_receptor
#
optimise_in_receptor(*args, **kwargs)
Enumerate the conformers inside of the receptor by employing ANI2x, a hybrid machine learning / molecular mechanics (ML/MM) approach. ANI2x is neural nework potential for the ligand energetics but works only for the following atoms: H, C, N, O, F, S, Cl.
Open Force Field Parsley force field is used for intermolecular interactions with the receptor.
:param sigma_scale_factor: is used to scale the Lennard-Jones radii of the atoms. :param relative_permittivity: is used to scale the electrostatic interactions with the protein. :param water_model: can be used to set the force field for any water molecules present in the binding site.
Source code in fegrow/package.py
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
|
sort_conformers
#
sort_conformers(energy_range=5)
For the given molecule and the conformer energies order the energies and only keep any conformers with in the energy range of the lowest energy conformer.
:param energy_range: The energy range (kcal/mol), above the minimum, for which conformers should be kept.
Source code in fegrow/package.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 |
|
rep2D
#
rep2D(idx=-1, rdkit_mol=False, h=True, **kwargs)
Use RDKit and get a 2D diagram. Uses Compute2DCoords and Draw.MolToImage function
Works with IPython Notebook.
:param **kwargs: are passed further to Draw.MolToImage function.
Source code in fegrow/package.py
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 |
|
rep3D
#
rep3D(view=None, prody=None, template=False, confIds: Optional[List[int]] = None)
Use py3Dmol to obtain the 3D view of the molecule.
Works with IPython Notebook.
:param view: a view to which add the visualisation. Useful if one wants to 3D view multiple conformers in one view. :type view: py3Dmol view instance (None) :param prody: A prody protein around which a view 3D can be created :type prody: Prody instance (Default: None) :param template: Whether to visualise the original 3D template as well from which the molecule was made. :type template: bool (False) :param confIds: Select the conformations for display. :type confIds: List[int]
Source code in fegrow/package.py
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 |
|
remove_clashing_confs
#
remove_clashing_confs(protein: Union[str, PDBFile], min_dst_allowed=1.0)
Removing conformations that class with the protein. Note that the original conformer should be well docked into the protein, ideally with some space between the area of growth and the protein, so that any growth on the template doesn't automatically cause clashes.
:param protein: The protein against which the conformers should be tested. :type protein: filename or the openmm PDBFile instance or prody instance :param min_dst_allowed: If any atom is within this distance in a conformer, the conformer will be deleted. :type min_dst_allowed: float in Angstroms
Source code in fegrow/package.py
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 |
|
set_gnina
staticmethod
#
set_gnina(loc)
Set the location of the binary file gnina. This could be your own compiled directory, or a directory where you'd like it to be downloaded.
By default, gnina path is to the working directory (~500MB).
:param loc: path to gnina binary file. E.g. /dir/path/gnina. Note that right now gnina should be a binary file with that specific filename "gnina". :type loc: str
Source code in fegrow/package.py
357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 |
|
_check_download_gnina
staticmethod
#
_check_download_gnina()
Check if gnina works. Otherwise, download it.
Source code in fegrow/package.py
378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 |
|
gnina
#
gnina(receptor_file, gnina_gpu=False)
Use GNINA to extract CNNaffinity, which we also recalculate to Kd (nM)
LIMITATION: The GNINA binary does not support MAC/Windows.
Please cite GNINA accordingly: McNutt, Andrew T., Paul Francoeur, Rishal Aggarwal, Tomohide Masuda, Rocco Meli, Matthew Ragoza, Jocelyn Sunseri, and David Ryan Koes. "GNINA 1.0: molecular docking with deep learning." Journal of cheminformatics 13, no. 1 (2021): 1-20.
:param receptor_file: Path to the receptor file. :type receptor_file: str
Source code in fegrow/package.py
413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 |
|
to_file
#
to_file(filename: str)
Write the molecule and all conformers to file.
Note
The file type is worked out from the name extension by splitting on .
.
Source code in fegrow/package.py
469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 |
|
df
#
df()
Generate a pandas dataframe row for this molecule with SMILES.
:returns: pandas dataframe row.
Source code in fegrow/package.py
501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 |
|
DaskTasks
#
Methods:
-
scaffold_check
–:param smih:
scaffold_check
staticmethod
#
scaffold_check(smih, scaffold)
:param smih: :param scaffold: :return: [has_scaffold_bool, protonated_smiles]
Source code in fegrow/package.py
546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 |
|
ChemSpace
#
ChemSpace(data=None, data_indices=None, dask_cluster=None, dask_local_cluster_kwargs={})
Streamline working with many RMols or a specific chemical space by employing a pandas dataframe, in combination with Dask for parallellisation.
Methods:
-
optimise_in_receptor
–Return lists of energies.
-
discard_missing
–Remove from this list the molecules that have no conformers
-
add_rgroups
–Note that if they are Smiles:
-
add_data
–:param data: dictionary {"Smiles": [], "h": [], ... }
-
add_smiles
–Add a list of Smiles into this ChemicalSpace
-
evaluate
–:param indices:
-
add_enamine_molecules
–For the best scoring molecules, find similar molecules in Enamine REAL database
-
active_learning
–Model the data using the Training subset. Then use the active learning query method.
-
compute_fps
–:param smiles_tuple: It has to be a tuple to be hashable (to work with caching).
-
to_sdf
–Write every molecule and all its fields as properties, to an SDF file.
Source code in fegrow/package.py
596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 |
|
optimise_in_receptor
#
optimise_in_receptor(*args, **kwargs)
Return lists of energies.
Source code in fegrow/package.py
734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 |
|
discard_missing
#
discard_missing()
Remove from this list the molecules that have no conformers
Source code in fegrow/package.py
812 813 814 815 816 817 818 819 820 821 822 823 |
|
add_rgroups
#
add_rgroups(rgroups_linkers, rgroups2=None, alltoall=False)
Note that if they are Smiles
- if they have an * atom (e.g. RDKit atom.SetAtomicNum(0)), this will be used for attachment to the scaffold
- if they don't have an * atom, the scaffold will be fitted as a substructure
First link the linker to the scaffold. Then add the rgroups.
:param rgroups2: A list of Smiles. Molecules will be accepted and converted to Smiles. :param linker: A molecule. Ideally it has 2 atatchement points. :return:
Source code in fegrow/package.py
850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 |
|
add_data
#
add_data(data)
:param data: dictionary {"Smiles": [], "h": [], ... } :return:
Source code in fegrow/package.py
901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 |
|
add_smiles
#
add_smiles(smiles_list, h=NA, protonate=False)
Add a list of Smiles into this ChemicalSpace
:param h: which h was used to connect to the :param protonate: use openbabel to protonate each smile :return:
Source code in fegrow/package.py
923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 |
|
_evaluate_experimental
#
_evaluate_experimental(indices=None, num_conf=10, minimum_conf_rms=0.5, min_dst_allowed=1)
Generate the conformers and score the subset of molecules.
E.g. :param indices: The indices in the dataframe to be run through the pipeline. If None, all molecules are evaluated. :return:
Source code in fegrow/package.py
946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 |
|
evaluate
#
evaluate(indices: Union[Sequence[int], DataFrame] = None, scoring_function=None, gnina_path=None, gnina_gpu=False, num_conf=50, minimum_conf_rms=0.5, penalty=NA, al_ignore_penalty=True, **kwargs)
:param indices: :param scoring_function: :param gnina_path: :param gnina_gpu: :param num_conf: :param minimum_conf_rms: :param penalty: :param al_ignore_penalty: :param kwargs: :return:
Source code in fegrow/package.py
1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 |
|
add_enamine_molecules
#
add_enamine_molecules(n_best=1, results_per_search=100, remove_scaffold_h=False)
For the best scoring molecules, find similar molecules in Enamine REAL database and add them to the dataset.
Make sure you have the permission/license to use https://sw.docking.org/search.html this way.
@scaffold: The scaffold molecule that has to be present in the found molecules. If None, this requirement will be ignored. @molecules_per_smile: How many top results (molecules) per Smiles searched.
Source code in fegrow/package.py
1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 |
|
active_learning
#
active_learning(n=1, first_random=True, score_higher_better=True, model=None, query=None, learner_type=None)
Model the data using the Training subset. Then use the active learning query method.
See properties "model" and "query" for finer control.
It's better to save the FPs in the dataframe. Or in the underlying system. :return:
Source code in fegrow/package.py
1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 |
|
compute_fps
cached
#
compute_fps(smiles_tuple)
:param smiles_tuple: It has to be a tuple to be hashable (to work with caching). :return:
Source code in fegrow/package.py
1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 |
|
to_sdf
#
to_sdf(filename, failed=False, unbuilt=True)
Write every molecule and all its fields as properties, to an SDF file.
:return:
Source code in fegrow/package.py
1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 |
|
RGroups
#
RGroups()
Bases: DataFrame
The default R-Group library with visualisation (mols2grid).
Source code in fegrow/package.py
1563 1564 1565 1566 1567 1568 1569 |
|
_load_data
staticmethod
#
_load_data() -> DataFrame
Load the default R-Group library
The R-groups were largely extracted from (please cite accordingly): Takeuchi, Kosuke, Ryo Kunimoto, and Jürgen Bajorath. "R-group replacement database for medicinal chemistry." Future Science OA 7.8 (2021): FSO742.
Source code in fegrow/package.py
1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 |
|
Linkers
#
Linkers()
Bases: DataFrame
A linker library presented as a grid molecules using mols2grid library.
Source code in fegrow/package.py
1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 |
|
build_molecule
#
build_molecule(scaffolds: Mol, r_group: Union[Mol, str], scaffold_point: Optional[int] = None, rgroup_point: Optional[int] = None, keep: Optional[int] = None)
:param scaffolds: :param r_groups: :param scaffold_point: attachement point on the scaffold :param keep: When the scaffold is grown from an internal atom that divides the molecules into separate submolecules, keep the submolecule with this atom index. :return:
Source code in fegrow/package.py
1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 |
|
_evaluate_atomic
#
_evaluate_atomic(scaffold, smiles, pdb_filename, h=None, scoring_function=None, num_conf=50, minimum_conf_rms=0.5, ani=True, platform='CPU', gnina_gpu=False, skip_optimisation=False, full_evaluation=None)
:param scaffold: :param h: :param smiles: Full Smiles. :param scoring_function: :param pdb_filename: :param gnina_path: :return:
Source code in fegrow/package.py
1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 |
|