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.
- rdkit_headers/__init__.py +13 -0
- rdkit_headers/include/rdkit/CIPLabeler/CIPLabeler.h +59 -0
- rdkit_headers/include/rdkit/CIPLabeler/TooManyNodesException.h +28 -0
- rdkit_headers/include/rdkit/Catalogs/Catalog.h +461 -0
- rdkit_headers/include/rdkit/Catalogs/CatalogEntry.h +48 -0
- rdkit_headers/include/rdkit/Catalogs/CatalogParams.h +42 -0
- rdkit_headers/include/rdkit/ChemicalFeatures/ChemicalFeature.h +38 -0
- rdkit_headers/include/rdkit/ChemicalFeatures/FreeChemicalFeature.h +97 -0
- rdkit_headers/include/rdkit/DataManip/MetricMatrixCalc/MetricFuncs.h +54 -0
- rdkit_headers/include/rdkit/DataManip/MetricMatrixCalc/MetricMatrixCalc.h +106 -0
- rdkit_headers/include/rdkit/DataStructs/BitOps.h +337 -0
- rdkit_headers/include/rdkit/DataStructs/BitVect.h +68 -0
- rdkit_headers/include/rdkit/DataStructs/BitVectUtils.h +35 -0
- rdkit_headers/include/rdkit/DataStructs/BitVects.h +25 -0
- rdkit_headers/include/rdkit/DataStructs/DatastructsException.h +31 -0
- rdkit_headers/include/rdkit/DataStructs/DatastructsStreamOps.h +72 -0
- rdkit_headers/include/rdkit/DataStructs/DiscreteDistMat.h +30 -0
- rdkit_headers/include/rdkit/DataStructs/DiscreteValueVect.h +146 -0
- rdkit_headers/include/rdkit/DataStructs/ExplicitBitVect.h +96 -0
- rdkit_headers/include/rdkit/DataStructs/FPBReader.h +281 -0
- rdkit_headers/include/rdkit/DataStructs/MultiFPBReader.h +213 -0
- rdkit_headers/include/rdkit/DataStructs/SparseBitVect.h +101 -0
- rdkit_headers/include/rdkit/DataStructs/SparseIntVect.h +571 -0
- rdkit_headers/include/rdkit/DataStructs/base64.h +41 -0
- rdkit_headers/include/rdkit/DistGeom/BoundsMatrix.h +121 -0
- rdkit_headers/include/rdkit/DistGeom/ChiralSet.h +58 -0
- rdkit_headers/include/rdkit/DistGeom/ChiralViolationContrib.h +96 -0
- rdkit_headers/include/rdkit/DistGeom/DistGeomUtils.h +195 -0
- rdkit_headers/include/rdkit/DistGeom/DistViolationContrib.h +54 -0
- rdkit_headers/include/rdkit/DistGeom/FourthDimContrib.h +65 -0
- rdkit_headers/include/rdkit/DistGeom/TriangleSmooth.h +36 -0
- rdkit_headers/include/rdkit/Features/Feature.h +96 -0
- rdkit_headers/include/rdkit/ForceField/Contrib.h +40 -0
- rdkit_headers/include/rdkit/ForceField/ForceField.h +253 -0
- rdkit_headers/include/rdkit/ForceField/MMFF/AngleBend.h +78 -0
- rdkit_headers/include/rdkit/ForceField/MMFF/AngleConstraint.h +64 -0
- rdkit_headers/include/rdkit/ForceField/MMFF/BondStretch.h +67 -0
- rdkit_headers/include/rdkit/ForceField/MMFF/Contribs.h +26 -0
- rdkit_headers/include/rdkit/ForceField/MMFF/DistanceConstraint.h +61 -0
- rdkit_headers/include/rdkit/ForceField/MMFF/Nonbonded.h +105 -0
- rdkit_headers/include/rdkit/ForceField/MMFF/OopBend.h +65 -0
- rdkit_headers/include/rdkit/ForceField/MMFF/Params.h +1134 -0
- rdkit_headers/include/rdkit/ForceField/MMFF/PositionConstraint.h +55 -0
- rdkit_headers/include/rdkit/ForceField/MMFF/StretchBend.h +70 -0
- rdkit_headers/include/rdkit/ForceField/MMFF/TorsionAngle.h +79 -0
- rdkit_headers/include/rdkit/ForceField/MMFF/TorsionConstraint.h +70 -0
- rdkit_headers/include/rdkit/ForceField/UFF/AngleBend.h +92 -0
- rdkit_headers/include/rdkit/ForceField/UFF/AngleConstraint.h +64 -0
- rdkit_headers/include/rdkit/ForceField/UFF/BondStretch.h +83 -0
- rdkit_headers/include/rdkit/ForceField/UFF/Contribs.h +23 -0
- rdkit_headers/include/rdkit/ForceField/UFF/DistanceConstraint.h +62 -0
- rdkit_headers/include/rdkit/ForceField/UFF/Inversion.h +81 -0
- rdkit_headers/include/rdkit/ForceField/UFF/Nonbonded.h +87 -0
- rdkit_headers/include/rdkit/ForceField/UFF/Params.h +153 -0
- rdkit_headers/include/rdkit/ForceField/UFF/PositionConstraint.h +55 -0
- rdkit_headers/include/rdkit/ForceField/UFF/TorsionAngle.h +115 -0
- rdkit_headers/include/rdkit/ForceField/UFF/TorsionConstraint.h +70 -0
- rdkit_headers/include/rdkit/Geometry/Grid3D.h +55 -0
- rdkit_headers/include/rdkit/Geometry/GridUtils.h +64 -0
- rdkit_headers/include/rdkit/Geometry/Transform.h +19 -0
- rdkit_headers/include/rdkit/Geometry/Transform2D.h +85 -0
- rdkit_headers/include/rdkit/Geometry/Transform3D.h +101 -0
- rdkit_headers/include/rdkit/Geometry/UniformGrid3D.h +217 -0
- rdkit_headers/include/rdkit/Geometry/Utils.h +97 -0
- rdkit_headers/include/rdkit/Geometry/point.h +585 -0
- rdkit_headers/include/rdkit/GraphMol/Abbreviations/Abbreviations.h +132 -0
- rdkit_headers/include/rdkit/GraphMol/Atom.h +449 -0
- rdkit_headers/include/rdkit/GraphMol/AtomIterators.h +212 -0
- rdkit_headers/include/rdkit/GraphMol/Bond.h +393 -0
- rdkit_headers/include/rdkit/GraphMol/BondIterators.h +75 -0
- rdkit_headers/include/rdkit/GraphMol/Canon.h +130 -0
- rdkit_headers/include/rdkit/GraphMol/ChemReactions/Enumerate/CartesianProduct.h +147 -0
- rdkit_headers/include/rdkit/GraphMol/ChemReactions/Enumerate/Enumerate.h +187 -0
- rdkit_headers/include/rdkit/GraphMol/ChemReactions/Enumerate/EnumerateBase.h +200 -0
- rdkit_headers/include/rdkit/GraphMol/ChemReactions/Enumerate/EnumerateTypes.h +59 -0
- rdkit_headers/include/rdkit/GraphMol/ChemReactions/Enumerate/EnumerationPickler.h +60 -0
- rdkit_headers/include/rdkit/GraphMol/ChemReactions/Enumerate/EnumerationStrategyBase.h +227 -0
- rdkit_headers/include/rdkit/GraphMol/ChemReactions/Enumerate/RandomSample.h +163 -0
- rdkit_headers/include/rdkit/GraphMol/ChemReactions/Enumerate/RandomSampleAllBBs.h +184 -0
- rdkit_headers/include/rdkit/GraphMol/ChemReactions/PreprocessRxn.h +64 -0
- rdkit_headers/include/rdkit/GraphMol/ChemReactions/Reaction.h +491 -0
- rdkit_headers/include/rdkit/GraphMol/ChemReactions/ReactionFingerprints.h +147 -0
- rdkit_headers/include/rdkit/GraphMol/ChemReactions/ReactionParser.h +274 -0
- rdkit_headers/include/rdkit/GraphMol/ChemReactions/ReactionPickler.h +119 -0
- rdkit_headers/include/rdkit/GraphMol/ChemReactions/ReactionRunner.h +116 -0
- rdkit_headers/include/rdkit/GraphMol/ChemReactions/ReactionUtils.h +74 -0
- rdkit_headers/include/rdkit/GraphMol/ChemReactions/SanitizeRxn.h +169 -0
- rdkit_headers/include/rdkit/GraphMol/ChemTransforms/ChemTransforms.h +270 -0
- rdkit_headers/include/rdkit/GraphMol/ChemTransforms/MolFragmenter.h +120 -0
- rdkit_headers/include/rdkit/GraphMol/Chirality.h +137 -0
- rdkit_headers/include/rdkit/GraphMol/Conformer.h +183 -0
- rdkit_headers/include/rdkit/GraphMol/CoordGen.h +195 -0
- rdkit_headers/include/rdkit/GraphMol/Depictor/DepictUtils.h +366 -0
- rdkit_headers/include/rdkit/GraphMol/Depictor/EmbeddedFrag.h +544 -0
- rdkit_headers/include/rdkit/GraphMol/Depictor/RDDepictor.h +284 -0
- rdkit_headers/include/rdkit/GraphMol/Deprotect/Deprotect.h +105 -0
- rdkit_headers/include/rdkit/GraphMol/Descriptors/AUTOCORR2D.h +49 -0
- rdkit_headers/include/rdkit/GraphMol/Descriptors/AUTOCORR3D.h +51 -0
- rdkit_headers/include/rdkit/GraphMol/Descriptors/AtomFeat.h +39 -0
- rdkit_headers/include/rdkit/GraphMol/Descriptors/BCUT.h +66 -0
- rdkit_headers/include/rdkit/GraphMol/Descriptors/ConnectivityDescriptors.h +211 -0
- rdkit_headers/include/rdkit/GraphMol/Descriptors/CoulombMat.h +42 -0
- rdkit_headers/include/rdkit/GraphMol/Descriptors/Crippen.h +137 -0
- rdkit_headers/include/rdkit/GraphMol/Descriptors/Data3Ddescriptors.h +55 -0
- rdkit_headers/include/rdkit/GraphMol/Descriptors/EEM.h +59 -0
- rdkit_headers/include/rdkit/GraphMol/Descriptors/GETAWAY.h +51 -0
- rdkit_headers/include/rdkit/GraphMol/Descriptors/Lipinski.h +169 -0
- rdkit_headers/include/rdkit/GraphMol/Descriptors/MORSE.h +50 -0
- rdkit_headers/include/rdkit/GraphMol/Descriptors/MQN.h +47 -0
- rdkit_headers/include/rdkit/GraphMol/Descriptors/MolData3Ddescriptors.h +62 -0
- rdkit_headers/include/rdkit/GraphMol/Descriptors/MolDescriptors.h +86 -0
- rdkit_headers/include/rdkit/GraphMol/Descriptors/MolDescriptors3D.h +25 -0
- rdkit_headers/include/rdkit/GraphMol/Descriptors/MolSurf.h +120 -0
- rdkit_headers/include/rdkit/GraphMol/Descriptors/PBF.h +60 -0
- rdkit_headers/include/rdkit/GraphMol/Descriptors/PMI.h +128 -0
- rdkit_headers/include/rdkit/GraphMol/Descriptors/Property.h +123 -0
- rdkit_headers/include/rdkit/GraphMol/Descriptors/RDF.h +52 -0
- rdkit_headers/include/rdkit/GraphMol/Descriptors/RegisterDescriptor.h +84 -0
- rdkit_headers/include/rdkit/GraphMol/Descriptors/USRDescriptor.h +137 -0
- rdkit_headers/include/rdkit/GraphMol/Descriptors/WHIM.h +51 -0
- rdkit_headers/include/rdkit/GraphMol/DistGeomHelpers/BoundsMatrixBuilder.h +77 -0
- rdkit_headers/include/rdkit/GraphMol/DistGeomHelpers/Embedder.h +437 -0
- rdkit_headers/include/rdkit/GraphMol/FMCS/FMCS.h +194 -0
- rdkit_headers/include/rdkit/GraphMol/FMCS/Graph.h +43 -0
- rdkit_headers/include/rdkit/GraphMol/FileParsers/FileParserUtils.h +231 -0
- rdkit_headers/include/rdkit/GraphMol/FileParsers/FileParsers.h +399 -0
- rdkit_headers/include/rdkit/GraphMol/FileParsers/GeneralFileReader.h +170 -0
- rdkit_headers/include/rdkit/GraphMol/FileParsers/MolFileStereochem.h +60 -0
- rdkit_headers/include/rdkit/GraphMol/FileParsers/MolSupplier.h +444 -0
- rdkit_headers/include/rdkit/GraphMol/FileParsers/MolWriters.h +338 -0
- rdkit_headers/include/rdkit/GraphMol/FileParsers/MultithreadedMolSupplier.h +102 -0
- rdkit_headers/include/rdkit/GraphMol/FileParsers/MultithreadedSDMolSupplier.h +65 -0
- rdkit_headers/include/rdkit/GraphMol/FileParsers/MultithreadedSmilesMolSupplier.h +66 -0
- rdkit_headers/include/rdkit/GraphMol/FileParsers/PNGParser.h +203 -0
- rdkit_headers/include/rdkit/GraphMol/FileParsers/SequenceParsers.h +117 -0
- rdkit_headers/include/rdkit/GraphMol/FileParsers/SequenceWriters.h +47 -0
- rdkit_headers/include/rdkit/GraphMol/FilterCatalog/FilterCatalog.h +260 -0
- rdkit_headers/include/rdkit/GraphMol/FilterCatalog/FilterCatalogEntry.h +276 -0
- rdkit_headers/include/rdkit/GraphMol/FilterCatalog/FilterMatcherBase.h +152 -0
- rdkit_headers/include/rdkit/GraphMol/FilterCatalog/FilterMatchers.h +576 -0
- rdkit_headers/include/rdkit/GraphMol/FilterCatalog/FunctionalGroupHierarchy.h +52 -0
- rdkit_headers/include/rdkit/GraphMol/Fingerprints/AtomPairGenerator.h +188 -0
- rdkit_headers/include/rdkit/GraphMol/Fingerprints/AtomPairs.h +268 -0
- rdkit_headers/include/rdkit/GraphMol/Fingerprints/FingerprintGenerator.h +372 -0
- rdkit_headers/include/rdkit/GraphMol/Fingerprints/FingerprintUtil.h +160 -0
- rdkit_headers/include/rdkit/GraphMol/Fingerprints/Fingerprints.h +167 -0
- rdkit_headers/include/rdkit/GraphMol/Fingerprints/MACCS.h +32 -0
- rdkit_headers/include/rdkit/GraphMol/Fingerprints/MHFP.h +285 -0
- rdkit_headers/include/rdkit/GraphMol/Fingerprints/MorganFingerprints.h +210 -0
- rdkit_headers/include/rdkit/GraphMol/Fingerprints/MorganGenerator.h +251 -0
- rdkit_headers/include/rdkit/GraphMol/Fingerprints/RDKitFPGenerator.h +162 -0
- rdkit_headers/include/rdkit/GraphMol/Fingerprints/TopologicalTorsionGenerator.h +127 -0
- rdkit_headers/include/rdkit/GraphMol/ForceFieldHelpers/CrystalFF/TorsionAngleM6.h +72 -0
- rdkit_headers/include/rdkit/GraphMol/ForceFieldHelpers/CrystalFF/TorsionPreferences.h +41 -0
- rdkit_headers/include/rdkit/GraphMol/ForceFieldHelpers/FFConvenience.h +130 -0
- rdkit_headers/include/rdkit/GraphMol/ForceFieldHelpers/MMFF/AtomTyper.h +236 -0
- rdkit_headers/include/rdkit/GraphMol/ForceFieldHelpers/MMFF/Builder.h +141 -0
- rdkit_headers/include/rdkit/GraphMol/ForceFieldHelpers/MMFF/MMFF.h +105 -0
- rdkit_headers/include/rdkit/GraphMol/ForceFieldHelpers/UFF/AtomTyper.h +57 -0
- rdkit_headers/include/rdkit/GraphMol/ForceFieldHelpers/UFF/Builder.h +129 -0
- rdkit_headers/include/rdkit/GraphMol/ForceFieldHelpers/UFF/UFF.h +82 -0
- rdkit_headers/include/rdkit/GraphMol/FragCatalog/FragCatGenerator.h +33 -0
- rdkit_headers/include/rdkit/GraphMol/FragCatalog/FragCatParams.h +94 -0
- rdkit_headers/include/rdkit/GraphMol/FragCatalog/FragCatalogEntry.h +136 -0
- rdkit_headers/include/rdkit/GraphMol/FragCatalog/FragCatalogUtils.h +62 -0
- rdkit_headers/include/rdkit/GraphMol/FragCatalog/FragFPGenerator.h +38 -0
- rdkit_headers/include/rdkit/GraphMol/GenericGroups/GenericGroups.h +301 -0
- rdkit_headers/include/rdkit/GraphMol/GraphMol.h +22 -0
- rdkit_headers/include/rdkit/GraphMol/MMPA/MMPA.h +81 -0
- rdkit_headers/include/rdkit/GraphMol/MolAlign/AlignMolecules.h +183 -0
- rdkit_headers/include/rdkit/GraphMol/MolAlign/O3AAlignMolecules.h +354 -0
- rdkit_headers/include/rdkit/GraphMol/MolBundle.h +121 -0
- rdkit_headers/include/rdkit/GraphMol/MolCatalog/MolCatalog.h +20 -0
- rdkit_headers/include/rdkit/GraphMol/MolCatalog/MolCatalogEntry.h +109 -0
- rdkit_headers/include/rdkit/GraphMol/MolCatalog/MolCatalogParams.h +40 -0
- rdkit_headers/include/rdkit/GraphMol/MolChemicalFeatures/FeatureParser.h +58 -0
- rdkit_headers/include/rdkit/GraphMol/MolChemicalFeatures/MolChemicalFeature.h +98 -0
- rdkit_headers/include/rdkit/GraphMol/MolChemicalFeatures/MolChemicalFeatureDef.h +68 -0
- rdkit_headers/include/rdkit/GraphMol/MolChemicalFeatures/MolChemicalFeatureFactory.h +78 -0
- rdkit_headers/include/rdkit/GraphMol/MolDraw2D/MolDraw2D.h +539 -0
- rdkit_headers/include/rdkit/GraphMol/MolDraw2D/MolDraw2DHelpers.h +284 -0
- rdkit_headers/include/rdkit/GraphMol/MolDraw2D/MolDraw2DJS.h +62 -0
- rdkit_headers/include/rdkit/GraphMol/MolDraw2D/MolDraw2DSVG.h +88 -0
- rdkit_headers/include/rdkit/GraphMol/MolDraw2D/MolDraw2DUtils.h +179 -0
- rdkit_headers/include/rdkit/GraphMol/MolDraw2D/MolDraw2Dwx.h +107 -0
- rdkit_headers/include/rdkit/GraphMol/MolEnumerator/LinkNode.h +159 -0
- rdkit_headers/include/rdkit/GraphMol/MolEnumerator/MolEnumerator.h +276 -0
- rdkit_headers/include/rdkit/GraphMol/MolHash/MolHash.h +12 -0
- rdkit_headers/include/rdkit/GraphMol/MolHash/nmmolhash.h +60 -0
- rdkit_headers/include/rdkit/GraphMol/MolInterchange/MolInterchange.h +93 -0
- rdkit_headers/include/rdkit/GraphMol/MolInterchange/details.h +49 -0
- rdkit_headers/include/rdkit/GraphMol/MolOps.h +1016 -0
- rdkit_headers/include/rdkit/GraphMol/MolPickler.h +314 -0
- rdkit_headers/include/rdkit/GraphMol/MolStandardize/AcidBaseCatalog/AcidBaseCatalogEntry.h +56 -0
- rdkit_headers/include/rdkit/GraphMol/MolStandardize/AcidBaseCatalog/AcidBaseCatalogParams.h +65 -0
- rdkit_headers/include/rdkit/GraphMol/MolStandardize/AcidBaseCatalog/AcidBaseCatalogUtils.h +37 -0
- rdkit_headers/include/rdkit/GraphMol/MolStandardize/Charge.h +145 -0
- rdkit_headers/include/rdkit/GraphMol/MolStandardize/Fragment.h +105 -0
- rdkit_headers/include/rdkit/GraphMol/MolStandardize/FragmentCatalog/FragmentCatalogEntry.h +60 -0
- rdkit_headers/include/rdkit/GraphMol/MolStandardize/FragmentCatalog/FragmentCatalogParams.h +63 -0
- rdkit_headers/include/rdkit/GraphMol/MolStandardize/FragmentCatalog/FragmentCatalogUtils.h +35 -0
- rdkit_headers/include/rdkit/GraphMol/MolStandardize/Metal.h +73 -0
- rdkit_headers/include/rdkit/GraphMol/MolStandardize/MolStandardize.h +178 -0
- rdkit_headers/include/rdkit/GraphMol/MolStandardize/Normalize.h +104 -0
- rdkit_headers/include/rdkit/GraphMol/MolStandardize/Tautomer.h +428 -0
- rdkit_headers/include/rdkit/GraphMol/MolStandardize/TautomerCatalog/TautomerCatalogEntry.h +59 -0
- rdkit_headers/include/rdkit/GraphMol/MolStandardize/TautomerCatalog/TautomerCatalogParams.h +69 -0
- rdkit_headers/include/rdkit/GraphMol/MolStandardize/TautomerCatalog/TautomerCatalogUtils.h +81 -0
- rdkit_headers/include/rdkit/GraphMol/MolStandardize/TransformCatalog/TransformCatalogEntry.h +57 -0
- rdkit_headers/include/rdkit/GraphMol/MolStandardize/TransformCatalog/TransformCatalogParams.h +66 -0
- rdkit_headers/include/rdkit/GraphMol/MolStandardize/TransformCatalog/TransformCatalogUtils.h +37 -0
- rdkit_headers/include/rdkit/GraphMol/MolStandardize/Validate.h +199 -0
- rdkit_headers/include/rdkit/GraphMol/MolTransforms/MolTransforms.h +222 -0
- rdkit_headers/include/rdkit/GraphMol/MonomerInfo.h +138 -0
- rdkit_headers/include/rdkit/GraphMol/PartialCharges/GasteigerCharges.h +27 -0
- rdkit_headers/include/rdkit/GraphMol/PartialCharges/GasteigerParams.h +86 -0
- rdkit_headers/include/rdkit/GraphMol/PeriodicTable.h +325 -0
- rdkit_headers/include/rdkit/GraphMol/QueryAtom.h +161 -0
- rdkit_headers/include/rdkit/GraphMol/QueryBond.h +146 -0
- rdkit_headers/include/rdkit/GraphMol/QueryOps.h +1110 -0
- rdkit_headers/include/rdkit/GraphMol/RDKitBase.h +35 -0
- rdkit_headers/include/rdkit/GraphMol/RDKitQueries.h +25 -0
- rdkit_headers/include/rdkit/GraphMol/RGroupDecomposition/RGroupDecomp.h +225 -0
- rdkit_headers/include/rdkit/GraphMol/ROMol.h +844 -0
- rdkit_headers/include/rdkit/GraphMol/RWMol.h +222 -0
- rdkit_headers/include/rdkit/GraphMol/ReducedGraphs/ReducedGraphs.h +85 -0
- rdkit_headers/include/rdkit/GraphMol/Resonance.h +236 -0
- rdkit_headers/include/rdkit/GraphMol/RingInfo.h +274 -0
- rdkit_headers/include/rdkit/GraphMol/Rings.h +90 -0
- rdkit_headers/include/rdkit/GraphMol/SLNParse/SLNAttribs.h +93 -0
- rdkit_headers/include/rdkit/GraphMol/SLNParse/SLNParse.h +70 -0
- rdkit_headers/include/rdkit/GraphMol/SLNParse/SLNParseOps.h +328 -0
- rdkit_headers/include/rdkit/GraphMol/SanitException.h +120 -0
- rdkit_headers/include/rdkit/GraphMol/ScaffoldNetwork/ScaffoldNetwork.h +195 -0
- rdkit_headers/include/rdkit/GraphMol/ShapeHelpers/ShapeEncoder.h +73 -0
- rdkit_headers/include/rdkit/GraphMol/ShapeHelpers/ShapeUtils.h +279 -0
- rdkit_headers/include/rdkit/GraphMol/SmilesParse/SmartsWrite.h +46 -0
- rdkit_headers/include/rdkit/GraphMol/SmilesParse/SmilesParse.h +160 -0
- rdkit_headers/include/rdkit/GraphMol/SmilesParse/SmilesParseOps.h +53 -0
- rdkit_headers/include/rdkit/GraphMol/SmilesParse/SmilesWrite.h +288 -0
- rdkit_headers/include/rdkit/GraphMol/SmilesParse/primes.h +18 -0
- rdkit_headers/include/rdkit/GraphMol/StereoGroup.h +74 -0
- rdkit_headers/include/rdkit/GraphMol/Subgraphs/SubgraphUtils.h +57 -0
- rdkit_headers/include/rdkit/GraphMol/Subgraphs/Subgraphs.h +154 -0
- rdkit_headers/include/rdkit/GraphMol/SubstanceGroup.h +297 -0
- rdkit_headers/include/rdkit/GraphMol/Substruct/SubstructMatch.h +232 -0
- rdkit_headers/include/rdkit/GraphMol/Substruct/SubstructUtils.h +44 -0
- rdkit_headers/include/rdkit/GraphMol/SubstructLibrary/PatternFactory.h +40 -0
- rdkit_headers/include/rdkit/GraphMol/SubstructLibrary/SubstructLibrary.h +951 -0
- rdkit_headers/include/rdkit/GraphMol/SubstructLibrary/SubstructLibrarySerialization.h +231 -0
- rdkit_headers/include/rdkit/GraphMol/TautomerQuery/TautomerQuery.h +104 -0
- rdkit_headers/include/rdkit/GraphMol/Trajectory/Snapshot.h +69 -0
- rdkit_headers/include/rdkit/GraphMol/Trajectory/Trajectory.h +105 -0
- rdkit_headers/include/rdkit/GraphMol/atomic_data.h +76 -0
- rdkit_headers/include/rdkit/GraphMol/details.h +15 -0
- rdkit_headers/include/rdkit/GraphMol/new_canon.h +772 -0
- rdkit_headers/include/rdkit/Numerics/Alignment/AlignPoints.h +49 -0
- rdkit_headers/include/rdkit/Numerics/Conrec.h +203 -0
- rdkit_headers/include/rdkit/Numerics/EigenSolvers/PowerEigenSolver.h +68 -0
- rdkit_headers/include/rdkit/Numerics/Matrix.h +347 -0
- rdkit_headers/include/rdkit/Numerics/Optimizer/BFGSOpt.h +397 -0
- rdkit_headers/include/rdkit/Numerics/SquareMatrix.h +89 -0
- rdkit_headers/include/rdkit/Numerics/SymmMatrix.h +361 -0
- rdkit_headers/include/rdkit/Numerics/Vector.h +327 -0
- rdkit_headers/include/rdkit/Query/AndQuery.h +57 -0
- rdkit_headers/include/rdkit/Query/EqualityQuery.h +88 -0
- rdkit_headers/include/rdkit/Query/GreaterEqualQuery.h +74 -0
- rdkit_headers/include/rdkit/Query/GreaterQuery.h +74 -0
- rdkit_headers/include/rdkit/Query/LessEqualQuery.h +75 -0
- rdkit_headers/include/rdkit/Query/LessQuery.h +74 -0
- rdkit_headers/include/rdkit/Query/NullQueryAlgebra.h +86 -0
- rdkit_headers/include/rdkit/Query/OrQuery.h +58 -0
- rdkit_headers/include/rdkit/Query/Query.h +210 -0
- rdkit_headers/include/rdkit/Query/QueryObjects.h +38 -0
- rdkit_headers/include/rdkit/Query/RangeQuery.h +116 -0
- rdkit_headers/include/rdkit/Query/SetQuery.h +87 -0
- rdkit_headers/include/rdkit/Query/XOrQuery.h +63 -0
- rdkit_headers/include/rdkit/RDGeneral/BadFileException.h +39 -0
- rdkit_headers/include/rdkit/RDGeneral/BoostEndInclude.h +69 -0
- rdkit_headers/include/rdkit/RDGeneral/BoostStartInclude.h +95 -0
- rdkit_headers/include/rdkit/RDGeneral/ConcurrentQueue.h +132 -0
- rdkit_headers/include/rdkit/RDGeneral/Dict.h +350 -0
- rdkit_headers/include/rdkit/RDGeneral/Exceptions.h +73 -0
- rdkit_headers/include/rdkit/RDGeneral/FileParseException.h +36 -0
- rdkit_headers/include/rdkit/RDGeneral/Invariant.h +198 -0
- rdkit_headers/include/rdkit/RDGeneral/LocaleSwitcher.h +54 -0
- rdkit_headers/include/rdkit/RDGeneral/RDAny.h +217 -0
- rdkit_headers/include/rdkit/RDGeneral/RDConfig.h +49 -0
- rdkit_headers/include/rdkit/RDGeneral/RDExportMacros.h +40 -0
- rdkit_headers/include/rdkit/RDGeneral/RDLog.h +142 -0
- rdkit_headers/include/rdkit/RDGeneral/RDProps.h +172 -0
- rdkit_headers/include/rdkit/RDGeneral/RDThreads.h +44 -0
- rdkit_headers/include/rdkit/RDGeneral/RDValue-doublemagic.h +478 -0
- rdkit_headers/include/rdkit/RDGeneral/RDValue-taggedunion.h +518 -0
- rdkit_headers/include/rdkit/RDGeneral/RDValue.h +285 -0
- rdkit_headers/include/rdkit/RDGeneral/Ranking.h +87 -0
- rdkit_headers/include/rdkit/RDGeneral/StreamOps.h +637 -0
- rdkit_headers/include/rdkit/RDGeneral/export.h +559 -0
- rdkit_headers/include/rdkit/RDGeneral/hanoiSort.h +167 -0
- rdkit_headers/include/rdkit/RDGeneral/hash/detail/float_functions.hpp +156 -0
- rdkit_headers/include/rdkit/RDGeneral/hash/detail/hash_float.hpp +179 -0
- rdkit_headers/include/rdkit/RDGeneral/hash/extensions.hpp +152 -0
- rdkit_headers/include/rdkit/RDGeneral/hash/hash.hpp +463 -0
- rdkit_headers/include/rdkit/RDGeneral/hash/hash_fwd.hpp +51 -0
- rdkit_headers/include/rdkit/RDGeneral/test.h +274 -0
- rdkit_headers/include/rdkit/RDGeneral/types.h +401 -0
- rdkit_headers/include/rdkit/RDGeneral/utils.h +106 -0
- rdkit_headers/include/rdkit/RDGeneral/versions.h +27 -0
- rdkit_headers/include/rdkit/RDStreams/streams.h +19 -0
- rdkit_headers/include/rdkit/RingDecomposerLib.h +751 -0
- rdkit_headers/include/rdkit/SimDivPickers/DistPicker.h +92 -0
- rdkit_headers/include/rdkit/SimDivPickers/HierarchicalClusterPicker.h +107 -0
- rdkit_headers/include/rdkit/SimDivPickers/LeaderPicker.h +470 -0
- rdkit_headers/include/rdkit/SimDivPickers/MaxMinPicker.h +303 -0
- rdkit_headers-2022.3.3.dist-info/METADATA +24 -0
- rdkit_headers-2022.3.3.dist-info/RECORD +320 -0
- rdkit_headers-2022.3.3.dist-info/WHEEL +4 -0
- rdkit_headers-2022.3.3.dist-info/entry_points.txt +4 -0
- rdkit_headers-2022.3.3.dist-info/licenses/LICENSE +29 -0
- rdkit_headers-2022.3.3.dist-info/licenses/NOTICE +5 -0
|
@@ -0,0 +1,571 @@
|
|
|
1
|
+
// $Id$
|
|
2
|
+
//
|
|
3
|
+
// Copyright (C) 2007-2008 Greg Landrum
|
|
4
|
+
//
|
|
5
|
+
// @@ All Rights Reserved @@
|
|
6
|
+
// This file is part of the RDKit.
|
|
7
|
+
// The contents are covered by the terms of the BSD license
|
|
8
|
+
// which is included in the file license.txt, found at the root
|
|
9
|
+
// of the RDKit source tree.
|
|
10
|
+
//
|
|
11
|
+
#include <RDGeneral/export.h>
|
|
12
|
+
#ifndef __RD_SPARSE_INT_VECT_20070921__
|
|
13
|
+
#define __RD_SPARSE_INT_VECT_20070921__
|
|
14
|
+
|
|
15
|
+
#include <map>
|
|
16
|
+
#include <string>
|
|
17
|
+
#include <RDGeneral/Invariant.h>
|
|
18
|
+
#include <sstream>
|
|
19
|
+
#include <RDGeneral/Exceptions.h>
|
|
20
|
+
#include <RDGeneral/StreamOps.h>
|
|
21
|
+
#include <cstdint>
|
|
22
|
+
|
|
23
|
+
const int ci_SPARSEINTVECT_VERSION =
|
|
24
|
+
0x0001; //!< version number to use in pickles
|
|
25
|
+
namespace RDKit {
|
|
26
|
+
//! a class for efficiently storing sparse vectors of ints
|
|
27
|
+
template <typename IndexType>
|
|
28
|
+
class SparseIntVect {
|
|
29
|
+
public:
|
|
30
|
+
typedef std::map<IndexType, int> StorageType;
|
|
31
|
+
|
|
32
|
+
SparseIntVect() : d_length(0) {}
|
|
33
|
+
|
|
34
|
+
//! initialize with a particular length
|
|
35
|
+
SparseIntVect(IndexType length) : d_length(length) {}
|
|
36
|
+
|
|
37
|
+
//! Copy constructor
|
|
38
|
+
SparseIntVect(const SparseIntVect<IndexType> &other) {
|
|
39
|
+
d_length = other.d_length;
|
|
40
|
+
d_data.clear();
|
|
41
|
+
d_data.insert(other.d_data.begin(), other.d_data.end());
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
//! constructor from a pickle
|
|
45
|
+
SparseIntVect(const std::string &pkl) {
|
|
46
|
+
initFromText(pkl.c_str(), pkl.size());
|
|
47
|
+
}
|
|
48
|
+
//! constructor from a pickle
|
|
49
|
+
SparseIntVect(const char *pkl, const unsigned int len) {
|
|
50
|
+
initFromText(pkl, len);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
SparseIntVect &operator=(const SparseIntVect<IndexType> &other) {
|
|
54
|
+
if (this == &other) {
|
|
55
|
+
return *this;
|
|
56
|
+
}
|
|
57
|
+
d_length = other.d_length;
|
|
58
|
+
d_data.clear();
|
|
59
|
+
d_data.insert(other.d_data.begin(), other.d_data.end());
|
|
60
|
+
return *this;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
//! destructor (doesn't need to do anything)
|
|
64
|
+
~SparseIntVect() = default;
|
|
65
|
+
|
|
66
|
+
#ifdef __clang__
|
|
67
|
+
#pragma clang diagnostic push
|
|
68
|
+
#pragma clang diagnostic ignored "-Wtautological-compare"
|
|
69
|
+
#elif (defined(__GNUC__) || defined(__GNUG__)) && \
|
|
70
|
+
(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 1))
|
|
71
|
+
#if (__GNUC__ > 4 || __GNUC_MINOR__ > 5)
|
|
72
|
+
#pragma GCC diagnostic push
|
|
73
|
+
#endif
|
|
74
|
+
#pragma GCC diagnostic ignored "-Wtype-limits"
|
|
75
|
+
#endif
|
|
76
|
+
//! return the value at an index
|
|
77
|
+
int getVal(IndexType idx) const {
|
|
78
|
+
if (idx < 0 || idx >= d_length) {
|
|
79
|
+
throw IndexErrorException(static_cast<int>(idx));
|
|
80
|
+
}
|
|
81
|
+
int res = 0;
|
|
82
|
+
typename StorageType::const_iterator iter = d_data.find(idx);
|
|
83
|
+
if (iter != d_data.end()) {
|
|
84
|
+
res = iter->second;
|
|
85
|
+
}
|
|
86
|
+
return res;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
//! set the value at an index
|
|
90
|
+
void setVal(IndexType idx, int val) {
|
|
91
|
+
if (idx < 0 || idx >= d_length) {
|
|
92
|
+
throw IndexErrorException(static_cast<int>(idx));
|
|
93
|
+
}
|
|
94
|
+
if (val != 0) {
|
|
95
|
+
d_data[idx] = val;
|
|
96
|
+
} else {
|
|
97
|
+
d_data.erase(idx);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
#ifdef __clang__
|
|
101
|
+
#pragma clang diagnostic pop
|
|
102
|
+
#elif (defined(__GNUC__) || defined(__GNUG__)) && \
|
|
103
|
+
(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 5))
|
|
104
|
+
#pragma GCC diagnostic pop
|
|
105
|
+
#endif
|
|
106
|
+
//! support indexing using []
|
|
107
|
+
int operator[](IndexType idx) const { return getVal(idx); }
|
|
108
|
+
|
|
109
|
+
//! returns the length
|
|
110
|
+
IndexType getLength() const { return d_length; }
|
|
111
|
+
|
|
112
|
+
//! returns the sum of all the elements in the vect
|
|
113
|
+
//! the doAbs argument toggles summing the absolute values of the elements
|
|
114
|
+
int getTotalVal(bool doAbs = false) const {
|
|
115
|
+
int res = 0;
|
|
116
|
+
typename StorageType::const_iterator iter;
|
|
117
|
+
for (iter = d_data.begin(); iter != d_data.end(); ++iter) {
|
|
118
|
+
if (!doAbs) {
|
|
119
|
+
res += iter->second;
|
|
120
|
+
} else {
|
|
121
|
+
res += abs(iter->second);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return res;
|
|
125
|
+
}
|
|
126
|
+
//! returns the length
|
|
127
|
+
unsigned int size() const { return getLength(); }
|
|
128
|
+
|
|
129
|
+
//! returns our nonzero elements as a map(IndexType->int)
|
|
130
|
+
const StorageType &getNonzeroElements() const { return d_data; }
|
|
131
|
+
|
|
132
|
+
//! this is a "fuzzy" intesection, the final value
|
|
133
|
+
//! of each element is equal to the minimum from
|
|
134
|
+
//! the two vects.
|
|
135
|
+
SparseIntVect<IndexType> &operator&=(const SparseIntVect<IndexType> &other) {
|
|
136
|
+
if (other.d_length != d_length) {
|
|
137
|
+
throw ValueErrorException("SparseIntVect size mismatch");
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
typename StorageType::iterator iter = d_data.begin();
|
|
141
|
+
typename StorageType::const_iterator oIter = other.d_data.begin();
|
|
142
|
+
while (iter != d_data.end()) {
|
|
143
|
+
// we're relying on the fact that the maps are sorted:
|
|
144
|
+
while (oIter != other.d_data.end() && oIter->first < iter->first) {
|
|
145
|
+
++oIter;
|
|
146
|
+
}
|
|
147
|
+
if (oIter != other.d_data.end() && oIter->first == iter->first) {
|
|
148
|
+
// found it:
|
|
149
|
+
if (oIter->second < iter->second) {
|
|
150
|
+
iter->second = oIter->second;
|
|
151
|
+
}
|
|
152
|
+
++oIter;
|
|
153
|
+
++iter;
|
|
154
|
+
} else {
|
|
155
|
+
// not there; our value is zero, which means
|
|
156
|
+
// we should remove this value:
|
|
157
|
+
typename StorageType::iterator tmpIter = iter;
|
|
158
|
+
++tmpIter;
|
|
159
|
+
d_data.erase(iter);
|
|
160
|
+
iter = tmpIter;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return *this;
|
|
164
|
+
}
|
|
165
|
+
const SparseIntVect<IndexType> operator&(
|
|
166
|
+
const SparseIntVect<IndexType> &other) const {
|
|
167
|
+
SparseIntVect<IndexType> res(*this);
|
|
168
|
+
return res &= other;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
//! this is a "fuzzy" union, the final value
|
|
172
|
+
//! of each element is equal to the maximum from
|
|
173
|
+
//! the two vects.
|
|
174
|
+
SparseIntVect<IndexType> &operator|=(const SparseIntVect<IndexType> &other) {
|
|
175
|
+
if (other.d_length != d_length) {
|
|
176
|
+
throw ValueErrorException("SparseIntVect size mismatch");
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
typename StorageType::iterator iter = d_data.begin();
|
|
180
|
+
typename StorageType::const_iterator oIter = other.d_data.begin();
|
|
181
|
+
while (iter != d_data.end()) {
|
|
182
|
+
// we're relying on the fact that the maps are sorted:
|
|
183
|
+
while (oIter != other.d_data.end() && oIter->first < iter->first) {
|
|
184
|
+
d_data[oIter->first] = oIter->second;
|
|
185
|
+
++oIter;
|
|
186
|
+
}
|
|
187
|
+
if (oIter != other.d_data.end() && oIter->first == iter->first) {
|
|
188
|
+
// found it:
|
|
189
|
+
if (oIter->second > iter->second) {
|
|
190
|
+
iter->second = oIter->second;
|
|
191
|
+
}
|
|
192
|
+
++oIter;
|
|
193
|
+
}
|
|
194
|
+
++iter;
|
|
195
|
+
}
|
|
196
|
+
// finish up the other vect:
|
|
197
|
+
while (oIter != other.d_data.end()) {
|
|
198
|
+
d_data[oIter->first] = oIter->second;
|
|
199
|
+
++oIter;
|
|
200
|
+
}
|
|
201
|
+
return *this;
|
|
202
|
+
}
|
|
203
|
+
const SparseIntVect<IndexType> operator|(
|
|
204
|
+
const SparseIntVect<IndexType> &other) const {
|
|
205
|
+
SparseIntVect<IndexType> res(*this);
|
|
206
|
+
return res |= other;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
SparseIntVect<IndexType> &operator+=(const SparseIntVect<IndexType> &other) {
|
|
210
|
+
if (other.d_length != d_length) {
|
|
211
|
+
throw ValueErrorException("SparseIntVect size mismatch");
|
|
212
|
+
}
|
|
213
|
+
typename StorageType::iterator iter = d_data.begin();
|
|
214
|
+
typename StorageType::const_iterator oIter = other.d_data.begin();
|
|
215
|
+
while (oIter != other.d_data.end()) {
|
|
216
|
+
while (iter != d_data.end() && iter->first < oIter->first) {
|
|
217
|
+
++iter;
|
|
218
|
+
}
|
|
219
|
+
if (iter != d_data.end() && oIter->first == iter->first) {
|
|
220
|
+
// found it:
|
|
221
|
+
iter->second += oIter->second;
|
|
222
|
+
if (!iter->second) {
|
|
223
|
+
typename StorageType::iterator tIter = iter;
|
|
224
|
+
++tIter;
|
|
225
|
+
d_data.erase(iter);
|
|
226
|
+
iter = tIter;
|
|
227
|
+
} else {
|
|
228
|
+
++iter;
|
|
229
|
+
}
|
|
230
|
+
} else {
|
|
231
|
+
d_data[oIter->first] = oIter->second;
|
|
232
|
+
}
|
|
233
|
+
++oIter;
|
|
234
|
+
}
|
|
235
|
+
return *this;
|
|
236
|
+
}
|
|
237
|
+
const SparseIntVect<IndexType> operator+(
|
|
238
|
+
const SparseIntVect<IndexType> &other) const {
|
|
239
|
+
SparseIntVect<IndexType> res(*this);
|
|
240
|
+
return res += other;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
SparseIntVect<IndexType> &operator-=(const SparseIntVect<IndexType> &other) {
|
|
244
|
+
if (other.d_length != d_length) {
|
|
245
|
+
throw ValueErrorException("SparseIntVect size mismatch");
|
|
246
|
+
}
|
|
247
|
+
typename StorageType::iterator iter = d_data.begin();
|
|
248
|
+
typename StorageType::const_iterator oIter = other.d_data.begin();
|
|
249
|
+
while (oIter != other.d_data.end()) {
|
|
250
|
+
while (iter != d_data.end() && iter->first < oIter->first) {
|
|
251
|
+
++iter;
|
|
252
|
+
}
|
|
253
|
+
if (iter != d_data.end() && oIter->first == iter->first) {
|
|
254
|
+
// found it:
|
|
255
|
+
iter->second -= oIter->second;
|
|
256
|
+
if (!iter->second) {
|
|
257
|
+
typename StorageType::iterator tIter = iter;
|
|
258
|
+
++tIter;
|
|
259
|
+
d_data.erase(iter);
|
|
260
|
+
iter = tIter;
|
|
261
|
+
} else {
|
|
262
|
+
++iter;
|
|
263
|
+
}
|
|
264
|
+
} else {
|
|
265
|
+
d_data[oIter->first] = -oIter->second;
|
|
266
|
+
}
|
|
267
|
+
++oIter;
|
|
268
|
+
}
|
|
269
|
+
return *this;
|
|
270
|
+
}
|
|
271
|
+
const SparseIntVect<IndexType> operator-(
|
|
272
|
+
const SparseIntVect<IndexType> &other) const {
|
|
273
|
+
SparseIntVect<IndexType> res(*this);
|
|
274
|
+
return res -= other;
|
|
275
|
+
}
|
|
276
|
+
SparseIntVect<IndexType> &operator*=(int v) {
|
|
277
|
+
typename StorageType::iterator iter = d_data.begin();
|
|
278
|
+
while (iter != d_data.end()) {
|
|
279
|
+
iter->second *= v;
|
|
280
|
+
++iter;
|
|
281
|
+
}
|
|
282
|
+
return *this;
|
|
283
|
+
}
|
|
284
|
+
SparseIntVect<IndexType> &operator*(int v) {
|
|
285
|
+
SparseIntVect<IndexType> res(*this);
|
|
286
|
+
return res *= v;
|
|
287
|
+
}
|
|
288
|
+
SparseIntVect<IndexType> &operator/=(int v) {
|
|
289
|
+
typename StorageType::iterator iter = d_data.begin();
|
|
290
|
+
while (iter != d_data.end()) {
|
|
291
|
+
iter->second /= v;
|
|
292
|
+
++iter;
|
|
293
|
+
}
|
|
294
|
+
return *this;
|
|
295
|
+
}
|
|
296
|
+
SparseIntVect<IndexType> &operator/(int v) {
|
|
297
|
+
SparseIntVect<IndexType> res(*this);
|
|
298
|
+
return res /= v;
|
|
299
|
+
}
|
|
300
|
+
SparseIntVect<IndexType> &operator+=(int v) {
|
|
301
|
+
typename StorageType::iterator iter = d_data.begin();
|
|
302
|
+
while (iter != d_data.end()) {
|
|
303
|
+
iter->second += v;
|
|
304
|
+
++iter;
|
|
305
|
+
}
|
|
306
|
+
return *this;
|
|
307
|
+
}
|
|
308
|
+
SparseIntVect<IndexType> &operator+(int v) {
|
|
309
|
+
SparseIntVect<IndexType> res(*this);
|
|
310
|
+
return res += v;
|
|
311
|
+
}
|
|
312
|
+
SparseIntVect<IndexType> &operator-=(int v) {
|
|
313
|
+
typename StorageType::iterator iter = d_data.begin();
|
|
314
|
+
while (iter != d_data.end()) {
|
|
315
|
+
iter->second -= v;
|
|
316
|
+
++iter;
|
|
317
|
+
}
|
|
318
|
+
return *this;
|
|
319
|
+
}
|
|
320
|
+
SparseIntVect<IndexType> &operator-(int v) {
|
|
321
|
+
SparseIntVect<IndexType> res(*this);
|
|
322
|
+
return res -= v;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
bool operator==(const SparseIntVect<IndexType> &v2) const {
|
|
326
|
+
if (d_length != v2.d_length) {
|
|
327
|
+
return false;
|
|
328
|
+
}
|
|
329
|
+
return d_data == v2.d_data;
|
|
330
|
+
}
|
|
331
|
+
bool operator!=(const SparseIntVect<IndexType> &v2) const {
|
|
332
|
+
return !(*this == v2);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
//! returns a binary string representation (pickle)
|
|
336
|
+
std::string toString() const {
|
|
337
|
+
std::stringstream ss(std::ios_base::binary | std::ios_base::out |
|
|
338
|
+
std::ios_base::in);
|
|
339
|
+
std::uint32_t tInt;
|
|
340
|
+
tInt = ci_SPARSEINTVECT_VERSION;
|
|
341
|
+
streamWrite(ss, tInt);
|
|
342
|
+
tInt = sizeof(IndexType);
|
|
343
|
+
streamWrite(ss, tInt);
|
|
344
|
+
streamWrite(ss, d_length);
|
|
345
|
+
IndexType nEntries = d_data.size();
|
|
346
|
+
streamWrite(ss, nEntries);
|
|
347
|
+
|
|
348
|
+
typename StorageType::const_iterator iter = d_data.begin();
|
|
349
|
+
while (iter != d_data.end()) {
|
|
350
|
+
streamWrite(ss, iter->first);
|
|
351
|
+
std::int32_t tInt = iter->second;
|
|
352
|
+
streamWrite(ss, tInt);
|
|
353
|
+
++iter;
|
|
354
|
+
}
|
|
355
|
+
return ss.str();
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
void fromString(const std::string &txt) {
|
|
359
|
+
initFromText(txt.c_str(), txt.length());
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
private:
|
|
363
|
+
IndexType d_length;
|
|
364
|
+
StorageType d_data;
|
|
365
|
+
|
|
366
|
+
void initFromText(const char *pkl, const unsigned int len) {
|
|
367
|
+
d_data.clear();
|
|
368
|
+
std::stringstream ss(std::ios_base::binary | std::ios_base::out |
|
|
369
|
+
std::ios_base::in);
|
|
370
|
+
ss.write(pkl, len);
|
|
371
|
+
|
|
372
|
+
std::uint32_t vers;
|
|
373
|
+
streamRead(ss, vers);
|
|
374
|
+
if (vers == 0x0001) {
|
|
375
|
+
std::uint32_t tInt;
|
|
376
|
+
streamRead(ss, tInt);
|
|
377
|
+
if (tInt > sizeof(IndexType)) {
|
|
378
|
+
throw ValueErrorException(
|
|
379
|
+
"IndexType cannot accommodate index size in SparseIntVect pickle");
|
|
380
|
+
}
|
|
381
|
+
switch (tInt) {
|
|
382
|
+
case sizeof(char):
|
|
383
|
+
readVals<unsigned char>(ss);
|
|
384
|
+
break;
|
|
385
|
+
case sizeof(std::int32_t):
|
|
386
|
+
readVals<std::uint32_t>(ss);
|
|
387
|
+
break;
|
|
388
|
+
case sizeof(boost::int64_t):
|
|
389
|
+
readVals<boost::uint64_t>(ss);
|
|
390
|
+
break;
|
|
391
|
+
default:
|
|
392
|
+
throw ValueErrorException("unreadable format");
|
|
393
|
+
}
|
|
394
|
+
} else {
|
|
395
|
+
throw ValueErrorException("bad version in SparseIntVect pickle");
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
template <typename T>
|
|
399
|
+
void readVals(std::stringstream &ss) {
|
|
400
|
+
PRECONDITION(sizeof(T) <= sizeof(IndexType), "invalid size");
|
|
401
|
+
T tVal;
|
|
402
|
+
streamRead(ss, tVal);
|
|
403
|
+
d_length = tVal;
|
|
404
|
+
T nEntries;
|
|
405
|
+
streamRead(ss, nEntries);
|
|
406
|
+
for (T i = 0; i < nEntries; ++i) {
|
|
407
|
+
streamRead(ss, tVal);
|
|
408
|
+
std::int32_t val;
|
|
409
|
+
streamRead(ss, val);
|
|
410
|
+
d_data[tVal] = val;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
};
|
|
414
|
+
|
|
415
|
+
template <typename IndexType, typename SequenceType>
|
|
416
|
+
void updateFromSequence(SparseIntVect<IndexType> &vect,
|
|
417
|
+
const SequenceType &seq) {
|
|
418
|
+
typename SequenceType::const_iterator seqIt;
|
|
419
|
+
for (seqIt = seq.begin(); seqIt != seq.end(); ++seqIt) {
|
|
420
|
+
// EFF: probably not the most efficient approach
|
|
421
|
+
IndexType idx = *seqIt;
|
|
422
|
+
vect.setVal(idx, vect.getVal(idx) + 1);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
namespace {
|
|
427
|
+
template <typename IndexType>
|
|
428
|
+
void calcVectParams(const SparseIntVect<IndexType> &v1,
|
|
429
|
+
const SparseIntVect<IndexType> &v2, double &v1Sum,
|
|
430
|
+
double &v2Sum, double &andSum) {
|
|
431
|
+
if (v1.getLength() != v2.getLength()) {
|
|
432
|
+
throw ValueErrorException("SparseIntVect size mismatch");
|
|
433
|
+
}
|
|
434
|
+
v1Sum = v2Sum = andSum = 0.0;
|
|
435
|
+
// we're doing : (v1&v2).getTotalVal(), but w/o generating
|
|
436
|
+
// the other vector:
|
|
437
|
+
typename SparseIntVect<IndexType>::StorageType::const_iterator iter1, iter2;
|
|
438
|
+
iter1 = v1.getNonzeroElements().begin();
|
|
439
|
+
if (iter1 != v1.getNonzeroElements().end()) {
|
|
440
|
+
v1Sum += abs(iter1->second);
|
|
441
|
+
}
|
|
442
|
+
iter2 = v2.getNonzeroElements().begin();
|
|
443
|
+
if (iter2 != v2.getNonzeroElements().end()) {
|
|
444
|
+
v2Sum += abs(iter2->second);
|
|
445
|
+
}
|
|
446
|
+
while (iter1 != v1.getNonzeroElements().end()) {
|
|
447
|
+
while (iter2 != v2.getNonzeroElements().end() &&
|
|
448
|
+
iter2->first < iter1->first) {
|
|
449
|
+
++iter2;
|
|
450
|
+
if (iter2 != v2.getNonzeroElements().end()) {
|
|
451
|
+
v2Sum += abs(iter2->second);
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
if (iter2 != v2.getNonzeroElements().end()) {
|
|
455
|
+
if (iter2->first == iter1->first) {
|
|
456
|
+
if (abs(iter2->second) < abs(iter1->second)) {
|
|
457
|
+
andSum += abs(iter2->second);
|
|
458
|
+
} else {
|
|
459
|
+
andSum += abs(iter1->second);
|
|
460
|
+
}
|
|
461
|
+
++iter2;
|
|
462
|
+
if (iter2 != v2.getNonzeroElements().end()) {
|
|
463
|
+
v2Sum += abs(iter2->second);
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
++iter1;
|
|
467
|
+
if (iter1 != v1.getNonzeroElements().end()) {
|
|
468
|
+
v1Sum += abs(iter1->second);
|
|
469
|
+
}
|
|
470
|
+
} else {
|
|
471
|
+
break;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
if (iter1 != v1.getNonzeroElements().end()) {
|
|
475
|
+
++iter1;
|
|
476
|
+
while (iter1 != v1.getNonzeroElements().end()) {
|
|
477
|
+
v1Sum += abs(iter1->second);
|
|
478
|
+
++iter1;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
if (iter2 != v2.getNonzeroElements().end()) {
|
|
482
|
+
++iter2;
|
|
483
|
+
while (iter2 != v2.getNonzeroElements().end()) {
|
|
484
|
+
v2Sum += abs(iter2->second);
|
|
485
|
+
++iter2;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
} // namespace
|
|
490
|
+
|
|
491
|
+
template <typename IndexType>
|
|
492
|
+
double DiceSimilarity(const SparseIntVect<IndexType> &v1,
|
|
493
|
+
const SparseIntVect<IndexType> &v2,
|
|
494
|
+
bool returnDistance = false, double bounds = 0.0) {
|
|
495
|
+
if (v1.getLength() != v2.getLength()) {
|
|
496
|
+
throw ValueErrorException("SparseIntVect size mismatch");
|
|
497
|
+
}
|
|
498
|
+
double v1Sum = 0.0;
|
|
499
|
+
double v2Sum = 0.0;
|
|
500
|
+
if (!returnDistance && bounds > 0.0) {
|
|
501
|
+
v1Sum = v1.getTotalVal(true);
|
|
502
|
+
v2Sum = v2.getTotalVal(true);
|
|
503
|
+
double denom = v1Sum + v2Sum;
|
|
504
|
+
if (fabs(denom) < 1e-6) {
|
|
505
|
+
// no need to worry about returnDistance here
|
|
506
|
+
return 0.0;
|
|
507
|
+
}
|
|
508
|
+
double minV = v1Sum < v2Sum ? v1Sum : v2Sum;
|
|
509
|
+
if (2. * minV / denom < bounds) {
|
|
510
|
+
return 0.0;
|
|
511
|
+
}
|
|
512
|
+
v1Sum = 0.0;
|
|
513
|
+
v2Sum = 0.0;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
double numer = 0.0;
|
|
517
|
+
|
|
518
|
+
calcVectParams(v1, v2, v1Sum, v2Sum, numer);
|
|
519
|
+
|
|
520
|
+
double denom = v1Sum + v2Sum;
|
|
521
|
+
double sim;
|
|
522
|
+
if (fabs(denom) < 1e-6) {
|
|
523
|
+
sim = 0.0;
|
|
524
|
+
} else {
|
|
525
|
+
sim = 2. * numer / denom;
|
|
526
|
+
}
|
|
527
|
+
if (returnDistance) {
|
|
528
|
+
sim = 1. - sim;
|
|
529
|
+
}
|
|
530
|
+
// std::cerr<<" "<<v1Sum<<" "<<v2Sum<<" " << numer << " " << sim <<std::endl;
|
|
531
|
+
return sim;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
template <typename IndexType>
|
|
535
|
+
double TverskySimilarity(const SparseIntVect<IndexType> &v1,
|
|
536
|
+
const SparseIntVect<IndexType> &v2, double a, double b,
|
|
537
|
+
bool returnDistance = false, double bounds = 0.0) {
|
|
538
|
+
RDUNUSED_PARAM(bounds);
|
|
539
|
+
if (v1.getLength() != v2.getLength()) {
|
|
540
|
+
throw ValueErrorException("SparseIntVect size mismatch");
|
|
541
|
+
}
|
|
542
|
+
double v1Sum = 0.0;
|
|
543
|
+
double v2Sum = 0.0;
|
|
544
|
+
double andSum = 0.0;
|
|
545
|
+
|
|
546
|
+
calcVectParams(v1, v2, v1Sum, v2Sum, andSum);
|
|
547
|
+
|
|
548
|
+
double denom = a * v1Sum + b * v2Sum + (1 - a - b) * andSum;
|
|
549
|
+
double sim;
|
|
550
|
+
|
|
551
|
+
if (fabs(denom) < 1e-6) {
|
|
552
|
+
sim = 0.0;
|
|
553
|
+
} else {
|
|
554
|
+
sim = andSum / denom;
|
|
555
|
+
}
|
|
556
|
+
if (returnDistance) {
|
|
557
|
+
sim = 1. - sim;
|
|
558
|
+
}
|
|
559
|
+
// std::cerr<<" "<<v1Sum<<" "<<v2Sum<<" " << numer << " " << sim <<std::endl;
|
|
560
|
+
return sim;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
template <typename IndexType>
|
|
564
|
+
double TanimotoSimilarity(const SparseIntVect<IndexType> &v1,
|
|
565
|
+
const SparseIntVect<IndexType> &v2,
|
|
566
|
+
bool returnDistance = false, double bounds = 0.0) {
|
|
567
|
+
return TverskySimilarity(v1, v2, 1.0, 1.0, returnDistance, bounds);
|
|
568
|
+
}
|
|
569
|
+
} // namespace RDKit
|
|
570
|
+
|
|
571
|
+
#endif
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright (C) 2002-2008 Greg Landrum and Rational Discovery LLC
|
|
3
|
+
//
|
|
4
|
+
// @@ All Rights Reserved @@
|
|
5
|
+
// This file is part of the RDKit.
|
|
6
|
+
// The contents are covered by the terms of the BSD license
|
|
7
|
+
// which is included in the file license.txt, found at the root
|
|
8
|
+
// of the RDKit source tree.
|
|
9
|
+
//
|
|
10
|
+
#include <RDGeneral/export.h>
|
|
11
|
+
#ifndef __RD_BASE64_H__
|
|
12
|
+
#define __RD_BASE64_H__
|
|
13
|
+
/*! \file base64.h
|
|
14
|
+
|
|
15
|
+
\brief Functionality for base64 encoding/decoding
|
|
16
|
+
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
//! return the base64 encoding of an array of unsigned chars
|
|
20
|
+
/*!
|
|
21
|
+
<b>Note:</b> The caller is responsible for calling \c delete[] on the
|
|
22
|
+
char array returned by this function.
|
|
23
|
+
*/
|
|
24
|
+
RDKIT_DATASTRUCTS_EXPORT char *Base64Encode(const unsigned char *,
|
|
25
|
+
const unsigned int);
|
|
26
|
+
|
|
27
|
+
//! return the base64 encoding of an array of chars
|
|
28
|
+
/*!
|
|
29
|
+
<b>Note:</b> The caller is responsible for calling \c delete[] on the
|
|
30
|
+
char array returned by this function.
|
|
31
|
+
*/
|
|
32
|
+
RDKIT_DATASTRUCTS_EXPORT char *Base64Encode(const char *, const unsigned int);
|
|
33
|
+
|
|
34
|
+
//! return the decoded version of a base64 encoded char array
|
|
35
|
+
/*!
|
|
36
|
+
<b>Note:</b> The caller is responsible for calling \c delete[] on the
|
|
37
|
+
char array returned by this function.
|
|
38
|
+
*/
|
|
39
|
+
RDKIT_DATASTRUCTS_EXPORT char *Base64Decode(const char *, unsigned int *);
|
|
40
|
+
|
|
41
|
+
#endif
|