diff --git a/.azure-pipelines/linux_build.yml b/.azure-pipelines/linux_build.yml index 2dc092e71..1e5058637 100644 --- a/.azure-pipelines/linux_build.yml +++ b/.azure-pipelines/linux_build.yml @@ -25,6 +25,7 @@ steps: -DRDK_BUILD_PYTHON_WRAPPERS=ON \ -DRDK_USE_BOOST_REGEX=ON \ -DRDK_BUILD_COORDGEN_SUPPORT=ON \ + -DRDK_BUILD_MAEPARSER_SUPPORT=ON \ -DRDK_OPTIMIZE_POPCNT=ON \ -DRDK_BUILD_TEST_GZIP=ON \ -DRDK_BUILD_FREESASA_SUPPORT=ON \ diff --git a/.azure-pipelines/linux_build_cartridge.yml b/.azure-pipelines/linux_build_cartridge.yml index e6a2271df..4921b79c1 100644 --- a/.azure-pipelines/linux_build_cartridge.yml +++ b/.azure-pipelines/linux_build_cartridge.yml @@ -15,6 +15,7 @@ steps: -DRDK_BUILD_PYTHON_WRAPPERS=OFF \ -DRDK_USE_BOOST_REGEX=OFF \ -DRDK_BUILD_COORDGEN_SUPPORT=ON \ + -DRDK_BUILD_MAEPARSER_SUPPORT=ON \ -DRDK_OPTIMIZE_POPCNT=ON \ -DRDK_BUILD_TEST_GZIP=ON \ -DRDK_BUILD_AVALON_SUPPORT=ON \ diff --git a/.azure-pipelines/linux_build_java.yml b/.azure-pipelines/linux_build_java.yml index 64064f936..e121756eb 100644 --- a/.azure-pipelines/linux_build_java.yml +++ b/.azure-pipelines/linux_build_java.yml @@ -23,6 +23,7 @@ steps: -DRDK_BUILD_PYTHON_WRAPPERS=OFF \ -DRDK_USE_BOOST_REGEX=OFF \ -DRDK_BUILD_COORDGEN_SUPPORT=ON \ + -DRDK_BUILD_MAEPARSER_SUPPORT=ON \ -DRDK_OPTIMIZE_POPCNT=ON \ -DRDK_BUILD_TEST_GZIP=OFF \ -DRDK_BUILD_FREESASA_SUPPORT=ON \ diff --git a/.azure-pipelines/linux_build_py37.yml b/.azure-pipelines/linux_build_py37.yml index 8777b51d4..4a27960a5 100644 --- a/.azure-pipelines/linux_build_py37.yml +++ b/.azure-pipelines/linux_build_py37.yml @@ -25,6 +25,7 @@ steps: -DRDK_BUILD_PYTHON_WRAPPERS=ON \ -DRDK_USE_BOOST_REGEX=ON \ -DRDK_BUILD_COORDGEN_SUPPORT=ON \ + -DRDK_BUILD_MAEPARSER_SUPPORT=ON \ -DRDK_OPTIMIZE_POPCNT=ON \ -DRDK_BUILD_TEST_GZIP=ON \ -DRDK_BUILD_FREESASA_SUPPORT=ON \ diff --git a/.azure-pipelines/mac_build.yml b/.azure-pipelines/mac_build.yml index afcd996e6..e25fb1800 100644 --- a/.azure-pipelines/mac_build.yml +++ b/.azure-pipelines/mac_build.yml @@ -37,6 +37,7 @@ steps: -DRDK_BUILD_PYTHON_WRAPPERS=ON \ -DRDK_USE_BOOST_REGEX=ON \ -DRDK_BUILD_COORDGEN_SUPPORT=ON \ + -DRDK_BUILD_MAEPARSER_SUPPORT=ON \ -DRDK_OPTIMIZE_POPCNT=ON \ -DRDK_BUILD_TEST_GZIP=ON \ -DRDK_BUILD_FREESASA_SUPPORT=ON \ diff --git a/.azure-pipelines/mac_build_java.yml b/.azure-pipelines/mac_build_java.yml index 47f360902..374c3189f 100644 --- a/.azure-pipelines/mac_build_java.yml +++ b/.azure-pipelines/mac_build_java.yml @@ -36,6 +36,7 @@ steps: -DRDK_BUILD_PYTHON_WRAPPERS=OFF \ -DRDK_USE_BOOST_REGEX=OFF \ -DRDK_BUILD_COORDGEN_SUPPORT=ON \ + -DRDK_BUILD_MAEPARSER_SUPPORT=ON \ -DRDK_OPTIMIZE_POPCNT=ON \ -DRDK_BUILD_TEST_GZIP=OFF \ -DRDK_BUILD_FREESASA_SUPPORT=ON \ diff --git a/.azure-pipelines/vs_build.yml b/.azure-pipelines/vs_build.yml index 6c5639d10..6e078ca01 100644 --- a/.azure-pipelines/vs_build.yml +++ b/.azure-pipelines/vs_build.yml @@ -23,6 +23,7 @@ steps: -DRDK_BUILD_PYTHON_WRAPPERS=ON ^ -DRDK_USE_BOOST_REGEX=ON ^ -DRDK_BUILD_COORDGEN_SUPPORT=ON ^ + -DRDK_BUILD_MAEPARSER_SUPPORT=ON ^ -DRDK_OPTIMIZE_POPCNT=ON ^ -DRDK_BUILD_TEST_GZIP=ON ^ -DRDK_BUILD_FREESASA_SUPPORT=OFF ^ diff --git a/.azure-pipelines/vs_build_dll.yml b/.azure-pipelines/vs_build_dll.yml index 4d493d508..34b52a2fc 100644 --- a/.azure-pipelines/vs_build_dll.yml +++ b/.azure-pipelines/vs_build_dll.yml @@ -22,6 +22,7 @@ steps: -DRDK_BUILD_CPP_TESTS=ON ^ -DRDK_USE_BOOST_REGEX=ON ^ -DRDK_BUILD_COORDGEN_SUPPORT=ON ^ + -DRDK_BUILD_MAEPARSER_SUPPORT=ON ^ -DRDK_OPTIMIZE_POPCNT=ON ^ -DRDK_BUILD_TEST_GZIP=ON ^ -DRDK_BUILD_FREESASA_SUPPORT=OFF ^ diff --git a/CMakeLists.txt b/CMakeLists.txt index 8c0a69970..369d64b51 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,6 +51,7 @@ option(RDK_USE_STRICT_ROTOR_DEFINITION "Use the most strict rotatable bond defin option(RDK_BUILD_DESCRIPTORS3D "Build the 3D descriptors calculators, requires Eigen3 to be installed" ON) option(RDK_BUILD_FREESASA_SUPPORT "build the rdkit freesasa wrapper" OFF ) option(RDK_BUILD_COORDGEN_SUPPORT "build the rdkit coordgen wrapper" ON ) +option(RDK_BUILD_MAEPARSER_SUPPORT "build the rdkit MAE parser wrapper" ON ) option(RDK_BUILD_MOLINTERCHANGE_SUPPORT "build in support for CommonChem molecule interchange" ON ) option(RDK_BUILD_YAEHMOP_SUPPORT "build support for the YAeHMOP wrapper" OFF) option(RDK_BUILD_STRUCTCHECKER_SUPPORT "build in support for the StructChecker alpha (not recommended, use the MolVS integration instead)" OFF ) @@ -178,6 +179,11 @@ if(RDK_BUILD_COORDGEN_SUPPORT) include_directories(${RDKit_ExternalDir}) endif() +if(RDK_BUILD_MAEPARSER_SUPPORT) + add_definitions(-DRDK_BUILD_MAEPARSER_SUPPORT) + include_directories(${RDKit_ExternalDir}) +endif() + if(RDK_USE_URF) ADD_DEFINITIONS("-DRDK_USE_URF") include_directories(${RDKit_ExternalDir}/RingFamilies/RingDecomposerLib/src/RingDecomposerLib) diff --git a/Code/GraphMol/FileParsers/CMakeLists.txt b/Code/GraphMol/FileParsers/CMakeLists.txt index 26ab68df5..0df963965 100644 --- a/Code/GraphMol/FileParsers/CMakeLists.txt +++ b/Code/GraphMol/FileParsers/CMakeLists.txt @@ -20,7 +20,7 @@ endif() ADD_DEFINITIONS("-DRDK_USE_BOOST_IOSTREAMS") endif(RDK_USE_BOOST_IOSTREAMS) -if(RDK_BUILD_COORDGEN_SUPPORT) +if(RDK_BUILD_MAEPARSER_SUPPORT) include_directories(${maeparser_INCLUDE_DIRS}) set (maesupplier MaeMolSupplier.cpp) endif() @@ -45,7 +45,7 @@ rdkit_library(FileParsers ProximityBonds.cpp SequenceParsers.cpp SequenceWriters.cpp SVGParser.cpp - LINK_LIBRARIES Depictor SmilesParse GraphMol ${RDK_COORDGEN_LIBS} ${regex_lib} ${link_iostreams}) + LINK_LIBRARIES Depictor SmilesParse GraphMol ${RDK_MAEPARSER_LIBS} ${regex_lib} ${link_iostreams}) rdkit_headers(FileParsers.h FileParserUtils.h diff --git a/Code/GraphMol/FileParsers/MolSupplier.h b/Code/GraphMol/FileParsers/MolSupplier.h index f3f716320..460ae9c3b 100644 --- a/Code/GraphMol/FileParsers/MolSupplier.h +++ b/Code/GraphMol/FileParsers/MolSupplier.h @@ -22,14 +22,14 @@ #include #include -#ifdef RDK_BUILD_COORDGEN_SUPPORT +#ifdef RDK_BUILD_MAEPARSER_SUPPORT namespace schrodinger { namespace mae { class Reader; class Block; } // namespace mae } // namespace schrodinger -#endif // RDK_BUILD_COORDGEN_SUPPORT +#endif // RDK_BUILD_MAEPARSER_SUPPORT namespace RDKit { RDKIT_FILEPARSERS_EXPORT std::string strip(const std::string &orig); @@ -398,7 +398,7 @@ class RDKIT_FILEPARSERS_EXPORT PDBMolSupplier : public MolSupplier { bool df_sanitize, df_removeHs, df_proximityBonding; unsigned int d_flavor; }; -#ifdef RDK_BUILD_COORDGEN_SUPPORT +#ifdef RDK_BUILD_MAEPARSER_SUPPORT //! lazy file parser for MAE files class RDKIT_FILEPARSERS_EXPORT MaeMolSupplier : public MolSupplier { /** @@ -435,7 +435,7 @@ class RDKIT_FILEPARSERS_EXPORT MaeMolSupplier : public MolSupplier { std::shared_ptr dp_sInStream; std::string d_stored_exc; }; -#endif // RDK_BUILD_COORDGEN_SUPPORT +#endif // RDK_BUILD_MAEPARSER_SUPPORT } // namespace RDKit #endif diff --git a/Code/GraphMol/FileParsers/testMolSupplier.cpp b/Code/GraphMol/FileParsers/testMolSupplier.cpp index 040ccee3d..cda8d04f5 100644 --- a/Code/GraphMol/FileParsers/testMolSupplier.cpp +++ b/Code/GraphMol/FileParsers/testMolSupplier.cpp @@ -103,7 +103,7 @@ int testMolSup() { } TEST_ASSERT(i == 16); } -#ifdef RDK_BUILD_COORDGEN_SUPPORT +#ifdef RDK_BUILD_MAEPARSER_SUPPORT { // Test reading properties fname = rdbase + "/Code/GraphMol/FileParsers/test_data/props_test.mae"; @@ -283,7 +283,7 @@ int testMolSup() { TEST_ASSERT(info->getChainId() == "A"); TEST_ASSERT(info->getResidueNumber() == 5); } -#endif // RDK_BUILD_COORDGEN_SUPPORT +#endif // RDK_BUILD_MAEPARSER_SUPPORT return 1; } @@ -2281,7 +2281,7 @@ int testForwardSDSupplier() { } #endif -#ifdef RDK_BUILD_COORDGEN_SUPPORT +#ifdef RDK_BUILD_MAEPARSER_SUPPORT // Now test that Maestro parsing of gz files works std::string maefname = rdbase + "/Code/GraphMol/FileParsers/test_data/NCI_aids_few.mae"; @@ -2335,7 +2335,7 @@ int testForwardSDSupplier() { } TEST_ASSERT(i == 16); } -#endif // RDK_BUILD_COORDGEN_SUPPORT +#endif // RDK_BUILD_MAEPARSER_SUPPORT return 1; } @@ -2685,7 +2685,7 @@ M END } } -#ifdef RDK_BUILD_COORDGEN_SUPPORT +#ifdef RDK_BUILD_MAEPARSER_SUPPORT void testGitHub2881() { std::string data = R"DATA(f_m_ct { s_m_title diff --git a/Code/GraphMol/Wrap/CMakeLists.txt b/Code/GraphMol/Wrap/CMakeLists.txt index 8249fa656..1e08dc882 100644 --- a/Code/GraphMol/Wrap/CMakeLists.txt +++ b/Code/GraphMol/Wrap/CMakeLists.txt @@ -21,7 +21,7 @@ rdkit_python_extension(rdqueries LINK_LIBRARIES GraphMol ) -if(RDK_BUILD_COORDGEN_SUPPORT) +if(RDK_BUILD_MAEPARSER_SUPPORT) set (maesupplier MaeMolSupplier.cpp) include_directories(${maeparser_INCLUDE_DIRS}) endif() diff --git a/Code/GraphMol/Wrap/rdmolfiles.cpp b/Code/GraphMol/Wrap/rdmolfiles.cpp index 0d3e48b56..2eb6150f0 100644 --- a/Code/GraphMol/Wrap/rdmolfiles.cpp +++ b/Code/GraphMol/Wrap/rdmolfiles.cpp @@ -402,7 +402,7 @@ void wrap_sdsupplier(); void wrap_forwardsdsupplier(); void wrap_tdtsupplier(); void wrap_smisupplier(); -#ifdef RDK_BUILD_COORDGEN_SUPPORT +#ifdef RDK_BUILD_MAEPARSER_SUPPORT void wrap_maesupplier(); #endif @@ -1456,7 +1456,7 @@ BOOST_PYTHON_MODULE(rdmolfiles) { wrap_forwardsdsupplier(); wrap_tdtsupplier(); wrap_smisupplier(); -#ifdef RDK_BUILD_COORDGEN_SUPPORT +#ifdef RDK_BUILD_MAEPARSER_SUPPORT wrap_maesupplier(); #endif // wrap_pdbsupplier(); diff --git a/Code/GraphMol/Wrap/rough_test.py b/Code/GraphMol/Wrap/rough_test.py index 85ebc63ac..c8dd68a85 100644 --- a/Code/GraphMol/Wrap/rough_test.py +++ b/Code/GraphMol/Wrap/rough_test.py @@ -5923,12 +5923,13 @@ M END Chem.SDMolSupplier, Chem.TDTMolSupplier, #Chem.CompressedSDMolSupplier, - Chem.MaeMolSupplier ]: print("supplier:", supplier) with self.assertRaises(OSError): suppl = supplier(d) - + if hasattr(Chem, 'MaeMolSupplier'): + with self.assertRaises(OSError): + suppl = Chem.MaeMolSupplier(d) os.rmdir(d) def testRandomSmilesVect(self): diff --git a/Code/RDGeneral/RDConfig.h.cmake b/Code/RDGeneral/RDConfig.h.cmake index 41fcb2e22..d9a25b908 100644 --- a/Code/RDGeneral/RDConfig.h.cmake +++ b/Code/RDGeneral/RDConfig.h.cmake @@ -34,6 +34,8 @@ #cmakedefine RDK_BUILD_COORDGEN_SUPPORT +#cmakedefine RDK_BUILD_MAEPARSER_SUPPORT + #cmakedefine RDK_BUILD_AVALON_SUPPORT #cmakedefine RDK_BUILD_INCHI_SUPPORT diff --git a/External/CoordGen/CMakeLists.txt b/External/CoordGen/CMakeLists.txt index 414812f9d..5cb459bbd 100644 --- a/External/CoordGen/CMakeLists.txt +++ b/External/CoordGen/CMakeLists.txt @@ -1,14 +1,10 @@ add_custom_target(coordgen_support ALL) +include(RDKitUtils) -if(RDK_BUILD_COORDGEN_SUPPORT) - include(RDKitUtils) - - if(MSVC AND (NOT RDK_INSTALL_DLLS_MSVC)) - add_definitions(-DSTATIC_COORDGEN) - else(MSVC AND (NOT RDK_INSTALL_DLLS_MSVC)) +if(RDK_BUILD_MAEPARSER_SUPPORT) + if((NOT MSVC) OR RDK_INSTALL_DLLS_MSVC) add_definitions(-DIN_MAEPARSER) - add_definitions(-DIN_COORDGEN) - endif(MSVC AND (NOT RDK_INSTALL_DLLS_MSVC)) + endif() find_package(Boost ${RDK_BOOST_VERSION} COMPONENTS system iostreams REQUIRED) set (link_iostreams ${Boost_LIBRARIES}) @@ -61,9 +57,26 @@ if(RDK_BUILD_COORDGEN_SUPPORT) endif(MAEPARSER_FORCE_BUILD OR (NOT maeparser_FOUND)) + include_directories(${maeparser_INCLUDE_DIRS}) + + set(RDK_MAEPARSER_LIBS ${maeparser_LIBRARIES} ${Boost_LIBRARIES} + CACHE STRING "the external libraries" FORCE) + +else (RDK_BUILD_MAEPARSER_SUPPORT) + + set(RDK_MAEPARSER_LIBS CACHE STRING "the external libraries" FORCE) + +endif(RDK_BUILD_MAEPARSER_SUPPORT) + +if(RDK_BUILD_COORDGEN_SUPPORT) + if(MSVC AND (NOT RDK_INSTALL_DLLS_MSVC)) + add_definitions(-DSTATIC_COORDGEN) + else(MSVC AND (NOT RDK_INSTALL_DLLS_MSVC)) + add_definitions(-DIN_COORDGEN) + endif(MSVC AND (NOT RDK_INSTALL_DLLS_MSVC)) + find_package(coordgen MODULE) if(COORDGEN_FORCE_BUILD OR (NOT coordgen_FOUND)) - if(NOT DEFINED COORDGEN_DIR) set(COORDGEN_DIR "${CMAKE_CURRENT_SOURCE_DIR}/coordgen") endif() @@ -85,19 +98,15 @@ 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_LIBRARIES}) + rdkit_library(coordgen ${CGSOURCES} SHARED ) install(TARGETS coordgen DESTINATION ${RDKit_LibDir}) set(coordgen_LIBRARIES coordgen) endif(COORDGEN_FORCE_BUILD OR (NOT coordgen_FOUND)) - include_directories(${maeparser_INCLUDE_DIRS}) include_directories(${coordgen_INCLUDE_DIRS}) - install(FILES DESTINATION ${RDKit_ShareDir}/Data - COMPONENT data) - - set(RDK_COORDGEN_LIBS MolAlign ${coordgen_LIBRARIES} ${maeparser_LIBRARIES} ${Boost_LIBRARIES} + set(RDK_COORDGEN_LIBS MolAlign ${coordgen_LIBRARIES} ${RDK_MAEPARSER_LIBS} ${Boost_LIBRARIES} CACHE STRING "the external libraries" FORCE) rdkit_headers(CoordGen.h DEST GraphMol)