Expose RGroupDecomposition to SWIG (#2345)

* change to make the SWig builds work on windows

* add the wrapper. Still needs tests

* first rgd java wrapper test, does not pass

* get static builds working on windows
This commit is contained in:
Greg Landrum
2019-03-13 13:23:23 +01:00
committed by Brian Kelley
parent a1e4165292
commit 89439f5520
6 changed files with 75 additions and 3 deletions

View File

@@ -20,7 +20,7 @@ if(RDK_BUILD_INCHI_SUPPORT)
set(swigRDKitLibList "${swigRDKitLibList}RDInchiLib;${INCHI_LIBRARIES};")
endif(RDK_BUILD_INCHI_SUPPORT)
set(swigRDKitLibList "${swigRDKitLibList}"
"SubstructLibrary;"
"RGroupDecomposition;SubstructLibrary;"
"MolStandardize;FilterCatalog;Catalogs;FMCS;MolDraw2D;FileParsers;SmilesParse;"
"Depictor;SubstructMatch;ChemReactions;Fingerprints;ChemTransforms;"
"Subgraphs;GraphMol;DataStructs;Trajectory;Descriptors;"

View File

@@ -0,0 +1,23 @@
/*
*
* Copyright (c) 2019, Greg Landrum
* All rights reserved.
*
* This file is part of the RDKit.
* The contents are covered by the terms of the BSD license
* which is included in the file license.txt, found at the root
* of the RDKit source tree.
*
*/
%{
#include <GraphMol/RGroupDecomposition/RGroupDecomp.h>
%}
%template(SparseIntVect64) RDKit::SparseIntVect<boost::int64_t>;
%template(StringMolMap) std::map<std::string, boost::shared_ptr<RDKit::ROMol>>;
%template(ROMol_Vect) std::vector<boost::shared_ptr<RDKit::ROMol>>;
%template(StringMolMap_Vect) std::vector<std::map<std::string, boost::shared_ptr<RDKit::ROMol>>>;
%template(StringROMol_VectMap) std::map<std::string,std::vector<boost::shared_ptr<RDKit::ROMol>>>;
%include <GraphMol/RGroupDecomposition/RGroupDecomp.h>

View File

@@ -345,6 +345,11 @@ ADD_TEST(JavaSubstructLibraryTests
-cp "${JUNIT_JAR}${PATH_SEP}${CMAKE_JAVA_TEST_OUTDIR}${PATH_SEP}${CMAKE_CURRENT_SOURCE_DIR}/org.RDKit.jar"
org.RDKit.SubstructLibraryTests)
ADD_TEST(JavaRGroupDecompositionTests
java -Djava.library.path=${CMAKE_CURRENT_SOURCE_DIR}
-cp "${JUNIT_JAR}${PATH_SEP}${CMAKE_JAVA_TEST_OUTDIR}${PATH_SEP}${CMAKE_CURRENT_SOURCE_DIR}/org.RDKit.jar"
org.RDKit.RGroupDecompositionTests)
ADD_TEST(JavaDiversityPickerTests
java -Djava.library.path=${CMAKE_CURRENT_SOURCE_DIR}
-cp "${JUNIT_JAR}${PATH_SEP}${CMAKE_JAVA_TEST_OUTDIR}${PATH_SEP}${CMAKE_CURRENT_SOURCE_DIR}/org.RDKit.jar"

View File

@@ -225,6 +225,7 @@ typedef unsigned long long int uintmax_t;
%include "../Trajectory.i"
%include "../MolStandardize.i"
%include "../SubstructLibrary.i"
%include "../RGroupDecomposition.i"
// Create a class to throw various sorts of errors for testing. Required for unit tests in ErrorHandlingTests.java
#ifdef INCLUDE_ERROR_GENERATOR

View File

@@ -0,0 +1,40 @@
/*
*
* Copyright (c) 2019 Greg Landrum
* All rights reserved.
*
* This file is part of the RDKit.
* The contents are covered by the terms of the BSD license
* which is included in the file license.txt, found at the root
* of the RDKit source tree.
*/
package org.RDKit;
import static org.junit.Assert.*;
import org.junit.*;
public class RGroupDecompositionTests extends GraphMolTest {
private ROMol mol;
private ROMol m;
@Before public void setUp() {
}
@Test
public void test1Basics() {
ROMol core = RWMol.MolFromSmiles("c1ccccc1");
RGroupDecomposition decomp = new RGroupDecomposition(core);
m = RWMol.MolFromSmiles("c1(Cl)ccccc1");
assertEquals(0,decomp.add(m));
m = RWMol.MolFromSmiles("c1c(Cl)cccc1");
assertEquals(1,decomp.add(m));
assertTrue(decomp.process());
}
public static void main(String args[]) {
org.junit.runner.JUnitCore.main("org.RDKit.RGroupDecompositionTests");
}
}

View File

@@ -72,9 +72,12 @@ if(RDK_BUILD_COORDGEN_SUPPORT)
set(coordgen_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}
CACHE STRING "CoordGen Include File" FORCE)
file(GLOB CGSOURCES "${COORDGEN_DIR}/*.cpp")
rdkit_library(coordgen ${CGSOURCES} SHARED LINK_LIBRARIES maeparser)
# when we're doing static linkage of boost, at least on windows, we need
# to also link against zlib (due to iostreams)
find_package(zlib)
rdkit_library(coordgen ${CGSOURCES} SHARED LINK_LIBRARIES maeparser ${ZLIB_LIBRARIES})
install(TARGETS coordgen DESTINATION ${RDKit_LibDir})
set(coordgen_LIBRARIES coordgen)
set(coordgen_LIBRARIES coordgen )
set(coordgen_TEMPLATE_FILE ${COORDGEN_DIR}/templates.mae )
endif(COORDGEN_FORCE_BUILD OR (NOT coordgen_FOUND))