rdkit-headers 2022.3.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (320) hide show
  1. rdkit_headers/__init__.py +13 -0
  2. rdkit_headers/include/rdkit/CIPLabeler/CIPLabeler.h +59 -0
  3. rdkit_headers/include/rdkit/CIPLabeler/TooManyNodesException.h +28 -0
  4. rdkit_headers/include/rdkit/Catalogs/Catalog.h +461 -0
  5. rdkit_headers/include/rdkit/Catalogs/CatalogEntry.h +48 -0
  6. rdkit_headers/include/rdkit/Catalogs/CatalogParams.h +42 -0
  7. rdkit_headers/include/rdkit/ChemicalFeatures/ChemicalFeature.h +38 -0
  8. rdkit_headers/include/rdkit/ChemicalFeatures/FreeChemicalFeature.h +97 -0
  9. rdkit_headers/include/rdkit/DataManip/MetricMatrixCalc/MetricFuncs.h +54 -0
  10. rdkit_headers/include/rdkit/DataManip/MetricMatrixCalc/MetricMatrixCalc.h +106 -0
  11. rdkit_headers/include/rdkit/DataStructs/BitOps.h +337 -0
  12. rdkit_headers/include/rdkit/DataStructs/BitVect.h +68 -0
  13. rdkit_headers/include/rdkit/DataStructs/BitVectUtils.h +35 -0
  14. rdkit_headers/include/rdkit/DataStructs/BitVects.h +25 -0
  15. rdkit_headers/include/rdkit/DataStructs/DatastructsException.h +31 -0
  16. rdkit_headers/include/rdkit/DataStructs/DatastructsStreamOps.h +72 -0
  17. rdkit_headers/include/rdkit/DataStructs/DiscreteDistMat.h +30 -0
  18. rdkit_headers/include/rdkit/DataStructs/DiscreteValueVect.h +146 -0
  19. rdkit_headers/include/rdkit/DataStructs/ExplicitBitVect.h +96 -0
  20. rdkit_headers/include/rdkit/DataStructs/FPBReader.h +281 -0
  21. rdkit_headers/include/rdkit/DataStructs/MultiFPBReader.h +213 -0
  22. rdkit_headers/include/rdkit/DataStructs/SparseBitVect.h +101 -0
  23. rdkit_headers/include/rdkit/DataStructs/SparseIntVect.h +571 -0
  24. rdkit_headers/include/rdkit/DataStructs/base64.h +41 -0
  25. rdkit_headers/include/rdkit/DistGeom/BoundsMatrix.h +121 -0
  26. rdkit_headers/include/rdkit/DistGeom/ChiralSet.h +58 -0
  27. rdkit_headers/include/rdkit/DistGeom/ChiralViolationContrib.h +96 -0
  28. rdkit_headers/include/rdkit/DistGeom/DistGeomUtils.h +195 -0
  29. rdkit_headers/include/rdkit/DistGeom/DistViolationContrib.h +54 -0
  30. rdkit_headers/include/rdkit/DistGeom/FourthDimContrib.h +65 -0
  31. rdkit_headers/include/rdkit/DistGeom/TriangleSmooth.h +36 -0
  32. rdkit_headers/include/rdkit/Features/Feature.h +96 -0
  33. rdkit_headers/include/rdkit/ForceField/Contrib.h +40 -0
  34. rdkit_headers/include/rdkit/ForceField/ForceField.h +253 -0
  35. rdkit_headers/include/rdkit/ForceField/MMFF/AngleBend.h +78 -0
  36. rdkit_headers/include/rdkit/ForceField/MMFF/AngleConstraint.h +64 -0
  37. rdkit_headers/include/rdkit/ForceField/MMFF/BondStretch.h +67 -0
  38. rdkit_headers/include/rdkit/ForceField/MMFF/Contribs.h +26 -0
  39. rdkit_headers/include/rdkit/ForceField/MMFF/DistanceConstraint.h +61 -0
  40. rdkit_headers/include/rdkit/ForceField/MMFF/Nonbonded.h +105 -0
  41. rdkit_headers/include/rdkit/ForceField/MMFF/OopBend.h +65 -0
  42. rdkit_headers/include/rdkit/ForceField/MMFF/Params.h +1134 -0
  43. rdkit_headers/include/rdkit/ForceField/MMFF/PositionConstraint.h +55 -0
  44. rdkit_headers/include/rdkit/ForceField/MMFF/StretchBend.h +70 -0
  45. rdkit_headers/include/rdkit/ForceField/MMFF/TorsionAngle.h +79 -0
  46. rdkit_headers/include/rdkit/ForceField/MMFF/TorsionConstraint.h +70 -0
  47. rdkit_headers/include/rdkit/ForceField/UFF/AngleBend.h +92 -0
  48. rdkit_headers/include/rdkit/ForceField/UFF/AngleConstraint.h +64 -0
  49. rdkit_headers/include/rdkit/ForceField/UFF/BondStretch.h +83 -0
  50. rdkit_headers/include/rdkit/ForceField/UFF/Contribs.h +23 -0
  51. rdkit_headers/include/rdkit/ForceField/UFF/DistanceConstraint.h +62 -0
  52. rdkit_headers/include/rdkit/ForceField/UFF/Inversion.h +81 -0
  53. rdkit_headers/include/rdkit/ForceField/UFF/Nonbonded.h +87 -0
  54. rdkit_headers/include/rdkit/ForceField/UFF/Params.h +153 -0
  55. rdkit_headers/include/rdkit/ForceField/UFF/PositionConstraint.h +55 -0
  56. rdkit_headers/include/rdkit/ForceField/UFF/TorsionAngle.h +115 -0
  57. rdkit_headers/include/rdkit/ForceField/UFF/TorsionConstraint.h +70 -0
  58. rdkit_headers/include/rdkit/Geometry/Grid3D.h +55 -0
  59. rdkit_headers/include/rdkit/Geometry/GridUtils.h +64 -0
  60. rdkit_headers/include/rdkit/Geometry/Transform.h +19 -0
  61. rdkit_headers/include/rdkit/Geometry/Transform2D.h +85 -0
  62. rdkit_headers/include/rdkit/Geometry/Transform3D.h +101 -0
  63. rdkit_headers/include/rdkit/Geometry/UniformGrid3D.h +217 -0
  64. rdkit_headers/include/rdkit/Geometry/Utils.h +97 -0
  65. rdkit_headers/include/rdkit/Geometry/point.h +585 -0
  66. rdkit_headers/include/rdkit/GraphMol/Abbreviations/Abbreviations.h +132 -0
  67. rdkit_headers/include/rdkit/GraphMol/Atom.h +449 -0
  68. rdkit_headers/include/rdkit/GraphMol/AtomIterators.h +212 -0
  69. rdkit_headers/include/rdkit/GraphMol/Bond.h +393 -0
  70. rdkit_headers/include/rdkit/GraphMol/BondIterators.h +75 -0
  71. rdkit_headers/include/rdkit/GraphMol/Canon.h +130 -0
  72. rdkit_headers/include/rdkit/GraphMol/ChemReactions/Enumerate/CartesianProduct.h +147 -0
  73. rdkit_headers/include/rdkit/GraphMol/ChemReactions/Enumerate/Enumerate.h +187 -0
  74. rdkit_headers/include/rdkit/GraphMol/ChemReactions/Enumerate/EnumerateBase.h +200 -0
  75. rdkit_headers/include/rdkit/GraphMol/ChemReactions/Enumerate/EnumerateTypes.h +59 -0
  76. rdkit_headers/include/rdkit/GraphMol/ChemReactions/Enumerate/EnumerationPickler.h +60 -0
  77. rdkit_headers/include/rdkit/GraphMol/ChemReactions/Enumerate/EnumerationStrategyBase.h +227 -0
  78. rdkit_headers/include/rdkit/GraphMol/ChemReactions/Enumerate/RandomSample.h +163 -0
  79. rdkit_headers/include/rdkit/GraphMol/ChemReactions/Enumerate/RandomSampleAllBBs.h +184 -0
  80. rdkit_headers/include/rdkit/GraphMol/ChemReactions/PreprocessRxn.h +64 -0
  81. rdkit_headers/include/rdkit/GraphMol/ChemReactions/Reaction.h +491 -0
  82. rdkit_headers/include/rdkit/GraphMol/ChemReactions/ReactionFingerprints.h +147 -0
  83. rdkit_headers/include/rdkit/GraphMol/ChemReactions/ReactionParser.h +274 -0
  84. rdkit_headers/include/rdkit/GraphMol/ChemReactions/ReactionPickler.h +119 -0
  85. rdkit_headers/include/rdkit/GraphMol/ChemReactions/ReactionRunner.h +116 -0
  86. rdkit_headers/include/rdkit/GraphMol/ChemReactions/ReactionUtils.h +74 -0
  87. rdkit_headers/include/rdkit/GraphMol/ChemReactions/SanitizeRxn.h +169 -0
  88. rdkit_headers/include/rdkit/GraphMol/ChemTransforms/ChemTransforms.h +270 -0
  89. rdkit_headers/include/rdkit/GraphMol/ChemTransforms/MolFragmenter.h +120 -0
  90. rdkit_headers/include/rdkit/GraphMol/Chirality.h +137 -0
  91. rdkit_headers/include/rdkit/GraphMol/Conformer.h +183 -0
  92. rdkit_headers/include/rdkit/GraphMol/CoordGen.h +195 -0
  93. rdkit_headers/include/rdkit/GraphMol/Depictor/DepictUtils.h +366 -0
  94. rdkit_headers/include/rdkit/GraphMol/Depictor/EmbeddedFrag.h +544 -0
  95. rdkit_headers/include/rdkit/GraphMol/Depictor/RDDepictor.h +284 -0
  96. rdkit_headers/include/rdkit/GraphMol/Deprotect/Deprotect.h +105 -0
  97. rdkit_headers/include/rdkit/GraphMol/Descriptors/AUTOCORR2D.h +49 -0
  98. rdkit_headers/include/rdkit/GraphMol/Descriptors/AUTOCORR3D.h +51 -0
  99. rdkit_headers/include/rdkit/GraphMol/Descriptors/AtomFeat.h +39 -0
  100. rdkit_headers/include/rdkit/GraphMol/Descriptors/BCUT.h +66 -0
  101. rdkit_headers/include/rdkit/GraphMol/Descriptors/ConnectivityDescriptors.h +211 -0
  102. rdkit_headers/include/rdkit/GraphMol/Descriptors/CoulombMat.h +42 -0
  103. rdkit_headers/include/rdkit/GraphMol/Descriptors/Crippen.h +137 -0
  104. rdkit_headers/include/rdkit/GraphMol/Descriptors/Data3Ddescriptors.h +55 -0
  105. rdkit_headers/include/rdkit/GraphMol/Descriptors/EEM.h +59 -0
  106. rdkit_headers/include/rdkit/GraphMol/Descriptors/GETAWAY.h +51 -0
  107. rdkit_headers/include/rdkit/GraphMol/Descriptors/Lipinski.h +169 -0
  108. rdkit_headers/include/rdkit/GraphMol/Descriptors/MORSE.h +50 -0
  109. rdkit_headers/include/rdkit/GraphMol/Descriptors/MQN.h +47 -0
  110. rdkit_headers/include/rdkit/GraphMol/Descriptors/MolData3Ddescriptors.h +62 -0
  111. rdkit_headers/include/rdkit/GraphMol/Descriptors/MolDescriptors.h +86 -0
  112. rdkit_headers/include/rdkit/GraphMol/Descriptors/MolDescriptors3D.h +25 -0
  113. rdkit_headers/include/rdkit/GraphMol/Descriptors/MolSurf.h +120 -0
  114. rdkit_headers/include/rdkit/GraphMol/Descriptors/PBF.h +60 -0
  115. rdkit_headers/include/rdkit/GraphMol/Descriptors/PMI.h +128 -0
  116. rdkit_headers/include/rdkit/GraphMol/Descriptors/Property.h +123 -0
  117. rdkit_headers/include/rdkit/GraphMol/Descriptors/RDF.h +52 -0
  118. rdkit_headers/include/rdkit/GraphMol/Descriptors/RegisterDescriptor.h +84 -0
  119. rdkit_headers/include/rdkit/GraphMol/Descriptors/USRDescriptor.h +137 -0
  120. rdkit_headers/include/rdkit/GraphMol/Descriptors/WHIM.h +51 -0
  121. rdkit_headers/include/rdkit/GraphMol/DistGeomHelpers/BoundsMatrixBuilder.h +77 -0
  122. rdkit_headers/include/rdkit/GraphMol/DistGeomHelpers/Embedder.h +437 -0
  123. rdkit_headers/include/rdkit/GraphMol/FMCS/FMCS.h +194 -0
  124. rdkit_headers/include/rdkit/GraphMol/FMCS/Graph.h +43 -0
  125. rdkit_headers/include/rdkit/GraphMol/FileParsers/FileParserUtils.h +231 -0
  126. rdkit_headers/include/rdkit/GraphMol/FileParsers/FileParsers.h +399 -0
  127. rdkit_headers/include/rdkit/GraphMol/FileParsers/GeneralFileReader.h +170 -0
  128. rdkit_headers/include/rdkit/GraphMol/FileParsers/MolFileStereochem.h +60 -0
  129. rdkit_headers/include/rdkit/GraphMol/FileParsers/MolSupplier.h +444 -0
  130. rdkit_headers/include/rdkit/GraphMol/FileParsers/MolWriters.h +338 -0
  131. rdkit_headers/include/rdkit/GraphMol/FileParsers/MultithreadedMolSupplier.h +102 -0
  132. rdkit_headers/include/rdkit/GraphMol/FileParsers/MultithreadedSDMolSupplier.h +65 -0
  133. rdkit_headers/include/rdkit/GraphMol/FileParsers/MultithreadedSmilesMolSupplier.h +66 -0
  134. rdkit_headers/include/rdkit/GraphMol/FileParsers/PNGParser.h +203 -0
  135. rdkit_headers/include/rdkit/GraphMol/FileParsers/SequenceParsers.h +117 -0
  136. rdkit_headers/include/rdkit/GraphMol/FileParsers/SequenceWriters.h +47 -0
  137. rdkit_headers/include/rdkit/GraphMol/FilterCatalog/FilterCatalog.h +260 -0
  138. rdkit_headers/include/rdkit/GraphMol/FilterCatalog/FilterCatalogEntry.h +276 -0
  139. rdkit_headers/include/rdkit/GraphMol/FilterCatalog/FilterMatcherBase.h +152 -0
  140. rdkit_headers/include/rdkit/GraphMol/FilterCatalog/FilterMatchers.h +576 -0
  141. rdkit_headers/include/rdkit/GraphMol/FilterCatalog/FunctionalGroupHierarchy.h +52 -0
  142. rdkit_headers/include/rdkit/GraphMol/Fingerprints/AtomPairGenerator.h +188 -0
  143. rdkit_headers/include/rdkit/GraphMol/Fingerprints/AtomPairs.h +268 -0
  144. rdkit_headers/include/rdkit/GraphMol/Fingerprints/FingerprintGenerator.h +372 -0
  145. rdkit_headers/include/rdkit/GraphMol/Fingerprints/FingerprintUtil.h +160 -0
  146. rdkit_headers/include/rdkit/GraphMol/Fingerprints/Fingerprints.h +167 -0
  147. rdkit_headers/include/rdkit/GraphMol/Fingerprints/MACCS.h +32 -0
  148. rdkit_headers/include/rdkit/GraphMol/Fingerprints/MHFP.h +285 -0
  149. rdkit_headers/include/rdkit/GraphMol/Fingerprints/MorganFingerprints.h +210 -0
  150. rdkit_headers/include/rdkit/GraphMol/Fingerprints/MorganGenerator.h +251 -0
  151. rdkit_headers/include/rdkit/GraphMol/Fingerprints/RDKitFPGenerator.h +162 -0
  152. rdkit_headers/include/rdkit/GraphMol/Fingerprints/TopologicalTorsionGenerator.h +127 -0
  153. rdkit_headers/include/rdkit/GraphMol/ForceFieldHelpers/CrystalFF/TorsionAngleM6.h +72 -0
  154. rdkit_headers/include/rdkit/GraphMol/ForceFieldHelpers/CrystalFF/TorsionPreferences.h +41 -0
  155. rdkit_headers/include/rdkit/GraphMol/ForceFieldHelpers/FFConvenience.h +130 -0
  156. rdkit_headers/include/rdkit/GraphMol/ForceFieldHelpers/MMFF/AtomTyper.h +236 -0
  157. rdkit_headers/include/rdkit/GraphMol/ForceFieldHelpers/MMFF/Builder.h +141 -0
  158. rdkit_headers/include/rdkit/GraphMol/ForceFieldHelpers/MMFF/MMFF.h +105 -0
  159. rdkit_headers/include/rdkit/GraphMol/ForceFieldHelpers/UFF/AtomTyper.h +57 -0
  160. rdkit_headers/include/rdkit/GraphMol/ForceFieldHelpers/UFF/Builder.h +129 -0
  161. rdkit_headers/include/rdkit/GraphMol/ForceFieldHelpers/UFF/UFF.h +82 -0
  162. rdkit_headers/include/rdkit/GraphMol/FragCatalog/FragCatGenerator.h +33 -0
  163. rdkit_headers/include/rdkit/GraphMol/FragCatalog/FragCatParams.h +94 -0
  164. rdkit_headers/include/rdkit/GraphMol/FragCatalog/FragCatalogEntry.h +136 -0
  165. rdkit_headers/include/rdkit/GraphMol/FragCatalog/FragCatalogUtils.h +62 -0
  166. rdkit_headers/include/rdkit/GraphMol/FragCatalog/FragFPGenerator.h +38 -0
  167. rdkit_headers/include/rdkit/GraphMol/GenericGroups/GenericGroups.h +301 -0
  168. rdkit_headers/include/rdkit/GraphMol/GraphMol.h +22 -0
  169. rdkit_headers/include/rdkit/GraphMol/MMPA/MMPA.h +81 -0
  170. rdkit_headers/include/rdkit/GraphMol/MolAlign/AlignMolecules.h +183 -0
  171. rdkit_headers/include/rdkit/GraphMol/MolAlign/O3AAlignMolecules.h +354 -0
  172. rdkit_headers/include/rdkit/GraphMol/MolBundle.h +121 -0
  173. rdkit_headers/include/rdkit/GraphMol/MolCatalog/MolCatalog.h +20 -0
  174. rdkit_headers/include/rdkit/GraphMol/MolCatalog/MolCatalogEntry.h +109 -0
  175. rdkit_headers/include/rdkit/GraphMol/MolCatalog/MolCatalogParams.h +40 -0
  176. rdkit_headers/include/rdkit/GraphMol/MolChemicalFeatures/FeatureParser.h +58 -0
  177. rdkit_headers/include/rdkit/GraphMol/MolChemicalFeatures/MolChemicalFeature.h +98 -0
  178. rdkit_headers/include/rdkit/GraphMol/MolChemicalFeatures/MolChemicalFeatureDef.h +68 -0
  179. rdkit_headers/include/rdkit/GraphMol/MolChemicalFeatures/MolChemicalFeatureFactory.h +78 -0
  180. rdkit_headers/include/rdkit/GraphMol/MolDraw2D/MolDraw2D.h +539 -0
  181. rdkit_headers/include/rdkit/GraphMol/MolDraw2D/MolDraw2DHelpers.h +284 -0
  182. rdkit_headers/include/rdkit/GraphMol/MolDraw2D/MolDraw2DJS.h +62 -0
  183. rdkit_headers/include/rdkit/GraphMol/MolDraw2D/MolDraw2DSVG.h +88 -0
  184. rdkit_headers/include/rdkit/GraphMol/MolDraw2D/MolDraw2DUtils.h +179 -0
  185. rdkit_headers/include/rdkit/GraphMol/MolDraw2D/MolDraw2Dwx.h +107 -0
  186. rdkit_headers/include/rdkit/GraphMol/MolEnumerator/LinkNode.h +159 -0
  187. rdkit_headers/include/rdkit/GraphMol/MolEnumerator/MolEnumerator.h +276 -0
  188. rdkit_headers/include/rdkit/GraphMol/MolHash/MolHash.h +12 -0
  189. rdkit_headers/include/rdkit/GraphMol/MolHash/nmmolhash.h +60 -0
  190. rdkit_headers/include/rdkit/GraphMol/MolInterchange/MolInterchange.h +93 -0
  191. rdkit_headers/include/rdkit/GraphMol/MolInterchange/details.h +49 -0
  192. rdkit_headers/include/rdkit/GraphMol/MolOps.h +1016 -0
  193. rdkit_headers/include/rdkit/GraphMol/MolPickler.h +314 -0
  194. rdkit_headers/include/rdkit/GraphMol/MolStandardize/AcidBaseCatalog/AcidBaseCatalogEntry.h +56 -0
  195. rdkit_headers/include/rdkit/GraphMol/MolStandardize/AcidBaseCatalog/AcidBaseCatalogParams.h +65 -0
  196. rdkit_headers/include/rdkit/GraphMol/MolStandardize/AcidBaseCatalog/AcidBaseCatalogUtils.h +37 -0
  197. rdkit_headers/include/rdkit/GraphMol/MolStandardize/Charge.h +145 -0
  198. rdkit_headers/include/rdkit/GraphMol/MolStandardize/Fragment.h +105 -0
  199. rdkit_headers/include/rdkit/GraphMol/MolStandardize/FragmentCatalog/FragmentCatalogEntry.h +60 -0
  200. rdkit_headers/include/rdkit/GraphMol/MolStandardize/FragmentCatalog/FragmentCatalogParams.h +63 -0
  201. rdkit_headers/include/rdkit/GraphMol/MolStandardize/FragmentCatalog/FragmentCatalogUtils.h +35 -0
  202. rdkit_headers/include/rdkit/GraphMol/MolStandardize/Metal.h +73 -0
  203. rdkit_headers/include/rdkit/GraphMol/MolStandardize/MolStandardize.h +178 -0
  204. rdkit_headers/include/rdkit/GraphMol/MolStandardize/Normalize.h +104 -0
  205. rdkit_headers/include/rdkit/GraphMol/MolStandardize/Tautomer.h +428 -0
  206. rdkit_headers/include/rdkit/GraphMol/MolStandardize/TautomerCatalog/TautomerCatalogEntry.h +59 -0
  207. rdkit_headers/include/rdkit/GraphMol/MolStandardize/TautomerCatalog/TautomerCatalogParams.h +69 -0
  208. rdkit_headers/include/rdkit/GraphMol/MolStandardize/TautomerCatalog/TautomerCatalogUtils.h +81 -0
  209. rdkit_headers/include/rdkit/GraphMol/MolStandardize/TransformCatalog/TransformCatalogEntry.h +57 -0
  210. rdkit_headers/include/rdkit/GraphMol/MolStandardize/TransformCatalog/TransformCatalogParams.h +66 -0
  211. rdkit_headers/include/rdkit/GraphMol/MolStandardize/TransformCatalog/TransformCatalogUtils.h +37 -0
  212. rdkit_headers/include/rdkit/GraphMol/MolStandardize/Validate.h +199 -0
  213. rdkit_headers/include/rdkit/GraphMol/MolTransforms/MolTransforms.h +222 -0
  214. rdkit_headers/include/rdkit/GraphMol/MonomerInfo.h +138 -0
  215. rdkit_headers/include/rdkit/GraphMol/PartialCharges/GasteigerCharges.h +27 -0
  216. rdkit_headers/include/rdkit/GraphMol/PartialCharges/GasteigerParams.h +86 -0
  217. rdkit_headers/include/rdkit/GraphMol/PeriodicTable.h +325 -0
  218. rdkit_headers/include/rdkit/GraphMol/QueryAtom.h +161 -0
  219. rdkit_headers/include/rdkit/GraphMol/QueryBond.h +146 -0
  220. rdkit_headers/include/rdkit/GraphMol/QueryOps.h +1110 -0
  221. rdkit_headers/include/rdkit/GraphMol/RDKitBase.h +35 -0
  222. rdkit_headers/include/rdkit/GraphMol/RDKitQueries.h +25 -0
  223. rdkit_headers/include/rdkit/GraphMol/RGroupDecomposition/RGroupDecomp.h +225 -0
  224. rdkit_headers/include/rdkit/GraphMol/ROMol.h +844 -0
  225. rdkit_headers/include/rdkit/GraphMol/RWMol.h +222 -0
  226. rdkit_headers/include/rdkit/GraphMol/ReducedGraphs/ReducedGraphs.h +85 -0
  227. rdkit_headers/include/rdkit/GraphMol/Resonance.h +236 -0
  228. rdkit_headers/include/rdkit/GraphMol/RingInfo.h +274 -0
  229. rdkit_headers/include/rdkit/GraphMol/Rings.h +90 -0
  230. rdkit_headers/include/rdkit/GraphMol/SLNParse/SLNAttribs.h +93 -0
  231. rdkit_headers/include/rdkit/GraphMol/SLNParse/SLNParse.h +70 -0
  232. rdkit_headers/include/rdkit/GraphMol/SLNParse/SLNParseOps.h +328 -0
  233. rdkit_headers/include/rdkit/GraphMol/SanitException.h +120 -0
  234. rdkit_headers/include/rdkit/GraphMol/ScaffoldNetwork/ScaffoldNetwork.h +195 -0
  235. rdkit_headers/include/rdkit/GraphMol/ShapeHelpers/ShapeEncoder.h +73 -0
  236. rdkit_headers/include/rdkit/GraphMol/ShapeHelpers/ShapeUtils.h +279 -0
  237. rdkit_headers/include/rdkit/GraphMol/SmilesParse/SmartsWrite.h +46 -0
  238. rdkit_headers/include/rdkit/GraphMol/SmilesParse/SmilesParse.h +160 -0
  239. rdkit_headers/include/rdkit/GraphMol/SmilesParse/SmilesParseOps.h +53 -0
  240. rdkit_headers/include/rdkit/GraphMol/SmilesParse/SmilesWrite.h +288 -0
  241. rdkit_headers/include/rdkit/GraphMol/SmilesParse/primes.h +18 -0
  242. rdkit_headers/include/rdkit/GraphMol/StereoGroup.h +74 -0
  243. rdkit_headers/include/rdkit/GraphMol/Subgraphs/SubgraphUtils.h +57 -0
  244. rdkit_headers/include/rdkit/GraphMol/Subgraphs/Subgraphs.h +154 -0
  245. rdkit_headers/include/rdkit/GraphMol/SubstanceGroup.h +297 -0
  246. rdkit_headers/include/rdkit/GraphMol/Substruct/SubstructMatch.h +232 -0
  247. rdkit_headers/include/rdkit/GraphMol/Substruct/SubstructUtils.h +44 -0
  248. rdkit_headers/include/rdkit/GraphMol/SubstructLibrary/PatternFactory.h +40 -0
  249. rdkit_headers/include/rdkit/GraphMol/SubstructLibrary/SubstructLibrary.h +951 -0
  250. rdkit_headers/include/rdkit/GraphMol/SubstructLibrary/SubstructLibrarySerialization.h +231 -0
  251. rdkit_headers/include/rdkit/GraphMol/TautomerQuery/TautomerQuery.h +104 -0
  252. rdkit_headers/include/rdkit/GraphMol/Trajectory/Snapshot.h +69 -0
  253. rdkit_headers/include/rdkit/GraphMol/Trajectory/Trajectory.h +105 -0
  254. rdkit_headers/include/rdkit/GraphMol/atomic_data.h +76 -0
  255. rdkit_headers/include/rdkit/GraphMol/details.h +15 -0
  256. rdkit_headers/include/rdkit/GraphMol/new_canon.h +772 -0
  257. rdkit_headers/include/rdkit/Numerics/Alignment/AlignPoints.h +49 -0
  258. rdkit_headers/include/rdkit/Numerics/Conrec.h +203 -0
  259. rdkit_headers/include/rdkit/Numerics/EigenSolvers/PowerEigenSolver.h +68 -0
  260. rdkit_headers/include/rdkit/Numerics/Matrix.h +347 -0
  261. rdkit_headers/include/rdkit/Numerics/Optimizer/BFGSOpt.h +397 -0
  262. rdkit_headers/include/rdkit/Numerics/SquareMatrix.h +89 -0
  263. rdkit_headers/include/rdkit/Numerics/SymmMatrix.h +361 -0
  264. rdkit_headers/include/rdkit/Numerics/Vector.h +327 -0
  265. rdkit_headers/include/rdkit/Query/AndQuery.h +57 -0
  266. rdkit_headers/include/rdkit/Query/EqualityQuery.h +88 -0
  267. rdkit_headers/include/rdkit/Query/GreaterEqualQuery.h +74 -0
  268. rdkit_headers/include/rdkit/Query/GreaterQuery.h +74 -0
  269. rdkit_headers/include/rdkit/Query/LessEqualQuery.h +75 -0
  270. rdkit_headers/include/rdkit/Query/LessQuery.h +74 -0
  271. rdkit_headers/include/rdkit/Query/NullQueryAlgebra.h +86 -0
  272. rdkit_headers/include/rdkit/Query/OrQuery.h +58 -0
  273. rdkit_headers/include/rdkit/Query/Query.h +210 -0
  274. rdkit_headers/include/rdkit/Query/QueryObjects.h +38 -0
  275. rdkit_headers/include/rdkit/Query/RangeQuery.h +116 -0
  276. rdkit_headers/include/rdkit/Query/SetQuery.h +87 -0
  277. rdkit_headers/include/rdkit/Query/XOrQuery.h +63 -0
  278. rdkit_headers/include/rdkit/RDGeneral/BadFileException.h +39 -0
  279. rdkit_headers/include/rdkit/RDGeneral/BoostEndInclude.h +69 -0
  280. rdkit_headers/include/rdkit/RDGeneral/BoostStartInclude.h +95 -0
  281. rdkit_headers/include/rdkit/RDGeneral/ConcurrentQueue.h +132 -0
  282. rdkit_headers/include/rdkit/RDGeneral/Dict.h +350 -0
  283. rdkit_headers/include/rdkit/RDGeneral/Exceptions.h +73 -0
  284. rdkit_headers/include/rdkit/RDGeneral/FileParseException.h +36 -0
  285. rdkit_headers/include/rdkit/RDGeneral/Invariant.h +198 -0
  286. rdkit_headers/include/rdkit/RDGeneral/LocaleSwitcher.h +54 -0
  287. rdkit_headers/include/rdkit/RDGeneral/RDAny.h +217 -0
  288. rdkit_headers/include/rdkit/RDGeneral/RDConfig.h +49 -0
  289. rdkit_headers/include/rdkit/RDGeneral/RDExportMacros.h +40 -0
  290. rdkit_headers/include/rdkit/RDGeneral/RDLog.h +142 -0
  291. rdkit_headers/include/rdkit/RDGeneral/RDProps.h +172 -0
  292. rdkit_headers/include/rdkit/RDGeneral/RDThreads.h +44 -0
  293. rdkit_headers/include/rdkit/RDGeneral/RDValue-doublemagic.h +478 -0
  294. rdkit_headers/include/rdkit/RDGeneral/RDValue-taggedunion.h +518 -0
  295. rdkit_headers/include/rdkit/RDGeneral/RDValue.h +285 -0
  296. rdkit_headers/include/rdkit/RDGeneral/Ranking.h +87 -0
  297. rdkit_headers/include/rdkit/RDGeneral/StreamOps.h +637 -0
  298. rdkit_headers/include/rdkit/RDGeneral/export.h +559 -0
  299. rdkit_headers/include/rdkit/RDGeneral/hanoiSort.h +167 -0
  300. rdkit_headers/include/rdkit/RDGeneral/hash/detail/float_functions.hpp +156 -0
  301. rdkit_headers/include/rdkit/RDGeneral/hash/detail/hash_float.hpp +179 -0
  302. rdkit_headers/include/rdkit/RDGeneral/hash/extensions.hpp +152 -0
  303. rdkit_headers/include/rdkit/RDGeneral/hash/hash.hpp +463 -0
  304. rdkit_headers/include/rdkit/RDGeneral/hash/hash_fwd.hpp +51 -0
  305. rdkit_headers/include/rdkit/RDGeneral/test.h +274 -0
  306. rdkit_headers/include/rdkit/RDGeneral/types.h +401 -0
  307. rdkit_headers/include/rdkit/RDGeneral/utils.h +106 -0
  308. rdkit_headers/include/rdkit/RDGeneral/versions.h +27 -0
  309. rdkit_headers/include/rdkit/RDStreams/streams.h +19 -0
  310. rdkit_headers/include/rdkit/RingDecomposerLib.h +751 -0
  311. rdkit_headers/include/rdkit/SimDivPickers/DistPicker.h +92 -0
  312. rdkit_headers/include/rdkit/SimDivPickers/HierarchicalClusterPicker.h +107 -0
  313. rdkit_headers/include/rdkit/SimDivPickers/LeaderPicker.h +470 -0
  314. rdkit_headers/include/rdkit/SimDivPickers/MaxMinPicker.h +303 -0
  315. rdkit_headers-2022.3.3.dist-info/METADATA +24 -0
  316. rdkit_headers-2022.3.3.dist-info/RECORD +320 -0
  317. rdkit_headers-2022.3.3.dist-info/WHEEL +4 -0
  318. rdkit_headers-2022.3.3.dist-info/entry_points.txt +4 -0
  319. rdkit_headers-2022.3.3.dist-info/licenses/LICENSE +29 -0
  320. rdkit_headers-2022.3.3.dist-info/licenses/NOTICE +5 -0
@@ -0,0 +1,951 @@
1
+ // Copyright (c) 2017-2021, Novartis Institutes for BioMedical Research Inc.
2
+ // and other RDKit contributors
3
+ //
4
+ // All rights reserved.
5
+ //
6
+ // Redistribution and use in source and binary forms, with or without
7
+ // modification, are permitted provided that the following conditions are
8
+ // met:
9
+ //
10
+ // * Redistributions of source code must retain the above copyright
11
+ // notice, this list of conditions and the following disclaimer.
12
+ // * Redistributions in binary form must reproduce the above
13
+ // copyright notice, this list of conditions and the following
14
+ // disclaimer in the documentation and/or other materials provided
15
+ // with the distribution.
16
+ // * Neither the name of Novartis Institutes for BioMedical Research Inc.
17
+ // nor the names of its contributors may be used to endorse or promote
18
+ // products derived from this software without specific prior written
19
+ // permission.
20
+ //
21
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
+ //
33
+ #ifndef RDK_SUBSTRUCT_LIBRARY
34
+ #define RDK_SUBSTRUCT_LIBRARY
35
+ #include <utility>
36
+
37
+ #include <RDGeneral/export.h>
38
+ #include <GraphMol/RDKitBase.h>
39
+ #include <GraphMol/MolPickler.h>
40
+ #include <GraphMol/MolBundle.h>
41
+ #include <GraphMol/SmilesParse/SmilesParse.h>
42
+ #include <GraphMol/SmilesParse/SmilesWrite.h>
43
+ #include <GraphMol/Fingerprints/Fingerprints.h>
44
+ #include <GraphMol/Substruct/SubstructMatch.h>
45
+ #include <DataStructs/ExplicitBitVect.h>
46
+ #include <DataStructs/BitOps.h>
47
+ #include <GraphMol/MolOps.h>
48
+ #include <GraphMol/TautomerQuery/TautomerQuery.h>
49
+
50
+ #include <algorithm>
51
+ #include <string>
52
+ #include <boost/lexical_cast.hpp>
53
+
54
+ namespace RDKit {
55
+
56
+ RDKIT_SUBSTRUCTLIBRARY_EXPORT bool SubstructLibraryCanSerialize();
57
+
58
+ //! Base class API for holding molecules to substructure search.
59
+ /*!
60
+ This is an API that hides the implementation details used for
61
+ indexing molecules for substructure searching. It simply
62
+ provides an API for adding and getting molecules from a set.
63
+ */
64
+ class RDKIT_SUBSTRUCTLIBRARY_EXPORT MolHolderBase {
65
+ public:
66
+ virtual ~MolHolderBase() {}
67
+
68
+ //! Add a new molecule to the substructure search library
69
+ //! Returns the molecules index in the library
70
+ virtual unsigned int addMol(const ROMol &m) = 0;
71
+
72
+ // implementations should throw IndexError on out of range
73
+ virtual boost::shared_ptr<ROMol> getMol(unsigned int) const = 0;
74
+
75
+ //! Get the current library size
76
+ virtual unsigned int size() const = 0;
77
+ };
78
+
79
+ //! Concrete class that holds molecules in memory
80
+ /*!
81
+ This is currently one of the faster implementations.
82
+ However it is very memory intensive.
83
+ */
84
+ class RDKIT_SUBSTRUCTLIBRARY_EXPORT MolHolder : public MolHolderBase {
85
+ std::vector<boost::shared_ptr<ROMol>> mols;
86
+
87
+ public:
88
+ MolHolder() : MolHolderBase(), mols() {}
89
+
90
+ unsigned int addMol(const ROMol &m) override {
91
+ mols.push_back(boost::make_shared<ROMol>(m));
92
+ return size() - 1;
93
+ }
94
+
95
+ boost::shared_ptr<ROMol> getMol(unsigned int idx) const override {
96
+ if (idx >= mols.size()) {
97
+ throw IndexErrorException(idx);
98
+ }
99
+ return mols[idx];
100
+ }
101
+
102
+ unsigned int size() const override {
103
+ return rdcast<unsigned int>(mols.size());
104
+ }
105
+
106
+ std::vector<boost::shared_ptr<ROMol>> &getMols() { return mols; }
107
+ const std::vector<boost::shared_ptr<ROMol>> &getMols() const { return mols; }
108
+ };
109
+
110
+ //! Concrete class that holds binary cached molecules in memory
111
+ /*!
112
+ This implementation uses quite a bit less memory than the
113
+ non cached implementation. However, due to the reduced speed
114
+ it should be used in conjunction with a pattern fingerprinter.
115
+
116
+ See RDKit::FPHolder
117
+ */
118
+ class RDKIT_SUBSTRUCTLIBRARY_EXPORT CachedMolHolder : public MolHolderBase {
119
+ std::vector<std::string> mols;
120
+
121
+ public:
122
+ CachedMolHolder() : MolHolderBase(), mols() {}
123
+
124
+ unsigned int addMol(const ROMol &m) override {
125
+ mols.emplace_back();
126
+ MolPickler::pickleMol(m, mols.back());
127
+ return size() - 1;
128
+ }
129
+
130
+ //! Adds a pickled binary molecule, no validity checking of the input
131
+ //! is done.
132
+ unsigned int addBinary(const std::string &pickle) {
133
+ mols.push_back(pickle);
134
+ return size() - 1;
135
+ }
136
+
137
+ boost::shared_ptr<ROMol> getMol(unsigned int idx) const override {
138
+ if (idx >= mols.size()) {
139
+ throw IndexErrorException(idx);
140
+ }
141
+ boost::shared_ptr<ROMol> mol(new ROMol);
142
+ MolPickler::molFromPickle(mols[idx], mol.get());
143
+ return mol;
144
+ }
145
+
146
+ unsigned int size() const override {
147
+ return rdcast<unsigned int>(mols.size());
148
+ }
149
+
150
+ std::vector<std::string> &getMols() { return mols; }
151
+ const std::vector<std::string> &getMols() const { return mols; }
152
+ };
153
+
154
+ //! Concrete class that holds smiles strings in memory
155
+ /*!
156
+ This implementation uses quite a bit less memory than the
157
+ cached binary or uncached implementation. However, due to the
158
+ reduced speed it should be used in conjunction with a pattern
159
+ fingerprinter.
160
+
161
+ See RDKit::FPHolder
162
+ */
163
+ class RDKIT_SUBSTRUCTLIBRARY_EXPORT CachedSmilesMolHolder
164
+ : public MolHolderBase {
165
+ std::vector<std::string> mols;
166
+
167
+ public:
168
+ CachedSmilesMolHolder() : MolHolderBase(), mols() {}
169
+
170
+ unsigned int addMol(const ROMol &m) override {
171
+ bool doIsomericSmiles = true;
172
+ mols.push_back(MolToSmiles(m, doIsomericSmiles));
173
+ return size() - 1;
174
+ }
175
+
176
+ //! Add a smiles to the dataset, no validation is done
177
+ //! to the inputs.
178
+ unsigned int addSmiles(const std::string &smiles) {
179
+ mols.push_back(smiles);
180
+ return size() - 1;
181
+ }
182
+
183
+ boost::shared_ptr<ROMol> getMol(unsigned int idx) const override {
184
+ if (idx >= mols.size()) {
185
+ throw IndexErrorException(idx);
186
+ }
187
+
188
+ boost::shared_ptr<ROMol> mol(SmilesToMol(mols[idx]));
189
+ return mol;
190
+ }
191
+
192
+ unsigned int size() const override {
193
+ return rdcast<unsigned int>(mols.size());
194
+ }
195
+
196
+ std::vector<std::string> &getMols() { return mols; }
197
+ const std::vector<std::string> &getMols() const { return mols; }
198
+ };
199
+
200
+ //! Concrete class that holds trusted smiles strings in memory
201
+ /*!
202
+ A trusted smiles is essentially a smiles string that
203
+ RDKit has generated. This indicates that fewer
204
+ sanitization steps are required. See
205
+ http://rdkit.blogspot.com/2016/09/avoiding-unnecessary-work-and.html
206
+
207
+ This implementation uses quite a bit less memory than the
208
+ cached binary or uncached implementation. However, due to the
209
+ reduced speed it should be used in conjunction with a pattern
210
+ fingerprinter.
211
+
212
+ See RDKit::FPHolder
213
+ */
214
+ class RDKIT_SUBSTRUCTLIBRARY_EXPORT CachedTrustedSmilesMolHolder
215
+ : public MolHolderBase {
216
+ std::vector<std::string> mols;
217
+
218
+ public:
219
+ CachedTrustedSmilesMolHolder() : MolHolderBase(), mols() {}
220
+
221
+ unsigned int addMol(const ROMol &m) override {
222
+ bool doIsomericSmiles = true;
223
+ mols.push_back(MolToSmiles(m, doIsomericSmiles));
224
+ return size() - 1;
225
+ }
226
+
227
+ //! Add a smiles to the dataset, no validation is done
228
+ //! to the inputs.
229
+ unsigned int addSmiles(const std::string &smiles) {
230
+ mols.push_back(smiles);
231
+ return size() - 1;
232
+ }
233
+
234
+ boost::shared_ptr<ROMol> getMol(unsigned int idx) const override {
235
+ if (idx >= mols.size()) {
236
+ throw IndexErrorException(idx);
237
+ }
238
+
239
+ RWMol *m = SmilesToMol(mols[idx], 0, false);
240
+ if (m) {
241
+ m->updatePropertyCache();
242
+ }
243
+ return boost::shared_ptr<ROMol>(m);
244
+ }
245
+
246
+ unsigned int size() const override {
247
+ return rdcast<unsigned int>(mols.size());
248
+ }
249
+
250
+ std::vector<std::string> &getMols() { return mols; }
251
+ const std::vector<std::string> &getMols() const { return mols; }
252
+ };
253
+
254
+ //! Base FPI for the fingerprinter used to rule out impossible matches
255
+ class RDKIT_SUBSTRUCTLIBRARY_EXPORT FPHolderBase {
256
+ std::vector<ExplicitBitVect *> fps;
257
+
258
+ public:
259
+ virtual ~FPHolderBase() {
260
+ for (size_t i = 0; i < fps.size(); ++i) {
261
+ delete fps[i];
262
+ }
263
+ }
264
+
265
+ virtual unsigned int size() const { return rdcast<unsigned int>(fps.size()); }
266
+
267
+ //! Adds a molecule to the fingerprinter
268
+ unsigned int addMol(const ROMol &m) {
269
+ fps.push_back(makeFingerprint(m));
270
+ return rdcast<unsigned int>(fps.size() - 1);
271
+ }
272
+
273
+ //! Adds a raw bit vector pointer to the fingerprinter, which takes ownership
274
+ //! PLEASE NOTE: make sure that the passed ExplicitBitVect
275
+ //! is compatible with the one generated by makeFingerprint()
276
+ unsigned int addFingerprint(ExplicitBitVect *v) {
277
+ fps.push_back(v);
278
+ return rdcast<unsigned int>(fps.size() - 1);
279
+ }
280
+
281
+ //! Adds a raw bit vector to the fingerprinter
282
+ //! PLEASE NOTE: make sure that the passed ExplicitBitVect
283
+ //! is compatible with the one generated by makeFingerprint()
284
+ unsigned int addFingerprint(const ExplicitBitVect &v) {
285
+ return addFingerprint(new ExplicitBitVect(v));
286
+ }
287
+
288
+ //! Return false if a substructure search can never match the molecule
289
+ bool passesFilter(unsigned int idx, const ExplicitBitVect &query) const {
290
+ if (idx >= fps.size()) {
291
+ throw IndexErrorException(idx);
292
+ }
293
+
294
+ return AllProbeBitsMatch(query, *fps[idx]);
295
+ }
296
+
297
+ //! Get the bit vector at the specified index (throws IndexError if out of
298
+ //! range)
299
+ const ExplicitBitVect &getFingerprint(unsigned int idx) const {
300
+ if (idx >= fps.size()) {
301
+ throw IndexErrorException(idx);
302
+ }
303
+ return *fps[idx];
304
+ }
305
+
306
+ //! make the query vector
307
+ //! Caller owns the vector!
308
+ virtual ExplicitBitVect *makeFingerprint(const ROMol &m) const = 0;
309
+
310
+ std::vector<ExplicitBitVect *> &getFingerprints() { return fps; }
311
+ const std::vector<ExplicitBitVect *> &getFingerprints() const { return fps; }
312
+ };
313
+
314
+ //! Uses the pattern fingerprinter with a user-defined number of bits (default:
315
+ //! 2048) to rule out matches
316
+ class RDKIT_SUBSTRUCTLIBRARY_EXPORT PatternHolder : public FPHolderBase {
317
+ unsigned int numBits;
318
+
319
+ public:
320
+ PatternHolder() : FPHolderBase(), numBits(defaultNumBits()) {}
321
+ PatternHolder(unsigned int numBits) : FPHolderBase(), numBits(numBits) {}
322
+ //! Caller owns the vector!
323
+ ExplicitBitVect *makeFingerprint(const ROMol &m) const override {
324
+ return PatternFingerprintMol(m, numBits);
325
+ }
326
+ const unsigned int &getNumBits() const { return numBits; };
327
+ unsigned int &getNumBits() { return numBits; };
328
+ static unsigned int defaultNumBits() {
329
+ static const unsigned int DEFAULT_NUM_BITS = 2048;
330
+ return DEFAULT_NUM_BITS;
331
+ };
332
+ };
333
+
334
+ class RDKIT_SUBSTRUCTLIBRARY_EXPORT TautomerPatternHolder
335
+ : public PatternHolder {
336
+ public:
337
+ TautomerPatternHolder() : PatternHolder() {}
338
+ TautomerPatternHolder(unsigned int numBits) : PatternHolder(numBits) {}
339
+ ExplicitBitVect *makeFingerprint(const ROMol &m) const override {
340
+ std::vector<unsigned int> *atomCounts = nullptr;
341
+ ExplicitBitVect *setOnlyBits = nullptr;
342
+ const bool tautomericFingerprint = true;
343
+ return PatternFingerprintMol(m, getNumBits(), atomCounts, setOnlyBits,
344
+ tautomericFingerprint);
345
+ }
346
+ };
347
+
348
+ class RDKIT_SUBSTRUCTLIBRARY_EXPORT KeyHolderBase {
349
+ public:
350
+ virtual ~KeyHolderBase() {}
351
+
352
+ //! Add a key to the database getting it from the molecule
353
+ virtual unsigned int addMol(const ROMol &m) = 0;
354
+
355
+ //! Add a key to the database, this needs to be in the same order
356
+ //! as the molecule, no validation is done
357
+ virtual unsigned int addKey(const std::string &) = 0;
358
+
359
+ // !get the key at the requested index
360
+ // implementations should throw IndexError on out of range
361
+ virtual const std::string &getKey(unsigned int) const = 0;
362
+
363
+ // !get keys from a bunch of indices
364
+ virtual std::vector<std::string> getKeys(
365
+ const std::vector<unsigned int> &indices) const = 0;
366
+ //! Get the current keeyholder size
367
+ virtual unsigned int size() const = 0;
368
+ };
369
+
370
+ class RDKIT_SUBSTRUCTLIBRARY_EXPORT KeyFromPropHolder : public KeyHolderBase {
371
+ std::string propname;
372
+ std::vector<std::string> keys;
373
+ const std::string empty_string = {};
374
+
375
+ public:
376
+ KeyFromPropHolder(const std::string &propname = "_Name")
377
+ : propname(propname) {}
378
+
379
+ std::string &getPropName() { return propname; }
380
+ const std::string &getPropName() const { return propname; }
381
+
382
+ std::vector<std::string> &getKeys() { return keys; }
383
+ const std::vector<std::string> &getKeys() const { return keys; }
384
+
385
+ unsigned int addMol(const ROMol &m) override {
386
+ std::string key;
387
+ if (m.getPropIfPresent(propname, key)) {
388
+ keys.push_back(std::move(key));
389
+ } else {
390
+ // XXX is this a warning? it could be verbose. Should we push back the
391
+ // string repr of the
392
+ // numeric index?
393
+ const static std::string prefix("LIBIDX-");
394
+ keys.emplace_back(prefix + boost::lexical_cast<std::string>(keys.size()));
395
+ }
396
+ return keys.size() - 1u;
397
+ };
398
+
399
+ unsigned int addKey(const std::string &key) override {
400
+ keys.push_back(key);
401
+ return keys.size() - 1u;
402
+ }
403
+
404
+ const std::string &getKey(unsigned int idx) const override {
405
+ if (idx >= keys.size()) {
406
+ throw IndexErrorException(idx);
407
+ }
408
+ return keys[idx];
409
+ }
410
+
411
+ std::vector<std::string> getKeys(
412
+ const std::vector<unsigned int> &indices) const override {
413
+ std::vector<std::string> res;
414
+ std::transform(indices.begin(), indices.end(), std::back_inserter(res),
415
+ [=](unsigned idx) { return keys.at(idx); });
416
+ return res;
417
+ }
418
+ unsigned int size() const override { return keys.size(); }
419
+ };
420
+
421
+ //! Substructure Search a library of molecules
422
+ /*! This class allows for multithreaded substructure searches of
423
+ large datasets.
424
+
425
+ The implementations can use fingerprints to speed up searches
426
+ and have molecules cached as binary forms to reduce memory
427
+ usage.
428
+
429
+ basic usage:
430
+ \code
431
+ SubstructLibrary lib;
432
+ lib.addMol(mol);
433
+ std::vector<unsigned int> results = lib.getMatches(query);
434
+ for(std::vector<unsigned int>::const_iterator matchIndex=results.begin();
435
+ matchIndex != results.end();
436
+ ++matchIndex) {
437
+ boost::shared_ptr<ROMol> match = lib.getMol(*matchIndex);
438
+ }
439
+ \endcode
440
+
441
+ Using different mol holders and pattern fingerprints.
442
+
443
+ \code
444
+ boost::shared_ptr<CachedTrustedSmilesMolHolder> molHolder = \
445
+ boost::make_shared<CachedTrustedSmilesMolHolder>();
446
+ boost::shared_ptr<PatternHolder> patternHolder = \
447
+ boost::make_shared<PatternHolder>();
448
+
449
+ SubstructLibrary lib(molHolder, patternHolder);
450
+ lib.addMol(mol);
451
+ \endcode
452
+
453
+ Cached molecule holders create molecules on demand. There are currently
454
+ three styles of cached molecules.
455
+
456
+ CachedMolHolder: stores molecules in the rdkit binary format.
457
+ CachedSmilesMolHolder: stores molecules in smiles format.
458
+ CachedTrustedSmilesMolHolder: stores molecules in smiles format.
459
+
460
+ The CachedTrustedSmilesMolHolder is made to add molecules from
461
+ a trusted source. This makes the basic assumption that RDKit was
462
+ used to sanitize and canonicalize the smiles string. In practice
463
+ this is considerably faster than using arbitrary smiles strings since
464
+ certain assumptions can be made. Molecules generated from trusted
465
+ smiles do not have ring information (although this is created
466
+ in the molecule being searched if necessary).
467
+
468
+ When loading from external data, as opposed to using the "addMol" API,
469
+ care must be taken to ensure that the pattern fingerprints and smiles
470
+ are synchronized.
471
+
472
+ Each pattern holder has an API point for making its fingerprint. This
473
+ is useful to ensure that the pattern stored in the database will be
474
+ compatible with the patterns made when analyzing queries.
475
+
476
+ \code
477
+ boost::shared_ptr<CachedTrustedSmilesMolHolder> molHolder = \
478
+ boost::make_shared<CachedTrustedSmilesMolHolder>();
479
+ boost::shared_ptr<PatternHolder> patternHolder = \
480
+ boost::make_shared<PatternHolder>();
481
+
482
+ // the PatternHolder instance is able to make fingerprints.
483
+ // These, of course, can be read from a file. For demonstration
484
+ // purposes we construct them here.
485
+ const std::string trustedSmiles = "c1ccccc1";
486
+ ROMol *m = SmilesToMol(trustedSmiles);
487
+ const ExplicitBitVect *bitVector = patternHolder->makeFingerprint(*m);
488
+
489
+ // The trusted smiles and bitVector can be read from any source.
490
+ // This is the fastest way to load a substruct library.
491
+ molHolder->addSmiles( trustedSmiles );
492
+ patternHolder->addFingerprint( *bitVector );
493
+ SubstructLibrary lib(molHolder, patternHolder);
494
+ delete m;
495
+ delete bitVector;
496
+ \endcode
497
+
498
+ Finally, using the KeyFromPropHolder will store user ids or keys.
499
+ By default, it uses RDKit's default _Name prop, but can be changed
500
+ to any property.
501
+
502
+ \code
503
+ boost::shared_ptr<CachedTrustedSmilesMolHolder> molHolder = \
504
+ boost::make_shared<CachedTrustedSmilesMolHolder>();
505
+ boost::shared_ptr<KeyFromPropHolder> keyHolder = \
506
+ boost::make_shared<KeyFromPropHolder>();
507
+ SubstructLibrary lib(molHolder, keyHolder);
508
+ ...
509
+
510
+ You can get the keys in multiple through the use of the keyholder
511
+ auto key = lib.getKeys().getKey(idx);
512
+ auto keys = lib.getKeys().getKeys(lib.GetMatch(query));
513
+ \endcode
514
+
515
+ */
516
+ class RDKIT_SUBSTRUCTLIBRARY_EXPORT SubstructLibrary {
517
+ boost::shared_ptr<MolHolderBase> molholder;
518
+ boost::shared_ptr<FPHolderBase> fpholder;
519
+ boost::shared_ptr<KeyHolderBase> keyholder;
520
+
521
+ MolHolderBase *mols; // used for a small optimization
522
+ FPHolderBase *fps{nullptr};
523
+ bool is_tautomerquery = false;
524
+ std::vector<unsigned int> searchOrder;
525
+
526
+ public:
527
+ SubstructLibrary()
528
+ : molholder(new MolHolder),
529
+ fpholder(),
530
+ keyholder(),
531
+ mols(molholder.get()) {}
532
+
533
+ SubstructLibrary(boost::shared_ptr<MolHolderBase> molecules)
534
+ : molholder(std::move(molecules)),
535
+ fpholder(),
536
+ keyholder(),
537
+ mols(molholder.get()),
538
+ fps(nullptr) {}
539
+
540
+ SubstructLibrary(boost::shared_ptr<MolHolderBase> molecules,
541
+ boost::shared_ptr<FPHolderBase> fingerprints)
542
+ : molholder(std::move(molecules)),
543
+ fpholder(std::move(fingerprints)),
544
+ keyholder(),
545
+ mols(molholder.get()),
546
+ fps(fpholder.get()) {
547
+ if (fpholder.get() &&
548
+ dynamic_cast<TautomerPatternHolder *>(fpholder.get()) != nullptr) {
549
+ is_tautomerquery = true;
550
+ }
551
+ }
552
+
553
+ SubstructLibrary(boost::shared_ptr<MolHolderBase> molecules,
554
+ boost::shared_ptr<KeyHolderBase> keys)
555
+ : molholder(std::move(molecules)),
556
+ fpholder(),
557
+ keyholder(std::move(keys)),
558
+ mols(molholder.get()),
559
+ fps(nullptr) {
560
+ if (fpholder.get() &&
561
+ dynamic_cast<TautomerPatternHolder *>(fpholder.get()) != nullptr) {
562
+ is_tautomerquery = true;
563
+ }
564
+ }
565
+
566
+ SubstructLibrary(boost::shared_ptr<MolHolderBase> molecules,
567
+ boost::shared_ptr<FPHolderBase> fingerprints,
568
+ boost::shared_ptr<KeyHolderBase> keys)
569
+ : molholder(std::move(molecules)),
570
+ fpholder(std::move(fingerprints)),
571
+ keyholder(std::move(keys)),
572
+ mols(molholder.get()),
573
+ fps(fpholder.get()) {
574
+ if (fpholder.get() &&
575
+ dynamic_cast<TautomerPatternHolder *>(fpholder.get()) != nullptr) {
576
+ is_tautomerquery = true;
577
+ }
578
+ }
579
+
580
+ SubstructLibrary(const std::string &pickle)
581
+ : molholder(new MolHolder),
582
+ fpholder(),
583
+ mols(molholder.get()),
584
+ fps(nullptr) {
585
+ initFromString(pickle);
586
+ if (fpholder.get() &&
587
+ dynamic_cast<TautomerPatternHolder *>(fpholder.get()) != nullptr) {
588
+ is_tautomerquery = true;
589
+ }
590
+ }
591
+
592
+ //! Get the underlying molecule holder implementation
593
+ boost::shared_ptr<MolHolderBase> &getMolHolder() { return molholder; }
594
+
595
+ const boost::shared_ptr<MolHolderBase> &getMolHolder() const {
596
+ return molholder;
597
+ }
598
+
599
+ //! Get the underlying molecule holder implementation
600
+ boost::shared_ptr<FPHolderBase> &getFpHolder() { return fpholder; }
601
+
602
+ //! Get the underlying molecule holder implementation
603
+ const boost::shared_ptr<FPHolderBase> &getFpHolder() const {
604
+ return fpholder;
605
+ }
606
+
607
+ //! Get the underlying molecule holder implementation
608
+ boost::shared_ptr<KeyHolderBase> &getKeyHolder() { return keyholder; }
609
+
610
+ //! Get the underlying molecule holder implementation
611
+ const boost::shared_ptr<KeyHolderBase> &getKeyHolder() const {
612
+ return keyholder;
613
+ }
614
+
615
+ const MolHolderBase &getMolecules() const {
616
+ PRECONDITION(mols, "Molecule holder NULL in SubstructLibrary");
617
+ return *mols;
618
+ }
619
+
620
+ //! Get the underlying fingerprint implementation.
621
+ /*! Throws a value error if no fingerprints have been set */
622
+ FPHolderBase &getFingerprints() {
623
+ if (!fps) {
624
+ throw ValueErrorException("Substruct Library does not have fingerprints");
625
+ }
626
+ return *fps;
627
+ }
628
+
629
+ const FPHolderBase &getFingerprints() const {
630
+ if (!fps) {
631
+ throw ValueErrorException("Substruct Library does not have fingerprints");
632
+ }
633
+ return *fps;
634
+ }
635
+
636
+ //! Get the underlying key holder implementation.
637
+ /*! Throws a value error if no keyholder have been set */
638
+ KeyHolderBase &getKeys() {
639
+ if (!keyholder.get()) {
640
+ throw ValueErrorException("Substruct Library does not have fingerprints");
641
+ }
642
+ return *keyholder.get();
643
+ }
644
+
645
+ //! Get the underlying key holder implementation.
646
+ /*! Throws a value error if no keyholder have been set */
647
+ const KeyHolderBase &getKeys() const {
648
+ if (!keyholder.get()) {
649
+ throw ValueErrorException("Substruct Library does not have fingerprints");
650
+ }
651
+ return *keyholder.get();
652
+ }
653
+
654
+ //! Add a molecule to the library
655
+ /*!
656
+ \param mol Molecule to add
657
+
658
+ returns index for the molecule in the library
659
+ */
660
+ unsigned int addMol(const ROMol &mol);
661
+
662
+ //! Get the matching indices for the query
663
+ /*!
664
+ \param query Query or Tautomer Query to match against molecules
665
+ \param recursionPossible flags whether or not recursive matches are allowed
666
+ [default true]
667
+ \param useChirality use atomic CIP codes as part of the comparison
668
+ [default true]
669
+ \param useQueryQueryMatches if set, the contents of atom and bond queries
670
+ will be used as part of the matching
671
+ [default false]
672
+ \param numThreads If -1 use all available processors [default -1]
673
+ \param maxResults Maximum results to return, -1 means return all
674
+ [default -1]
675
+ */
676
+ template <class Query>
677
+ std::vector<unsigned int> getMatches(const Query &query,
678
+ bool recursionPossible = true,
679
+ bool useChirality = true,
680
+ bool useQueryQueryMatches = false,
681
+ int numThreads = -1,
682
+ int maxResults = -1) const {
683
+ SubstructMatchParameters params;
684
+ params.recursionPossible = recursionPossible;
685
+ params.useChirality = useChirality;
686
+ params.useQueryQueryMatches = useQueryQueryMatches;
687
+ return getMatches(query, 0, size(), params, numThreads, maxResults);
688
+ }
689
+ //! overload
690
+ template <class Query>
691
+ std::vector<unsigned int> getMatches(const Query &query,
692
+ const SubstructMatchParameters &params,
693
+ int numThreads = -1,
694
+ int maxResults = -1) const {
695
+ return getMatches(query, 0, size(), params, numThreads, maxResults);
696
+ }
697
+ //! Get the matching indices for the query between the given indices
698
+ /*!
699
+ \param query Query to match against molecules
700
+ \param startIdx Start index of the search
701
+ \param endIdx Ending idx (non-inclusive) of the search.
702
+ \param recursionPossible flags whether or not recursive matches are allowed
703
+ [default true]
704
+ \param useChirality use atomic CIP codes as part of the comparison
705
+ [default true]
706
+ \param useQueryQueryMatches if set, the contents of atom and bond queries
707
+ will be used as part of the matching
708
+ [default false]
709
+ \param numThreads If -1 use all available processors [default -1]
710
+ \param maxResults Maximum results to return, -1 means return all
711
+ [default -1]
712
+ */
713
+ template <class Query>
714
+ std::vector<unsigned int> getMatches(
715
+ const Query &query, unsigned int startIdx, unsigned int endIdx,
716
+ bool recursionPossible = true, bool useChirality = true,
717
+ bool useQueryQueryMatches = false, int numThreads = -1,
718
+ int maxResults = -1) const {
719
+ SubstructMatchParameters params;
720
+ params.recursionPossible = recursionPossible;
721
+ params.useChirality = useChirality;
722
+ params.useQueryQueryMatches = useQueryQueryMatches;
723
+ return getMatches(query, startIdx, endIdx, params, numThreads, maxResults);
724
+ };
725
+ //! overload
726
+ std::vector<unsigned int> getMatches(const ROMol &query,
727
+ unsigned int startIdx,
728
+ unsigned int endIdx,
729
+ const SubstructMatchParameters &params,
730
+ int numThreads = -1,
731
+ int maxResults = -1) const;
732
+ //! overload
733
+ std::vector<unsigned int> getMatches(const MolBundle &query,
734
+ unsigned int startIdx,
735
+ unsigned int endIdx,
736
+ const SubstructMatchParameters &params,
737
+ int numThreads = -1,
738
+ int maxResults = -1) const;
739
+ //! overload
740
+ std::vector<unsigned int> getMatches(const TautomerQuery &query,
741
+ unsigned int startIdx,
742
+ unsigned int endIdx,
743
+ const SubstructMatchParameters &params,
744
+ int numThreads = -1,
745
+ int maxResults = -1) const;
746
+
747
+ //! Return the number of matches for the query
748
+ /*!
749
+ \param query Molecule or Tautomer Query to match against molecules
750
+ \param recursionPossible flags whether or not recursive matches are allowed
751
+ [default true]
752
+ \param useChirality use atomic CIP codes as part of the comparison
753
+ [default true]
754
+ \param useQueryQueryMatches if set, the contents of atom and bond queries
755
+ will be used as part of the matching
756
+ [default false]
757
+ \param numThreads If -1 use all available processors [default -1]
758
+ */
759
+ template <class Query>
760
+ unsigned int countMatches(const Query &query, bool recursionPossible = true,
761
+ bool useChirality = true,
762
+ bool useQueryQueryMatches = false,
763
+ int numThreads = -1) const {
764
+ SubstructMatchParameters params;
765
+ params.recursionPossible = recursionPossible;
766
+ params.useChirality = useChirality;
767
+ params.useQueryQueryMatches = useQueryQueryMatches;
768
+ return countMatches(query, 0, size(), params, numThreads);
769
+ }
770
+ //! overload
771
+ template <class Query>
772
+ unsigned int countMatches(const Query &query,
773
+ const SubstructMatchParameters &params,
774
+ int numThreads = -1) const {
775
+ return countMatches(query, 0, size(), params, numThreads);
776
+ }
777
+
778
+ //! Return the number of matches for the query
779
+
780
+ //! Return the number of matches for the query between the given indices
781
+ /*!
782
+ \param query Query to match against molecules
783
+ \param startIdx Start index of the search
784
+ \param endIdx Ending idx (non-inclusive) of the search.
785
+ \param recursionPossible flags whether or not recursive matches are allowed
786
+ [default true]
787
+ \param useChirality use atomic CIP codes as part of the comparison
788
+ [default true]
789
+ \param useQueryQueryMatches if set, the contents of atom and bond queries
790
+ will be used as part of the matching
791
+ [default false]
792
+ \param numThreads If -1 use all available processors [default -1]
793
+ */
794
+ template <class Query>
795
+ unsigned int countMatches(const Query &query, unsigned int startIdx,
796
+ unsigned int endIdx, bool recursionPossible = true,
797
+ bool useChirality = true,
798
+ bool useQueryQueryMatches = false,
799
+ int numThreads = -1) const {
800
+ SubstructMatchParameters params;
801
+ params.recursionPossible = recursionPossible;
802
+ params.useChirality = useChirality;
803
+ params.useQueryQueryMatches = useQueryQueryMatches;
804
+ return countMatches(query, startIdx, endIdx, params, numThreads);
805
+ };
806
+
807
+ //! overload
808
+ unsigned int countMatches(const ROMol &query, unsigned int startIdx,
809
+ unsigned int endIdx,
810
+ const SubstructMatchParameters &params,
811
+ int numThreads = -1) const;
812
+ //! overload
813
+ unsigned int countMatches(const TautomerQuery &query, unsigned int startIdx,
814
+ unsigned int endIdx,
815
+ const SubstructMatchParameters &params,
816
+ int numThreads = -1) const;
817
+ //! overload
818
+ unsigned int countMatches(const MolBundle &query, unsigned int startIdx,
819
+ unsigned int endIdx,
820
+ const SubstructMatchParameters &params,
821
+ int numThreads = -1) const;
822
+
823
+ //! Returns true if any match exists for the query
824
+ /*!
825
+ \param query Molecule or Tautomer Query to match against molecules
826
+ \param recursionPossible flags whether or not recursive matches are allowed
827
+ [default true]
828
+ \param useChirality use atomic CIP codes as part of the comparison
829
+ [default true]
830
+ \param useQueryQueryMatches if set, the contents of atom and bond queries
831
+ will be used as part of the matching
832
+ [default false]
833
+ \param numThreads If -1 use all available processors [default -1]
834
+ */
835
+ template <class Query>
836
+ bool hasMatch(const Query &query, bool recursionPossible = true,
837
+ bool useChirality = true, bool useQueryQueryMatches = false,
838
+ int numThreads = -1) const {
839
+ SubstructMatchParameters params;
840
+ params.recursionPossible = recursionPossible;
841
+ params.useChirality = useChirality;
842
+ params.useQueryQueryMatches = useQueryQueryMatches;
843
+ return hasMatch(query, 0, size(), params, numThreads);
844
+ }
845
+ //! overload
846
+ template <class Query>
847
+ bool hasMatch(const Query &query, const SubstructMatchParameters &params,
848
+ int numThreads = -1) const {
849
+ return hasMatch(query, 0, size(), params, numThreads);
850
+ }
851
+ //! Returns true if any match exists for the query between the specified
852
+ //! indices
853
+ /*!
854
+ \param query Query to match against molecules
855
+ \param startIdx Start index of the search
856
+ \param endIdx Ending idx (inclusive) of the search.
857
+ \param recursionPossible flags whether or not recursive matches are
858
+ allowed [default true] \param useChirality use atomic CIP codes as part
859
+ of the comparison [default true] \param useQueryQueryMatches if set, the
860
+ contents of atom and bond queries will be used as part of the matching
861
+ [default false]
862
+ \param numThreads If -1 use all available processors [default -1]
863
+ */
864
+ template <class Query>
865
+ bool hasMatch(const Query &query, unsigned int startIdx, unsigned int endIdx,
866
+ bool recursionPossible = true, bool useChirality = true,
867
+ bool useQueryQueryMatches = false, int numThreads = -1) const {
868
+ SubstructMatchParameters params;
869
+ params.recursionPossible = recursionPossible;
870
+ params.useChirality = useChirality;
871
+ params.useQueryQueryMatches = useQueryQueryMatches;
872
+ return hasMatch(query, startIdx, endIdx, params, numThreads);
873
+ };
874
+ //! overload
875
+ bool hasMatch(const ROMol &query, unsigned int startIdx, unsigned int endIdx,
876
+ const SubstructMatchParameters &params,
877
+ int numThreads = -1) const;
878
+ //! overload
879
+ bool hasMatch(const TautomerQuery &query, unsigned int startIdx,
880
+ unsigned int endIdx, const SubstructMatchParameters &params,
881
+ int numThreads = -1) const;
882
+ //! overload
883
+ bool hasMatch(const MolBundle &query, unsigned int startIdx,
884
+ unsigned int endIdx, const SubstructMatchParameters &params,
885
+ int numThreads = -1) const;
886
+ //! Returns the molecule at the given index
887
+ /*!
888
+ \param idx Index of the molecule in the library (n.b. could contain
889
+ null)
890
+ */
891
+ boost::shared_ptr<ROMol> getMol(unsigned int idx) const {
892
+ // expects implementation to throw IndexError if out of range
893
+ PRECONDITION(mols, "molholder is null in SubstructLibrary");
894
+ return mols->getMol(idx);
895
+ }
896
+
897
+ //! Returns the molecule at the given index
898
+ /*!
899
+ \param idx Index of the molecule in the library (n.b. could contain
900
+ null)
901
+ */
902
+ boost::shared_ptr<ROMol> operator[](unsigned int idx) {
903
+ // expects implementation to throw IndexError if out of range
904
+ PRECONDITION(mols, "molholder is null in SubstructLibrary");
905
+ return mols->getMol(idx);
906
+ }
907
+
908
+ //! return the number of molecules in the library
909
+ unsigned int size() const {
910
+ PRECONDITION(mols, "molholder is null in SubstructLibrary");
911
+ return rdcast<unsigned int>(molholder->size());
912
+ }
913
+
914
+ //! does error checking
915
+ void setSearchOrder(const std::vector<unsigned int> &order) {
916
+ for (const auto idx : order) {
917
+ if (idx >= mols->size()) {
918
+ throw IndexErrorException(idx);
919
+ }
920
+ }
921
+ searchOrder = order;
922
+ }
923
+
924
+ const std::vector<unsigned int> &getSearchOrder() const {
925
+ return searchOrder;
926
+ }
927
+
928
+ std::vector<unsigned int> &getSearchOrder() { return searchOrder; }
929
+ //! access required for serialization
930
+ void resetHolders() {
931
+ is_tautomerquery = false;
932
+ mols = molholder.get();
933
+ fps = fpholder.get();
934
+ if (fps && dynamic_cast<TautomerPatternHolder *>(fps) != nullptr) {
935
+ is_tautomerquery = true;
936
+ }
937
+ }
938
+
939
+ //! serializes (pickles) to a stream
940
+ void toStream(std::ostream &ss) const;
941
+ //! returns a string with a serialized (pickled) representation
942
+ std::string Serialize() const;
943
+ //! initializes from a stream pickle
944
+ void initFromStream(std::istream &ss);
945
+ //! initializes from a string pickle
946
+ void initFromString(const std::string &text);
947
+ };
948
+ } // namespace RDKit
949
+
950
+ #include "SubstructLibrarySerialization.h"
951
+ #endif