rdkit_chem 2019.03.3.1 → 2025.09.3.2

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 (89) hide show
  1. checksums.yaml +4 -4
  2. data/CMakeLists.txt +713 -0
  3. data/Code/CMakeLists.txt +44 -0
  4. data/Code/RubyWrappers/Abbreviations.i +19 -0
  5. data/Code/RubyWrappers/AddHs.i +34 -0
  6. data/Code/RubyWrappers/Atom.i +165 -0
  7. data/Code/RubyWrappers/AtomIterators.i +77 -0
  8. data/Code/RubyWrappers/AtomPairs.i +95 -0
  9. data/Code/RubyWrappers/AvalonLib.i +41 -0
  10. data/Code/RubyWrappers/BitOps.i +72 -0
  11. data/Code/RubyWrappers/Bond.i +87 -0
  12. data/Code/RubyWrappers/BondIterators.i +61 -0
  13. data/Code/RubyWrappers/CMakeLists.txt +67 -0
  14. data/Code/RubyWrappers/Canon.i +40 -0
  15. data/Code/RubyWrappers/ChemDraw.i +81 -0
  16. data/Code/RubyWrappers/ChemReactions.i +166 -0
  17. data/Code/RubyWrappers/ChemTransforms.i +126 -0
  18. data/Code/RubyWrappers/Conformer.i +69 -0
  19. data/Code/RubyWrappers/Descriptors.i +64 -0
  20. data/Code/RubyWrappers/Dict.i +45 -0
  21. data/Code/RubyWrappers/DistGeom.i +217 -0
  22. data/Code/RubyWrappers/DiversityPick.h +49 -0
  23. data/Code/RubyWrappers/DiversityPick.i +10 -0
  24. data/Code/RubyWrappers/ErrorGenerator.i +73 -0
  25. data/Code/RubyWrappers/ExplicitBitVect.i +76 -0
  26. data/Code/RubyWrappers/FMCS.i +63 -0
  27. data/Code/RubyWrappers/FilterCatalog.i +154 -0
  28. data/Code/RubyWrappers/Fingerprints.i +56 -0
  29. data/Code/RubyWrappers/ForceField.i +161 -0
  30. data/Code/RubyWrappers/GeneralizedSubstruct.i +38 -0
  31. data/Code/RubyWrappers/GenericRDKitException.h +27 -0
  32. data/Code/RubyWrappers/Inchi.i +38 -0
  33. data/Code/RubyWrappers/MolBundle.i +16 -0
  34. data/Code/RubyWrappers/MolDraw2D.i +117 -0
  35. data/Code/RubyWrappers/MolEnumerator.i +45 -0
  36. data/Code/RubyWrappers/MolHash.i +25 -0
  37. data/Code/RubyWrappers/MolOps.i +72 -0
  38. data/Code/RubyWrappers/MolStandardize.i +37 -0
  39. data/Code/RubyWrappers/MolSupplier.i +83 -0
  40. data/Code/RubyWrappers/MolTransforms.i +39 -0
  41. data/Code/RubyWrappers/MolWriters.i +41 -0
  42. data/Code/RubyWrappers/MonomerInfo.i +42 -0
  43. data/Code/RubyWrappers/MorganFingerprints.h +21 -0
  44. data/Code/RubyWrappers/MorganFingerprints.i +66 -0
  45. data/Code/RubyWrappers/PeriodicTable.i +44 -0
  46. data/Code/RubyWrappers/Queries.i +289 -0
  47. data/Code/RubyWrappers/QueryAtom.i +47 -0
  48. data/Code/RubyWrappers/QueryBond.i +47 -0
  49. data/Code/RubyWrappers/QueryOps.i +44 -0
  50. data/Code/RubyWrappers/RDKitExceptions.i +75 -0
  51. data/Code/RubyWrappers/RDLogger.i +74 -0
  52. data/Code/RubyWrappers/RDProps.i +44 -0
  53. data/Code/RubyWrappers/RGroupDecomposition.i +52 -0
  54. data/Code/RubyWrappers/ROMol.i +695 -0
  55. data/Code/RubyWrappers/RWMol.i +241 -0
  56. data/Code/RubyWrappers/RascalMCES.i +71 -0
  57. data/Code/RubyWrappers/ReactionFingerprints.i +37 -0
  58. data/Code/RubyWrappers/RingInfo.i +40 -0
  59. data/Code/RubyWrappers/Rings.i +40 -0
  60. data/Code/RubyWrappers/SanitException.i +100 -0
  61. data/Code/RubyWrappers/ScaffoldNetwork.i +28 -0
  62. data/Code/RubyWrappers/SmartsWrite.i +38 -0
  63. data/Code/RubyWrappers/SmilesParse.i +40 -0
  64. data/Code/RubyWrappers/SmilesWrite.i +42 -0
  65. data/Code/RubyWrappers/StereoGroup.i +16 -0
  66. data/Code/RubyWrappers/Streams.i +67 -0
  67. data/Code/RubyWrappers/Subgraphs.i +53 -0
  68. data/Code/RubyWrappers/Subset.i +75 -0
  69. data/Code/RubyWrappers/SubstanceGroup.i +91 -0
  70. data/Code/RubyWrappers/SubstructLibrary.i +80 -0
  71. data/Code/RubyWrappers/TautomerQuery.i +19 -0
  72. data/Code/RubyWrappers/Trajectory.i +34 -0
  73. data/Code/RubyWrappers/boost_tuple.i +64 -0
  74. data/Code/RubyWrappers/extend_std_vector.i +10 -0
  75. data/Code/RubyWrappers/gmwrapper/CMakeLists.txt +69 -0
  76. data/Code/RubyWrappers/gmwrapper/GraphMolRuby.i +431 -0
  77. data/Code/RubyWrappers/gmwrapper/std_list.i +65 -0
  78. data/Code/RubyWrappers/point.i +56 -0
  79. data/Code/RubyWrappers/transforms.i +60 -0
  80. data/Code/RubyWrappers/types.i +40 -0
  81. data/README.md +24 -0
  82. data/Rakefile +165 -4
  83. data/ext/rdkit_chem/CMakeLists.txt +69 -0
  84. data/ext/rdkit_chem/Makefile +5 -0
  85. data/ext/rdkit_chem/extconf.rb +47 -17
  86. data/lib/rdkit_chem/version.rb +2 -2
  87. data/lib/rdkit_chem.rb +31 -1
  88. data/test/test_rdkit_chem.rb +38 -10
  89. metadata +119 -13
@@ -0,0 +1,61 @@
1
+ /*
2
+ * $Id$
3
+ *
4
+ * Copyright (c) 2010, Novartis Institutes for BioMedical Research Inc.
5
+ * All rights reserved.
6
+ *
7
+ * Redistribution and use in source and binary forms, with or without
8
+ * modification, are permitted provided that the following conditions are
9
+ * met:
10
+ *
11
+ * * Redistributions of source code must retain the above copyright
12
+ * notice, this list of conditions and the following disclaimer.
13
+ * * Redistributions in binary form must reproduce the above
14
+ * copyright notice, this list of conditions and the following
15
+ * disclaimer in the documentation and/or other materials provided
16
+ * with the distribution.
17
+ * * Neither the name of Novartis Institutes for BioMedical Research Inc.
18
+ * nor the names of its contributors may be used to endorse or promote
19
+ * products derived from this software without specific prior written 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
+
34
+ %include "std_string.i"
35
+ %include "std_vector.i"
36
+ %include "std_map.i"
37
+ %include "std_pair.i"
38
+
39
+ %{
40
+ #include <GraphMol/BondIterators.h>
41
+ %}
42
+
43
+
44
+ %rename(BondIterator) RDKit::BondIterator_;
45
+ %rename(ConstBondIterator) RDKit::ConstBondIterator_;
46
+ /* Equality testing operators have been overloaded, so we need to expose them in a different way */
47
+ %rename(eq) RDKit::BondIterator_::operator==;
48
+ %rename(ne) RDKit::BondIterator_::operator!=;
49
+ %rename(eq) RDKit::ConstBondIterator_::operator==;
50
+ %rename(ne) RDKit::ConstBondIterator_::operator!=;
51
+ /* Increment and decrement operators currently necessary */
52
+ %rename(next) RDKit::BondIterator_::operator++;
53
+ %rename(next) RDKit::ConstBondIterator_::operator++;
54
+ %rename(prev) RDKit::BondIterator_::operator--;
55
+ %rename(prev) RDKit::ConstBondIterator_::operator--;
56
+ /* A better name for the iterator's Bond object */
57
+ %rename(getBond) RDKit::BondIterator_::operator*;
58
+ %rename(getBond) RDKit::ConstBondIterator_::operator*;
59
+
60
+ %include <GraphMol/BondIterators.h>
61
+
@@ -0,0 +1,67 @@
1
+ find_package(SWIG 4.2 REQUIRED)
2
+ include(${SWIG_USE_FILE})
3
+
4
+ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
5
+ include_directories(${RDKit_CodeDir})
6
+ include_directories(${Boost_INCLUDE_DIRS})
7
+
8
+ SET(CMAKE_SWIG_FLAGS "")
9
+
10
+
11
+ set(swigRDKitLibSuffix "")
12
+ if(RDK_SWIG_STATIC AND ((NOT MSVC) OR (MSVC AND RDK_INSTALL_DLLS_MSVC)))
13
+ set(swigRDKitLibSuffix "_static")
14
+ endif()
15
+ set(swigRDKitLibList "")
16
+ if(RDK_BUILD_AVALON_SUPPORT)
17
+ set(swigRDKitLibList "${swigRDKitLibList}AvalonLib;avalon_clib;")
18
+ endif(RDK_BUILD_AVALON_SUPPORT)
19
+ if(RDK_BUILD_INCHI_SUPPORT)
20
+ set(swigRDKitLibList "${swigRDKitLibList}RDInchiLib;${INCHI_LIBRARIES};")
21
+ endif(RDK_BUILD_INCHI_SUPPORT)
22
+ set(swigRDKitLibList "${swigRDKitLibList}"
23
+ "ScaffoldNetwork;MolHash;RGroupDecomposition;SubstructLibrary;"
24
+ "MolStandardize;FilterCatalog;Catalogs;FMCS;MolDraw2D;FileParsers;SmilesParse;"
25
+ "Depictor;SubstructMatch;ChemReactions;Fingerprints;ChemTransforms;"
26
+ "Subgraphs;GraphMol;DataStructs;Trajectory;Descriptors;"
27
+ "PartialCharges;MolTransforms;DistGeomHelpers;DistGeometry;"
28
+ "ForceFieldHelpers;ForceField;EigenSolvers;Optimizer;MolAlign;"
29
+ "Alignment;SimDivPickers;RDGeometryLib;RDStreams;RDGeneral;"
30
+ "Abbreviations;GeneralizedSubstruct;MolEnumerator;TautomerQuery;RascalMCES;"
31
+ )
32
+ #if(RDK_BUILD_COORDGEN_SUPPORT)
33
+ # set(swigRDKitLibList "${swigRDKitLibList};${RDK_COORDGEN_LIBS}")
34
+ #endif(RDK_BUILD_COORDGEN_SUPPORT)
35
+ if(RDK_USE_URF)
36
+ set(swigRDKitLibList "${swigRDKitLibList};${RDK_URF_LIBS};")
37
+ endif(RDK_USE_URF)
38
+ set(swigRDKitLibs "")
39
+ foreach(swigRDKitLib ${swigRDKitLibList})
40
+ set(swigRDKitLibs "${swigRDKitLibs}${swigRDKitLib}${swigRDKitLibSuffix};")
41
+ endforeach()
42
+ set(swigRDKitLibs "${swigRDKitLibs}${Boost_SERIALIZATION_LIBRARY};")
43
+
44
+ if(RDK_USE_BOOST_IOSTREAMS)
45
+ ADD_DEFINITIONS("-DRDK_USE_BOOST_IOSTREAMS")
46
+ if(WIN32)
47
+ find_package(Boost 1.56.0 COMPONENTS system iostreams REQUIRED)
48
+ set(swigRDKitLibs "${swigRDKitLibs}${Boost_IOSTREAMS_LIBRARY};${Boost_SYSTEM_LIBRARY};")
49
+
50
+ find_package(Boost 1.56.0 COMPONENTS zlib)
51
+ if(Boost_ZLIB_FOUND)
52
+ set(swigRDKitLibs "${swigRDKitLibs}${Boost_ZLIB_LIBRARY};")
53
+ endif()
54
+ else()
55
+ find_package(Boost 1.56.0 COMPONENTS system iostreams REQUIRED)
56
+ set(swigRDKitLibs "${swigRDKitLibs}${Boost_IOSTREAMS_LIBRARY};${Boost_SYSTEM_LIBRARY};")
57
+ endif()
58
+ endif(RDK_USE_BOOST_IOSTREAMS)
59
+
60
+
61
+
62
+ set(RDKit_Wrapper_Libs ${swigRDKitLibs})
63
+
64
+ message("SUFFIX: ${swigRDKitLibSuffix}")
65
+ message("RUBY_LIBS: ${RDKit_Wrapper_Libs}")
66
+
67
+ add_subdirectory(gmwrapper)
@@ -0,0 +1,40 @@
1
+ /*
2
+ * $Id$
3
+ *
4
+ * Copyright (c) 2010, Novartis Institutes for BioMedical Research Inc.
5
+ * All rights reserved.
6
+ *
7
+ * Redistribution and use in source and binary forms, with or without
8
+ * modification, are permitted provided that the following conditions are
9
+ * met:
10
+ *
11
+ * * Redistributions of source code must retain the above copyright
12
+ * notice, this list of conditions and the following disclaimer.
13
+ * * Redistributions in binary form must reproduce the above
14
+ * copyright notice, this list of conditions and the following
15
+ * disclaimer in the documentation and/or other materials provided
16
+ * with the distribution.
17
+ * * Neither the name of Novartis Institutes for BioMedical Research Inc.
18
+ * nor the names of its contributors may be used to endorse or promote
19
+ * products derived from this software without specific prior written 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
+
34
+ %{
35
+ #include <GraphMol/Canon.h>
36
+ %}
37
+
38
+
39
+
40
+ %include <GraphMol/Canon.h>
@@ -0,0 +1,81 @@
1
+ /*
2
+ * $Id$
3
+ *
4
+ * Copyright (c) 2025, Glysade Inc.
5
+ * All rights reserved.
6
+ *
7
+ * Redistribution and use in source and binary forms, with or without
8
+ * modification, are permitted provided that the following conditions are
9
+ * met:
10
+ *
11
+ * * Redistributions of source code must retain the above copyright
12
+ * notice, this list of conditions and the following disclaimer.
13
+ * * Redistributions in binary form must reproduce the above
14
+ * copyright notice, this list of conditions and the following
15
+ * disclaimer in the documentation and/or other materials provided
16
+ * with the distribution.
17
+ * * Neither the name of Novartis Institutes for BioMedical Research Inc.
18
+ * nor the names of its contributors may be used to endorse or promote
19
+ * products derived from this software without specific prior written 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
+
34
+ %{
35
+ #include <ChemDraw/chemdraw.h>
36
+ %}
37
+ %ignore RDKit::v2::MolsFromChemDrawDataStream;
38
+ %ignore RDKit::v2::MolsFromChemDrawFile;
39
+ %ignore RDKit::v2::MolsFromChemDrawBlock;
40
+ %rename("ChemDraw") RDKit::v2;
41
+ %rename(CDXFormat) RDKit::v2::CDXFormat;
42
+ %rename(ChemDrawParserParams) RDKit::v2::ChemDrawParserParams;
43
+
44
+ %include <ChemDraw/chemdraw.h>
45
+
46
+ %{
47
+ std::vector<RDKit::RWMOL_SPTR> MolsFromChemDrawBlockHelper(
48
+ const std::string &text,
49
+ const RDKit::v2::ChemDrawParserParams &params=RDKit::v2::ChemDrawParserParams()) {
50
+ auto res = RDKit::v2::MolsFromChemDrawBlock(text, params);
51
+ std::vector<RDKit::RWMOL_SPTR> mols;
52
+ for(auto &mol: res) {
53
+ mols.emplace_back(mol.release());
54
+ }
55
+ return mols;
56
+
57
+ }
58
+
59
+ std::vector<RDKit::RWMOL_SPTR> MolsFromChemDrawFileHelper(
60
+ const std::string &filename,
61
+ const RDKit::v2::ChemDrawParserParams &params=RDKit::v2::ChemDrawParserParams()) {
62
+ auto res = RDKit::v2::MolsFromChemDrawFile(filename, params);
63
+ std::vector<RDKit::RWMOL_SPTR> mols;
64
+ for(auto &mol: res) {
65
+ mols.emplace_back(mol.release());
66
+ }
67
+ return mols;
68
+ }
69
+
70
+ %}
71
+
72
+ %rename("MolsFromChemDrawBlock") MolsFromChemDrawBlockHelper;
73
+ %rename("MolsFromChemDrawFile") MolsFromChemDrawFileHelper;
74
+
75
+ std::vector<RDKit::RWMOL_SPTR> MolsFromChemDrawBlockHelper(
76
+ const std::string &text,
77
+ const RDKit::v2::ChemDrawParserParams &params=RDKit::v2::ChemDrawParserParams());
78
+
79
+ std::vector<RDKit::RWMOL_SPTR> MolsFromChemDrawFileHelper(
80
+ const std::string &filename,
81
+ const RDKit::v2::ChemDrawParserParams &params=RDKit::v2::ChemDrawParserParams());
@@ -0,0 +1,166 @@
1
+ /*
2
+ * $Id$
3
+ *
4
+ * Copyright (c) 2010, Novartis Institutes for BioMedical Research Inc.
5
+ * All rights reserved.
6
+ *
7
+ * Redistribution and use in source and binary forms, with or without
8
+ * modification, are permitted provided that the following conditions are
9
+ * met:
10
+ *
11
+ * * Redistributions of source code must retain the above copyright
12
+ * notice, this list of conditions and the following disclaimer.
13
+ * * Redistributions in binary form must reproduce the above
14
+ * copyright notice, this list of conditions and the following
15
+ * disclaimer in the documentation and/or other materials provided
16
+ * with the distribution.
17
+ * * Neither the name of Novartis Institutes for BioMedical Research Inc.
18
+ * nor the names of its contributors may be used to endorse or promote
19
+ * products derived from this software without specific prior written 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
+
34
+ %{
35
+ #include <GraphMol/RDKitBase.h>
36
+ #include <GraphMol/Substruct/SubstructMatch.h>
37
+ #include <vector>
38
+
39
+ #include <GraphMol/ChemReactions/Reaction.h>
40
+ #include <GraphMol/ChemReactions/ReactionRunner.h>
41
+ #include <GraphMol/ChemReactions/ReactionParser.h>
42
+ #include <GraphMol/ChemReactions/ReactionPickler.h>
43
+ %}
44
+
45
+ %ignore RDKit::CDXMLToChemicalReactions;
46
+ %ignore RDKit::CDXMLFileToChemicalReactions;
47
+ %ignore RDKit::CDXMLDataStreamToChemicalReactions;
48
+
49
+ %include <GraphMol/ChemReactions/Reaction.h>
50
+ %include <GraphMol/ChemReactions/ReactionParser.h>
51
+ %ignore RDKit::ChemicalReaction::validate(unsigned int &,unsigned int &,bool);
52
+ %ignore RDKit::ChemicalReaction::validate(unsigned int &,unsigned int &);
53
+ %ignore RDKit::isMoleculeReactantOfReaction(const ChemicalReaction &r,const ROMol &,
54
+ unsigned int &);
55
+ %ignore RDKit::isMoleculeProductOfReaction(const ChemicalReaction &r,const ROMol &,
56
+ unsigned int &);
57
+
58
+
59
+ %newobject ReactionFromSmarts;
60
+ %newobject ReactionFromRxnBlock;
61
+ %newobject ReactionFromRxnFile;
62
+ %newobject ReduceProductToSideChains;
63
+
64
+ %extend RDKit::ChemicalReaction {
65
+ static RDKit::ChemicalReaction *ReactionFromSmarts(std::string sma,bool useSmiles=false){
66
+ RDKit::ChemicalReaction *res=RDKit::RxnSmartsToChemicalReaction(sma,0,useSmiles);
67
+ if(res) res->initReactantMatchers();
68
+ return res;
69
+ };
70
+ static RDKit::ChemicalReaction *ReactionFromRxnBlock(std::string block){
71
+ RDKit::ChemicalReaction *res=RDKit::RxnBlockToChemicalReaction(block);
72
+ if(res) res->initReactantMatchers();
73
+ return res;
74
+ };
75
+ static RDKit::ChemicalReaction *ReactionFromRxnFile(std::string filename){
76
+ RDKit::ChemicalReaction *res=RDKit::RxnFileToChemicalReaction(filename);
77
+ if(res) res->initReactantMatchers();
78
+ return res;
79
+ };
80
+ static std::string ReactionToSmarts(ChemicalReaction &rxn) {
81
+ return RDKit::ChemicalReactionToRxnSmarts(rxn);
82
+ }
83
+ static std::string ReactionToRxnBlock (const ChemicalReaction &rxn) {
84
+ return RDKit::ChemicalReactionToRxnBlock(rxn);
85
+ };
86
+ /*
87
+ static RDKit::ROMol *ReduceProductToSideChains(RDKit::ROMOL_SPTR product,
88
+ bool addDummyAtoms=true) {
89
+ return RDKit::reduceProductToSideChains(product, addDummyAtoms);
90
+ };
91
+ */
92
+ static RDKit::ROMol *ReduceProductToSideChains(RDKit::ROMol *product,
93
+ bool addDummyAtoms=true) {
94
+ RDKit::ROMOL_SPTR mol(new RDKit::ROMol(*product));
95
+ return RDKit::reduceProductToSideChains(mol, addDummyAtoms);
96
+ };
97
+ void compute2DCoordsForReaction(double spacing,
98
+ bool updateProps,
99
+ bool canonOrient,
100
+ unsigned int nFlipsPerSample,
101
+ unsigned int nSamples,
102
+ int sampleSeed,
103
+ bool permuteDeg4Nodes){
104
+
105
+ RDDepict::compute2DCoordsForReaction(*($self),
106
+ spacing,
107
+ updateProps,
108
+ canonOrient,
109
+ nFlipsPerSample,
110
+ nSamples,
111
+ sampleSeed,
112
+ permuteDeg4Nodes);
113
+ };
114
+ std::vector<int> ToBinary(){
115
+ std::string sres;
116
+ RDKit::ReactionPickler::pickleReaction(*($self),sres);
117
+ std::vector<int> res(sres.length());
118
+ std::copy(sres.begin(),sres.end(),res.begin());
119
+ return res;
120
+ };
121
+ static RDKit::ChemicalReaction *RxnFromBinary(std::vector<int> pkl){
122
+ std::string sres;
123
+ sres.resize(pkl.size());
124
+ std::copy(pkl.begin(),pkl.end(),sres.begin());
125
+ RDKit::ChemicalReaction *res=new RDKit::ChemicalReaction(sres);
126
+ return res;
127
+ };
128
+
129
+ /* A Ruby-accessible validation function */
130
+ std::pair<int,int> *validateReaction(bool silent=false) {
131
+ std::pair<int,int> *res = new std::pair<int,int>();
132
+ unsigned int first;
133
+ unsigned int second;
134
+ ($self)->validate(first, second, silent);
135
+ res->first = (int) first;
136
+ res->second = (int) second;
137
+ return res;
138
+ };
139
+
140
+ bool validate() {
141
+ unsigned int nErr=0,nWarn=0;
142
+ bool res=$self->validate(nErr,nWarn);
143
+ return res;
144
+ };
145
+
146
+ static std::vector<std::shared_ptr<ChemicalReaction>> CDXMLToChemicalReactions(
147
+ const std::string &block, bool sanitize=false, bool removeHs=false) {
148
+ auto reactions = RDKit::CDXMLToChemicalReactions(block, sanitize, removeHs);
149
+ std::vector<std::shared_ptr<RDKit::ChemicalReaction>> result;
150
+ for(auto &rxn : reactions) {
151
+ result.emplace_back(rxn.release());
152
+ }
153
+ return result;
154
+ }
155
+
156
+ static std::vector<std::shared_ptr<ChemicalReaction>> CDXMLFileToChemicalReactions(
157
+ const std::string &filename, bool sanitize=false, bool removeHs=false) {
158
+ auto reactions = RDKit::CDXMLFileToChemicalReactions(filename, sanitize, removeHs);
159
+ std::vector<std::shared_ptr<RDKit::ChemicalReaction>> result;
160
+ for(auto &rxn : reactions) {
161
+ result.emplace_back(rxn.release());
162
+ }
163
+ return result;
164
+ }
165
+
166
+ }
@@ -0,0 +1,126 @@
1
+ /*
2
+ * $Id$
3
+ *
4
+ * Copyright (c) 2011, Novartis Institutes for BioMedical Research Inc.
5
+ * All rights reserved.
6
+ *
7
+ * Redistribution and use in source and binary forms, with or without
8
+ * modification, are permitted provided that the following conditions are
9
+ * met:
10
+ *
11
+ * * Redistributions of source code must retain the above copyright
12
+ * notice, this list of conditions and the following disclaimer.
13
+ * * Redistributions in binary form must reproduce the above
14
+ * copyright notice, this list of conditions and the following
15
+ * disclaimer in the documentation and/or other materials provided
16
+ * with the distribution.
17
+ * * Neither the name of Novartis Institutes for BioMedical Research Inc.
18
+ * nor the names of its contributors may be used to endorse or promote
19
+ * products derived from this software without specific prior written 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
+
34
+ %{
35
+ #include <GraphMol/ChemTransforms/ChemTransforms.h>
36
+ #include <GraphMol/ChemTransforms/MolFragmenter.h>
37
+ #include <GraphMol/ChemTransforms/MolFragmenterJSONParser.h>
38
+ #include <GraphMol/Bond.h>
39
+ // Fixes annoying compilation namespace issue
40
+ typedef RDKit::MatchVectType MatchVectType;
41
+
42
+ // Partial binding to one overload of RDKit::fragmentOnBonds
43
+ RDKit::ROMol *fragmentMolOnBonds(
44
+ const RDKit::ROMol &mol, const std::vector<int> &bondIndices,
45
+ bool addDummies = true,
46
+ const std::vector<std::pair<unsigned int, unsigned int>> *dummyLabels = nullptr,
47
+ std::vector<int> *nCutsPerAtom = nullptr) {
48
+ // Convert vector<int> to vector<unsigned int>
49
+ std::vector<unsigned int> uBondIndices(bondIndices.begin(), bondIndices.end());
50
+ std::vector<unsigned int> uNCutsPerAtom;
51
+ if (nCutsPerAtom) {
52
+ uNCutsPerAtom.insert(uNCutsPerAtom.begin(), nCutsPerAtom->begin(), nCutsPerAtom->end());
53
+ }
54
+ auto cutsPerAtomPtr = nCutsPerAtom ? &uNCutsPerAtom : nullptr;
55
+ // Can't handle the 5th argument of vector<BondType> as swig will not wrap vector of enum
56
+ return RDKit::MolFragmenter::fragmentOnBonds(mol, uBondIndices, addDummies, dummyLabels, nullptr, cutsPerAtomPtr);
57
+ }
58
+
59
+ // Fix std::unique_ptr issue
60
+ RDKit::ROMol * new_molzip(
61
+ const RDKit::ROMol &a, const RDKit::ROMol &b,
62
+ const RDKit::MolzipParams &params=RDKit::MolzipParams()) {
63
+ return RDKit::molzip(a, b, params).release();;
64
+ }
65
+
66
+ RDKit::ROMol * new_molzip(
67
+ const RDKit::ROMol &a,
68
+ const RDKit::MolzipParams &params=RDKit::MolzipParams()) {
69
+ return RDKit::molzip(a, params).release();
70
+ }
71
+
72
+ RDKit::ROMol * new_molzip(
73
+ std::vector<RDKit::ROMOL_SPTR> &mols,
74
+ const RDKit::MolzipParams &params=RDKit::MolzipParams()) {
75
+ return RDKit::molzip(mols, params).release();
76
+ }
77
+ %}
78
+
79
+ %include "std_string.i"
80
+ %include "std_vector.i"
81
+
82
+ %newobject deleteSubstructs;
83
+ %newobject replaceSidechains;
84
+ %newobject replaceCores;
85
+ %newobject MurckoDecompose;
86
+ %template(StringMolMap) std::map<std::string,boost::shared_ptr<RDKit::ROMol> >;
87
+ %include <GraphMol/Bond.h>
88
+ %include <GraphMol/ChemTransforms/ChemTransforms.h>
89
+
90
+ %newobject fragmentMolOnBonds;
91
+ %newobject new_molzip;
92
+ %ignore fragmentOnBonds;
93
+ %ignore molzip;
94
+ %rename("fragmentOnBonds") fragmentMolOnBonds;
95
+ %rename("molzip") new_molzip;
96
+
97
+ RDKit::ROMol *fragmentMolOnBonds(
98
+ const RDKit::ROMol &mol, const std::vector<int> &bondIndices,
99
+ bool addDummies = true,
100
+ const std::vector<std::pair<unsigned int, unsigned int>> *dummyLabels = nullptr,
101
+ std::vector<int> *nCutsPerAtom = nullptr);
102
+
103
+ RDKit::ROMol * new_molzip(
104
+ const RDKit::ROMol &a, const RDKit::ROMol &b,
105
+ const RDKit::MolzipParams &params=RDKit::MolzipParams());
106
+
107
+ RDKit::ROMol * new_molzip(
108
+ const RDKit::ROMol &a,
109
+ const RDKit::MolzipParams &params=RDKit::MolzipParams());
110
+
111
+
112
+ RDKit::ROMol * new_molzip(
113
+ std::vector<RDKit::ROMOL_SPTR> &mols,
114
+ const RDKit::MolzipParams &params=RDKit::MolzipParams());
115
+
116
+ %ignore fragmentOnSomeBonds;
117
+ %ignore constructFragmenterAtomTypes;
118
+ %ignore constructBRICSAtomTypes;
119
+ %ignore constructFragmenterBondTypes;
120
+ %ignore constructBRICSBondTypes;
121
+
122
+ %newobject fragmentOnBRICSBonds;
123
+ %template(UIntMolMap) std::map<unsigned int,boost::shared_ptr<RDKit::ROMol> >;
124
+ %include <RDGeneral/BetterEnums.h>
125
+ %include <GraphMol/ChemTransforms/MolFragmenter.h>
126
+ %include <GraphMol/ChemTransforms/MolFragmenterJSONParser.h>
@@ -0,0 +1,69 @@
1
+ /*
2
+ * $Id$
3
+ *
4
+ * Copyright (c) 2010, Novartis Institutes for BioMedical Research Inc.
5
+ * All rights reserved.
6
+ *
7
+ * Redistribution and use in source and binary forms, with or without
8
+ * modification, are permitted provided that the following conditions are
9
+ * met:
10
+ *
11
+ * * Redistributions of source code must retain the above copyright
12
+ * notice, this list of conditions and the following disclaimer.
13
+ * * Redistributions in binary form must reproduce the above
14
+ * copyright notice, this list of conditions and the following
15
+ * disclaimer in the documentation and/or other materials provided
16
+ * with the distribution.
17
+ * * Neither the name of Novartis Institutes for BioMedical Research Inc.
18
+ * nor the names of its contributors may be used to endorse or promote
19
+ * products derived from this software without specific prior written 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
+
34
+ %{
35
+ #include <GraphMol/Conformer.h>
36
+ #include <GraphMol/MolTransforms/MolTransforms.h>
37
+ #include <Geometry/point.h>
38
+ %}
39
+
40
+ // no point in wrapping something that can't be accessed
41
+ // getAtomPos() and setAtomPos() are convenient accessors
42
+ %ignore RDKit::Conformer::getPositions();
43
+ %ignore RDKit::Conformer::getPositions() const;
44
+
45
+ %include <GraphMol/Conformer.h>
46
+
47
+ %extend RDKit::Conformer {
48
+ /* From MolTransforms.h */
49
+
50
+ RDGeom::Point3D computeCentroid(bool ignoreHs=true) {
51
+ return MolTransforms::computeCentroid(*($self), ignoreHs);
52
+ }
53
+
54
+ RDGeom::Transform3D *computeCanonicalTransform(const RDGeom::Point3D *center=0,
55
+ bool normalizeCovar=false,
56
+ bool ignoreHs=true) {
57
+ return MolTransforms::computeCanonicalTransform(*(self), center, normalizeCovar, ignoreHs);
58
+ }
59
+
60
+ void transformConformer(const RDGeom::Transform3D &trans) {
61
+ MolTransforms::transformConformer(*($self), trans);
62
+ }
63
+
64
+ void canonicalizeConformer(const RDGeom::Point3D *center=0,
65
+ bool normalizeCovar=false, bool ignoreHs=true) {
66
+ MolTransforms::canonicalizeConformer(*($self), center, normalizeCovar, ignoreHs);
67
+ }
68
+
69
+ }
@@ -0,0 +1,64 @@
1
+ /*
2
+ * $Id$
3
+ *
4
+ * Copyright (c) 2010, Novartis Institutes for BioMedical Research Inc.
5
+ * All rights reserved.
6
+ *
7
+ * Redistribution and use in source and binary forms, with or without
8
+ * modification, are permitted provided that the following conditions are
9
+ * met:
10
+ *
11
+ * * Redistributions of source code must retain the above copyright
12
+ * notice, this list of conditions and the following disclaimer.
13
+ * * Redistributions in binary form must reproduce the above
14
+ * copyright notice, this list of conditions and the following
15
+ * disclaimer in the documentation and/or other materials provided
16
+ * with the distribution.
17
+ * * Neither the name of Novartis Institutes for BioMedical Research Inc.
18
+ * nor the names of its contributors may be used to endorse or promote
19
+ * products derived from this software without specific prior written 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
+
34
+ %{
35
+ #include <GraphMol/Descriptors/MolDescriptors.h>
36
+ %}
37
+
38
+ %include <GraphMol/Descriptors/MolDescriptors.h>
39
+ %include <GraphMol/Descriptors/Lipinski.h>
40
+ %include <GraphMol/Descriptors/MolSurf.h>
41
+ %include <GraphMol/Descriptors/ConnectivityDescriptors.h>
42
+ %include <GraphMol/Descriptors/MQN.h>
43
+
44
+ %inline %{
45
+ std::pair<double,double> calcCrippenDescriptors(const RDKit::ROMol &mol,
46
+ bool includeHs=true,bool force=false) {
47
+ std::pair<double,double> res;
48
+ RDKit::Descriptors::calcCrippenDescriptors(mol, res.first, res.second, includeHs, force);
49
+ return res;
50
+ }
51
+ double calcMolLogP(const RDKit::ROMol &mol){
52
+ double logp,mr;
53
+ RDKit::Descriptors::calcCrippenDescriptors(mol,logp,mr);
54
+ return logp;
55
+ }
56
+ double calcMolMR(const RDKit::ROMol &mol){
57
+ double logp,mr;
58
+ RDKit::Descriptors::calcCrippenDescriptors(mol,logp,mr);
59
+ return mr;
60
+ }
61
+
62
+ %}
63
+
64
+