Files
rdkit/Code/GraphMol/CMakeLists.txt
Brian Kelley 48e1fc2b8d Add extract mol fragment api (#8811)
* Create a function to extract some specified atoms from a ROMol as a new ROMol by creating new graph (#8742)

This adds a new api, `RDKit::MolOps::ExtractMolFragment`, to allow efficient
extractions of mol fragments from large mols. Compared to the approach where
we delete "unwanted" atoms/bonds from the input mol, this api is faster for
small mols (about 2x faster) and at least 3x faster for big mols
(was 10x faster for "CCC"*1000).

* clang-format

* review comments

* cleanup

* Consolidate copying subsets of molecules

* Readd missing tests

* Update comment to restart build

* Remove missing test

* Remove debugging comment, fix warnings

* Fix warnings on gcc11

* Add docs

* Make vector<bool> dynamic_bitset<>

* Update copyright

* Add swig wrappers

* Use new designated constructor API

* Fix windows builds

* Change enum values from unsigned int to integer

* Fix unsigned int variable

* Update Code/GraphMol/Wrap/test_subset.py

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>

* Update Code/GraphMol/Subset.cpp

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>

* Update Code/JavaWrappers/gmwrapper/src-test/org/RDKit/ChemTransformsTests.java

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>

* Reponse to review

* Fix documentation

* Remove comments

* Remove unnecessary comments

* Fix one liners

* Change assertion to be clearer (and not one-liners)

* Run clang-format

---------

Co-authored-by: Your Name <you@example.com>
Co-authored-by: Hussein Faara <hussein.faara@schrodinger.com>
Co-authored-by: Brian Kelley <bkelley@glysade.com>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2025-12-30 07:07:50 +01:00

208 lines
6.3 KiB
CMake

rdkit_library(GraphMol
Atom.cpp QueryAtom.cpp QueryBond.cpp Bond.cpp
MolOps.cpp FindRings.cpp ROMol.cpp RWMol.cpp PeriodicTable.cpp
atomic_data.cpp QueryOps.cpp MolPickler.cpp Canon.cpp
AtomIterators.cpp BondIterators.cpp Aromaticity.cpp Kekulize.cpp
ConjugHybrid.cpp AddHs.cpp
Matrices.cpp Chirality.cpp RingInfo.cpp Conformer.cpp
Renumber.cpp AdjustQuery.cpp Resonance.cpp StereoGroup.cpp
new_canon.cpp SubstanceGroup.cpp FindStereo.cpp MonomerInfo.cpp
NontetrahedralStereo.cpp Atropisomers.cpp
WedgeBonds.cpp MolProps.cpp Subset.cpp
SHARED
LINK_LIBRARIES RDGeometryLib RDGeneral)
target_compile_definitions(GraphMol PRIVATE RDKIT_GRAPHMOL_BUILD)
if (RDK_USE_URF)
target_link_libraries(GraphMol PUBLIC ${RDK_URF_LIBS})
if (RDK_INSTALL_STATIC_LIBS AND NOT RDK_BUILD_STATIC_LIBS_ONLY)
target_link_libraries(GraphMol_static PUBLIC ${RDK_URF_LIBS}_static)
endif ()
endif ()
rdkit_headers(Atom.h
atomic_data.h
AtomIterators.h
Atropisomers.h
Bond.h
BondIterators.h
Canon.h
Chirality.h
Conformer.h
details.h
GraphMol.h
MolOps.h
MolPickler.h
PeriodicTable.h
QueryAtom.h
QueryBond.h
QueryOps.h
RDKitBase.h
RDKitQueries.h
Resonance.h
RingInfo.h
Rings.h
ROMol.h
RWMol.h
SanitException.h
SubstanceGroup.h
StereoGroup.h
MonomerInfo.h
new_canon.h
MolBundle.h
Subset.h
DEST GraphMol)
add_subdirectory(SmilesParse)
add_subdirectory(Depictor)
add_subdirectory(MarvinParse)
add_subdirectory(FileParsers)
add_subdirectory(Substruct)
add_subdirectory(GenericGroups)
add_subdirectory(ChemReactions)
add_subdirectory(ChemTransforms)
add_subdirectory(TautomerQuery)
add_subdirectory(Subgraphs)
add_subdirectory(FilterCatalog)
add_subdirectory(FragCatalog)
add_subdirectory(Descriptors)
add_subdirectory(Fingerprints)
add_subdirectory(PartialCharges)
add_subdirectory(MolTransforms)
add_subdirectory(ForceFieldHelpers)
add_subdirectory(DistGeomHelpers)
add_subdirectory(MolAlign)
add_subdirectory(MolChemicalFeatures)
add_subdirectory(ShapeHelpers)
add_subdirectory(MolCatalog)
add_subdirectory(MolDraw2D)
add_subdirectory(FMCS)
add_subdirectory(MolHash)
add_subdirectory(MMPA)
add_subdirectory(RascalMCES)
add_subdirectory(SynthonSpaceSearch)
add_subdirectory(EnumerateStereoisomers)
add_subdirectory(CIPLabeler)
add_subdirectory(Deprotect)
if (RDK_BUILD_STRUCTCHECKER_SUPPORT)
add_subdirectory(StructChecker)
endif ()
add_subdirectory(ReducedGraphs)
add_subdirectory(Trajectory)
add_subdirectory(SubstructLibrary)
add_subdirectory(RGroupDecomposition)
if (RDK_BUILD_XYZ2MOL_SUPPORT)
add_subdirectory(DetermineBonds)
endif ()
if (RDK_BUILD_MOLINTERCHANGE_SUPPORT)
add_subdirectory(MolInterchange)
endif (RDK_BUILD_MOLINTERCHANGE_SUPPORT)
if (RDK_BUILD_SLN_SUPPORT AND NOT CMAKE_COMPILER_IS_CLANG)
if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS_EQUAL 4.8)
message("Skipping SLN build with gcc version <= 4.8")
else ()
add_subdirectory(SLNParse)
endif ()
endif ()
if (RDK_BUILD_PYTHON_WRAPPERS)
add_subdirectory(Wrap)
endif ()
add_subdirectory(MolStandardize)
add_subdirectory(ScaffoldNetwork)
add_subdirectory(MolEnumerator)
add_subdirectory(Abbreviations)
add_subdirectory(GeneralizedSubstruct)
add_subdirectory(MolProcessing)
add_subdirectory(MolInteractionFields)
rdkit_test(graphmolTest1 test1.cpp LINK_LIBRARIES FileParsers SmilesParse GraphMol
SubstructMatch ForceFieldHelpers ForceField)
rdkit_test(graphmolcpTest cptest.cpp LINK_LIBRARIES SmilesParse GraphMol)
rdkit_test(graphmolqueryTest querytest.cpp LINK_LIBRARIES SubstructMatch SmilesParse GraphMol)
rdkit_catch_test(graphmolMolOpsTest molopstest.cpp
LINK_LIBRARIES SubstructMatch FileParsers
SmilesParse GraphMol)
rdkit_test(graphmoltestChirality testChirality.cpp
LINK_LIBRARIES CIPLabeler SmilesParse FileParsers
GraphMol)
rdkit_test(graphmoltestPickler testPickler.cpp
LINK_LIBRARIES SmilesParse SubstructMatch FileParsers GraphMol)
rdkit_test(graphmoltestPicklerGlobalSetting testPicklerGlobalSettings.cpp
LINK_LIBRARIES SmilesParse SubstructMatch FileParsers GraphMol)
rdkit_test(graphmolIterTest itertest.cpp LINK_LIBRARIES SmilesParse GraphMol)
rdkit_test(hanoiTest hanoitest.cpp LINK_LIBRARIES
SubstructMatch SmilesParse FileParsers GraphMol
)
rdkit_test(graphmolMemTest1 memtest1.cpp LINK_LIBRARIES SmilesParse GraphMol)
rdkit_test(resMolSupplierTest resMolSupplierTest.cpp
LINK_LIBRARIES SmilesParse GraphMol SubstructMatch FileParsers)
rdkit_test(molBundleTest testMolBundle.cpp
LINK_LIBRARIES SmilesParse GraphMol SubstructMatch FileParsers)
rdkit_test(testSGroup testSGroup.cpp LINK_LIBRARIES FileParsers GraphMol)
rdkit_test(test-valgrind test-valgrind.cpp LINK_LIBRARIES SmilesParse FileParsers GraphMol)
rdkit_catch_test(graphmolTestsCatch catch_graphmol.cpp
LINK_LIBRARIES SubstructMatch FileParsers SmilesParse GraphMol)
rdkit_catch_test(graphmolOrganometallicsCatch catch_organometallics.cpp
LINK_LIBRARIES FileParsers SmilesParse GraphMol)
rdkit_catch_test(graphmolSGroupCatch catch_sgroups.cpp
LINK_LIBRARIES SmilesParse FileParsers GraphMol)
rdkit_catch_test(graphmolAdjustQueryCatch catch_adjustquery.cpp
LINK_LIBRARIES SubstructMatch FileParsers SmilesParse GraphMol)
rdkit_catch_test(chiralityTestsCatch catch_chirality.cpp
LINK_LIBRARIES CIPLabeler FileParsers SmilesParse GraphMol)
rdkit_catch_test(canonTestsCatch catch_canon.cpp
LINK_LIBRARIES CIPLabeler FileParsers SmilesParse GraphMol)
rdkit_catch_test(moliteratorTestsCatch catch_moliterators.cpp
LINK_LIBRARIES SubstructMatch SmilesParse GraphMol)
rdkit_catch_test(queryTestsCatch catch_queries.cpp
LINK_LIBRARIES SmilesParse GraphMol)
rdkit_catch_test(molbundleTestsCatch catch_molbundle.cpp
LINK_LIBRARIES SmilesParse GraphMol)
rdkit_catch_test(pickleTestsCatch catch_pickles.cpp
LINK_LIBRARIES FileParsers SmilesParse GraphMol)
rdkit_catch_test(tableTestsCatch catch_periodictable.cpp
LINK_LIBRARIES GraphMol)
rdkit_catch_test(molopsTestsCatch catch_molops.cpp
LINK_LIBRARIES FileParsers SmilesParse GraphMol)