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,16 @@
1
+ /*
2
+ *
3
+ * Copyright (c) 2018, Greg Landrum
4
+ * All rights reserved.
5
+ *
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
+ */
12
+ %{
13
+ #include <GraphMol/StereoGroup.h>
14
+ %}
15
+
16
+ %include <GraphMol/StereoGroup.h>
@@ -0,0 +1,67 @@
1
+
2
+ /*
3
+ * Copyright (c) 2019, Novartis Institutes for BioMedical Research Inc.
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 permission.
19
+ *
20
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+
33
+
34
+ %include "std_string.i"
35
+
36
+
37
+ %{
38
+ #include <../RDStreams/streams.h>
39
+ #include <sstream>
40
+ %}
41
+
42
+ // We just need to pass the pointers around here
43
+ %nodefaultctor istream;
44
+ %nodefaultdtor istream;
45
+ %nodefaultctor filtering_istream;
46
+ %nodefaultdtor filtering_istream;
47
+
48
+ namespace std {
49
+ class istream;
50
+ }
51
+
52
+ #ifdef RDK_USE_BOOST_IOSTREAMS
53
+ %extend RDKit::gzstream {
54
+ std::istream* _GetStream() { return (std::istream*)$self; }
55
+ std::string Dump() {
56
+ std::ostringstream stream;
57
+ std::copy(std::istreambuf_iterator<char>(*$self),
58
+ std::istreambuf_iterator<char>(),
59
+ std::ostreambuf_iterator<char>(stream));
60
+
61
+ return stream.str();
62
+ }
63
+ }
64
+ #endif
65
+
66
+ %include <../RDStreams/streams.h>
67
+
@@ -0,0 +1,53 @@
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/Subgraphs/Subgraphs.h>
36
+ #include <GraphMol/Subgraphs/SubgraphUtils.h>
37
+ %}
38
+
39
+ %include <GraphMol/Subgraphs/Subgraphs.h>
40
+ %inline %{
41
+ std::vector<int> calcPathDiscriminators(RDKit::ROMol &mol,RDKit::PATH_TYPE &path){
42
+ std::vector<int> res(3);
43
+ RDKit::Subgraphs::DiscrimTuple tpl=RDKit::Subgraphs::calcPathDiscriminators(mol,path);
44
+ res[0]=std::get<0>(tpl);
45
+ res[1]=std::get<1>(tpl);
46
+ res[2]=std::get<2>(tpl);
47
+ return res;
48
+ }
49
+ %}
50
+
51
+ %ignore calcPathDiscriminators;
52
+ %newobject pathToSubmol;
53
+ %include <GraphMol/Subgraphs/SubgraphUtils.h>
@@ -0,0 +1,75 @@
1
+ /*
2
+ *
3
+ * Copyright (C) 2025 and other RDKit contributors
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
+ */
12
+ %{
13
+ #include <GraphMol/Subset.h>
14
+ %}
15
+
16
+ %ignore RDKit::copyMolSubset;
17
+ %include <GraphMol/Subset.h>
18
+
19
+ %{
20
+ RDKit::ROMol *copyMolSubsetHelper(const RDKit::ROMol& mol,
21
+ const std::vector<unsigned int> &atoms,
22
+ const std::vector<unsigned int> &bonds,
23
+ const RDKit::SubsetOptions &options=RDKit::SubsetOptions()
24
+ )
25
+ {
26
+ return copyMolSubset(mol, atoms, bonds, options).release();
27
+ }
28
+
29
+
30
+ RDKit::ROMol *copyMolSubsetHelper(const RDKit::ROMol& mol,
31
+ const std::vector<unsigned int> &atoms,
32
+ const std::vector<unsigned int> &bonds,
33
+ RDKit::SubsetInfo &subsetInfo,
34
+ const RDKit::SubsetOptions &options=RDKit::SubsetOptions()
35
+ ) {
36
+ return copyMolSubset(mol, atoms, bonds, subsetInfo, options).release();
37
+ }
38
+
39
+ RDKit::ROMol *copyMolSubsetHelper(const RDKit::ROMol& mol,
40
+ const std::vector<unsigned int>& path,
41
+ const RDKit::SubsetOptions &options = RDKit::SubsetOptions()) {
42
+ return copyMolSubset(mol, path, options).release();
43
+ }
44
+
45
+
46
+ RDKit::ROMol *copyMolSubsetHelper(const RDKit::ROMol& mol,
47
+ const std::vector<unsigned int>& path,
48
+ RDKit::SubsetInfo &subsetInfo,
49
+ const RDKit::SubsetOptions &options = RDKit::SubsetOptions()) {
50
+ return copyMolSubset(mol, path, subsetInfo, options).release();
51
+ }
52
+
53
+ %}
54
+
55
+ %rename("copyMolSubset") copyMolSubsetHelper;
56
+
57
+ RDKit::ROMol *copyMolSubsetHelper(const RDKit::ROMol& mol,
58
+ const std::vector<unsigned int> &atoms,
59
+ const std::vector<unsigned int> &bonds,
60
+ const RDKit::SubsetOptions &options=RDKit::SubsetOptions()
61
+ );
62
+ RDKit::ROMol *copyMolSubsetHelper(const RDKit::ROMol& mol,
63
+ const std::vector<unsigned int> &atoms,
64
+ const std::vector<unsigned int> &bonds,
65
+ RDKit::SubsetInfo &subsetInfo,
66
+ const RDKit::SubsetOptions &options=RDKit::SubsetOptions()
67
+ );
68
+ RDKit::ROMol *copyMolSubsetHelper(const RDKit::ROMol& mol,
69
+ const std::vector<unsigned int>& path,
70
+ const RDKit::SubsetOptions &options = RDKit::SubsetOptions());
71
+
72
+ RDKit::ROMol *copyMolSubsetHelper(const RDKit::ROMol& mol,
73
+ const std::vector<unsigned int>& path,
74
+ RDKit::SubsetInfo &subsetInfo,
75
+ const RDKit::SubsetOptions &options = RDKit::SubsetOptions());
@@ -0,0 +1,91 @@
1
+ /*
2
+ *
3
+ * Created by Gareth Jones on 9/2/2020.
4
+ *
5
+ * Copyright 2020 Schrodinger, Inc
6
+ * @@ All Rights Reserved @@
7
+ * This file is part of the RDKit.
8
+ * The contents are covered by the terms of the BSD license
9
+ * which is included in the file license.txt, found at the root
10
+ * of the RDKit source tree.
11
+ *
12
+ */
13
+
14
+
15
+ %{
16
+ #include <GraphMol/SubstanceGroup.h>
17
+
18
+ const RDKit::SubstanceGroup *getSubstanceGroupWithIdx(RDKit::ROMol &mol, unsigned int idx) {
19
+ auto &groups = RDKit::getSubstanceGroups(mol);
20
+ return &(groups[idx]);
21
+ }
22
+
23
+ unsigned int getSubstanceGroupCount(RDKit::ROMol &mol) {
24
+ return RDKit::getSubstanceGroups(mol).size();
25
+ }
26
+ %}
27
+
28
+
29
+ // Base class RDProps is wrapped with shared_ptr, so SubstanceGroup must be too.
30
+ %shared_ptr(RDKit::SubstanceGroup)
31
+ %ignore getSubstanceGroups;
32
+
33
+ RDKit::SubstanceGroup *getSubstanceGroupWithIdx(RDKit::ROMol &mol, unsigned int idx);
34
+ unsigned int getSubstanceGroupCount(RDKit::ROMol &mol);
35
+
36
+ %ignore RDKit::SubstanceGroup::getAtoms;
37
+ %rename(getAtoms) RDKit::SubstanceGroup::getSgAtoms;
38
+ %ignore RDKit::SubstanceGroup::getBonds;
39
+ %rename(getBonds) RDKit::SubstanceGroup::getSgBonds;
40
+ %ignore RDKit::SubstanceGroup::getBrackets;
41
+ %ignore RDKit::SubstanceGroup::getCStates;
42
+ %ignore RDKit::SubstanceGroup::getAttachPoints;
43
+
44
+ %include <GraphMol/SubstanceGroup.h>
45
+
46
+ %extend RDKit::SubstanceGroup {
47
+ // Wrap getAtoms, getParentAtoms and getBonds to return vector<int> by value (not reference).
48
+ const std::vector<int> getSgAtoms() {
49
+ auto atoms = $self->getAtoms();
50
+ std::vector<int> atomIdxs(atoms.begin(), atoms.end());
51
+ return atomIdxs;
52
+ }
53
+ const std::vector<int> getSgBonds() {
54
+ auto bonds = $self->getBonds();
55
+ std::vector<int> bondIdxs(bonds.begin(), bonds.end());
56
+ return bondIdxs;
57
+ }
58
+ const std::vector<int> getSgParentAtoms() {
59
+ auto atoms = $self->getParentAtoms();
60
+ std::vector<int> atomIdxs(atoms.begin(), atoms.end());
61
+ return atomIdxs;
62
+ }
63
+
64
+ // SWIG does not do well wrapping vectors of objects, so provide accessors
65
+ const RDKit::SubstanceGroup::Bracket *getBracket(unsigned int idx) {
66
+ auto &brackets = $self->getBrackets();
67
+ return &(brackets[idx]);
68
+ }
69
+ const RDKit::SubstanceGroup::CState *getCState(unsigned int idx) {
70
+ auto &cstates = $self->getCStates();
71
+ return &(cstates[idx]);
72
+ }
73
+ const RDKit::SubstanceGroup::AttachPoint *getAttachPoint(unsigned int idx) {
74
+ auto &attachPoints = $self->getAttachPoints();
75
+ return &(attachPoints[idx]);
76
+ }
77
+ size_t getBracketCount() {
78
+ return $self->getBrackets().size();
79
+ }
80
+ size_t getCStateCount() {
81
+ return $self->getCStates().size();
82
+ }
83
+ size_t getAttachPointCount() {
84
+ return $self->getAttachPoints().size();
85
+ }
86
+ }
87
+
88
+ %template(getStringProp) RDKit::SubstanceGroup::getProp<std::string>;
89
+ %template(getUIntProp) RDKit::SubstanceGroup::getProp<unsigned int>;
90
+ %template(getStringVectProp) RDKit::SubstanceGroup::getProp<RDKit::STR_VECT>;
91
+ %template(getUIntVectProp) RDKit::SubstanceGroup::getProp<RDKit::UINT_VECT>;
@@ -0,0 +1,80 @@
1
+ /*
2
+ * Copyright (c) 2015, Novartis Institutes for BioMedical Research Inc.
3
+ * All rights reserved.
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are
7
+ * met:
8
+ *
9
+ * * Redistributions of source code must retain the above copyright
10
+ * notice, this list of conditions and the following disclaimer.
11
+ * * Redistributions in binary form must reproduce the above
12
+ * copyright notice, this list of conditions and the following
13
+ * disclaimer in the documentation and/or other materials provided
14
+ * with the distribution.
15
+ * * Neither the name of Novartis Institutes for BioMedical Research Inc.
16
+ * nor the names of its contributors may be used to endorse or promote
17
+ * products derived from this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+ */
31
+
32
+ //%import "ROMol.i"
33
+ %include "std_vector.i"
34
+
35
+
36
+ %{
37
+ #include <GraphMol/SubstructLibrary/SubstructLibrary.h>
38
+ #include <GraphMol/TautomerQuery/TautomerQuery.h>
39
+ #include <GraphMol/GeneralizedSubstruct/XQMol.h>
40
+ using RDKit::GeneralizedSubstruct::ExtendedQueryMol;
41
+ %}
42
+ %shared_ptr(RDKit::TautomerQuery)
43
+ %shared_ptr(RDKit::MolHolderBase)
44
+ %shared_ptr(RDKit::MolHolder)
45
+ %shared_ptr(RDKit::CachedMolHolder)
46
+ %shared_ptr(RDKit::CachedSmilesMolHolder)
47
+ %shared_ptr(RDKit::CachedTrustedSmilesMolHolder)
48
+ %shared_ptr(RDKit::FPHolderBase)
49
+ %shared_ptr(RDKit::PatternHolder)
50
+ %shared_ptr(RDKit::TautomerPatternHolder)
51
+ %shared_ptr(RDKit::KeyHolderBase)
52
+ %shared_ptr(RDKit::KeyFromPropHolder)
53
+
54
+ %template(UChar_Vect) std::vector<unsigned char>;
55
+
56
+ %extend RDKit::SubstructLibrary {
57
+ SubstructLibrary(const std::vector<unsigned char> & data ) {
58
+ std::string str(data.begin(), data.end());
59
+ return new RDKit::SubstructLibrary(str);
60
+ }
61
+
62
+ static bool canSerialize() {
63
+ return RDKit::SubstructLibraryCanSerialize();
64
+ }
65
+ }
66
+
67
+ %include <GraphMol/TautomerQuery/TautomerQuery.h>
68
+ %include <GraphMol/SubstructLibrary/SubstructLibrary.h>
69
+
70
+ %extend RDKit::SubstructLibrary {
71
+ %template(getMatches) getMatches<ROMol>;
72
+ %template(getMatches) getMatches<TautomerQuery>;
73
+ %template(getMatches) getMatches<RDKit::GeneralizedSubstruct::ExtendedQueryMol>;
74
+ %template(countMatches) countMatches<ROMol>;
75
+ %template(countMatches) countMatches<TautomerQuery>;
76
+ %template(countMatches) countMatches<ExtendedQueryMol>;
77
+ %template(hasMatch) hasMatch<ROMol>;
78
+ %template(hasMatch) hasMatch<TautomerQuery>;
79
+ %template(hasMatch) hasMatch<ExtendedQueryMol>;
80
+ }
@@ -0,0 +1,19 @@
1
+ /*
2
+ *
3
+ * This file is part of the RDKit.
4
+ * The contents are covered by the terms of the BSD license
5
+ * which is included in the file license.txt, found at the root
6
+ * of the RDKit source tree.
7
+ *
8
+ */
9
+ %include "std_vector.i"
10
+
11
+
12
+ %{
13
+ #include <vector>
14
+ #include <GraphMol/TautomerQuery/TautomerQuery.h>
15
+ %}
16
+ %shared_ptr(RDKit::ROMol)
17
+ %template(Sizet_Vect) std::vector<size_t>;
18
+
19
+ %include <GraphMol/TautomerQuery/TautomerQuery.h>
@@ -0,0 +1,34 @@
1
+ /*
2
+ * Copyright (C) 2016 Sereina Riniker, Paolo Tosco
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
+
11
+ %{
12
+ #include <GraphMol/Trajectory/Snapshot.h>
13
+ #include <GraphMol/Trajectory/Trajectory.h>
14
+ %}
15
+ %include <GraphMol/Trajectory/Snapshot.h>
16
+ %include <GraphMol/Trajectory/Trajectory.h>
17
+
18
+ %extend RDKit::Snapshot {
19
+ Snapshot(std::vector<double> &posVect, double energy = 0.0) {
20
+ double *posArray = new double[posVect.size()];
21
+ for (unsigned int i = 0; i < posVect.size(); ++i)
22
+ posArray[i] = posVect[i];
23
+ boost::shared_array<double> pos(posArray);
24
+ RDKit::Snapshot *s = new RDKit::Snapshot(pos, energy);
25
+ return s;
26
+ }
27
+ Snapshot(const RDKit::Snapshot &other) {
28
+ return new RDKit::Snapshot(other);
29
+ }
30
+ %newobject SnapshotVect;
31
+ static std::vector<RDKit::Snapshot> *SnapshotVect() {
32
+ return new std::vector<RDKit::Snapshot>();
33
+ }
34
+ }
@@ -0,0 +1,64 @@
1
+ /*
2
+ *
3
+ *
4
+ * Copyright (c) 2015, Greg Landrum
5
+ * All rights reserved.
6
+ *
7
+ * This file is part of the RDKit.
8
+ * The contents are covered by the terms of the BSD license
9
+ * which is included in the file license.txt, found at the root
10
+ * of the RDKit source tree.
11
+ *
12
+ * taken from this stackexchange answer: http://stackoverflow.com/a/12768318
13
+ */
14
+ %{
15
+ #include <boost/tuple/tuple.hpp>
16
+ %}
17
+
18
+ namespace boost {
19
+ template <typename T1=void, typename T2=void, typename T3=void>
20
+ struct tuple;
21
+
22
+ template <>
23
+ struct tuple<void,void,void> {
24
+ };
25
+
26
+ template <typename T1>
27
+ struct tuple<T1, void, void> {
28
+ tuple(T1);
29
+ %extend {
30
+ T1 first() const {
31
+ return boost::get<0>(*$self);
32
+ }
33
+ }
34
+ };
35
+
36
+ template <typename T1, typename T2>
37
+ struct tuple <T1, T2, void> {
38
+ tuple(T1,T2);
39
+ %extend {
40
+ T1 first() const {
41
+ return boost::get<0>(*$self);
42
+ }
43
+ T2 second() const {
44
+ return boost::get<1>(*$self);
45
+ }
46
+ }
47
+ };
48
+
49
+ template <typename T1, typename T2, typename T3>
50
+ struct tuple <T1,T2,T3> {
51
+ tuple(T1,T2,T3);
52
+ %extend {
53
+ T1 first() const {
54
+ return boost::get<0>(*$self);
55
+ }
56
+ T2 second() const {
57
+ return boost::get<1>(*$self);
58
+ }
59
+ T3 third() const {
60
+ return boost::get<2>(*$self);
61
+ }
62
+ }
63
+ };
64
+ }
@@ -0,0 +1,10 @@
1
+ /* -----------------------------------------------------------------------------
2
+ * extend_std_vector.i
3
+ * ----------------------------------------------------------------------------- */
4
+
5
+ // Note: The generic %extend std::vector with template parameter T doesn't work
6
+ // properly with SWIG Ruby backend. The equals() and vector(size_type) methods
7
+ // that use T directly cause compilation errors in the generated wrapper code.
8
+ // These extensions are removed for Ruby compatibility.
9
+
10
+ %include <std_vector.i>
@@ -0,0 +1,69 @@
1
+ cmake_minimum_required(VERSION 3.8)
2
+
3
+ # Apple: Don't modify install_name when touching RPATH.
4
+ if(POLICY CMP0068)
5
+ cmake_policy(SET CMP0068 NEW)
6
+ endif()
7
+ # target_sources: use absolute path for INTERFACE_SOURCES.
8
+ if(POLICY CMP0076)
9
+ cmake_policy(SET CMP0076 NEW)
10
+ endif()
11
+ # SWIG: use standard target name.
12
+ if(POLICY CMP0078)
13
+ cmake_policy(SET CMP0078 NEW)
14
+ endif()
15
+ # SWIG: use SWIG_MODULE_NAME property.
16
+ if(POLICY CMP0086)
17
+ cmake_policy(SET CMP0086 NEW)
18
+ endif()
19
+
20
+ project (GraphMolRuby)
21
+
22
+ include_directories( ${RDKit_ExternalDir} )
23
+
24
+ find_package(Ruby REQUIRED)
25
+
26
+ INCLUDE_DIRECTORIES(${RDKit_INCLUDE_DIR} ${RUBY_INCLUDE_PATH})
27
+
28
+ SET_SOURCE_FILES_PROPERTIES(GraphMolRuby.i PROPERTIES CPLUSPLUS ON )
29
+
30
+ SET(CMAKE_SWIG_OUTDIR ${CMAKE_CURRENT_SOURCE_DIR}/swig_ruby )
31
+
32
+ if(RDK_BUILD_INCHI_SUPPORT)
33
+ SET(CMAKE_SWIG_FLAGS "-DRDK_BUILD_INCHI_SUPPORT" ${CMAKE_SWIG_FLAGS} )
34
+ endif()
35
+ if(RDK_BUILD_AVALON_SUPPORT)
36
+ SET(CMAKE_SWIG_FLAGS "-DRDK_BUILD_AVALON_SUPPORT" ${CMAKE_SWIG_FLAGS} )
37
+ endif()
38
+ if(RDK_USE_BOOST_IOSTREAMS)
39
+ SET(CMAKE_SWIG_FLAGS "-DRDK_USE_BOOST_IOSTREAMS" ${CMAKE_SWIG_FLAGS} )
40
+ endif()
41
+
42
+ FILE(GLOB SWIG_SRC_FILES "${CMAKE_CURRENT_SOURCE_DIR}/../*.i")
43
+
44
+ # we added all source files, now remove the ones that we're not supporting in this build:
45
+ if(NOT RDK_BUILD_AVALON_SUPPORT)
46
+ LIST(REMOVE_ITEM SWIG_SRC_FILES "${CMAKE_CURRENT_SOURCE_DIR}/../AvalonLib.i")
47
+ endif()
48
+
49
+ if(NOT RDK_BUILD_INCHI_SUPPORT)
50
+ LIST(REMOVE_ITEM SWIG_SRC_FILES "${CMAKE_CURRENT_SOURCE_DIR}/../Inchi.i")
51
+ endif()
52
+
53
+ SET(SWIG_MODULE_RDKitChem_EXTRA_DEPS ${SWIG_SRC_FILES} )
54
+ SET(CMAKE_SWIG_FLAGS -small -naturalvar -autorename)
55
+
56
+ SWIG_ADD_LIBRARY(RDKitChem TYPE MODULE LANGUAGE ruby SOURCES GraphMolRuby.i)
57
+
58
+ # it doesnt seem like the threading libs should need to be here, but
59
+ # as of Oct 2012 using boost 1.51 under at least ubuntu 12.04 we get a
60
+ # link error if they aren't there.
61
+ SWIG_LINK_LIBRARIES(RDKitChem
62
+ ${RDKit_Wrapper_Libs}
63
+ ${Boost_SERIALIZATION_LIBRARY}
64
+ ${RDKit_THREAD_LIBS})
65
+
66
+ MESSAGE("serial: ${Boost_SERIALIZATION_LIBRARY}")
67
+ MESSAGE("THREAD: ${RDKit_THREAD_LIBS}")
68
+
69
+ INSTALL(TARGETS RDKitChem LIBRARY DESTINATION lib)