Skip to content

Commit

Permalink
Extend RDKit::MolStandardize with a validation and standardization Pi…
Browse files Browse the repository at this point in the history
…peline (rdkit#7582)

* Extend RDKit::MolStandardize with a validation and standardization Pipeline

* suggested changes

* apply clang-format

* apply yapf

* MolStandardize::FeaturesValidation optionally disallow dative bonds

* add allowDativeBondType to MolStandardize::PipelineOptions

* apply clang-format

* make the API of other validation classes more consistent with MolStandardize::FeaturesValidation

* apply clang-format

* PipelineStage to enum class
remove virtual functions from Pipeline class
be explicit about enums

* light refactoring to avoid what I think is an unnecessary call to `parse`

* a bit of modernization

* make the pipeline configurable

* make parse and serialize configurable too

* switch to storing pipeline stages using uints

* add a simple test for providing a pipeline

* update pointer alignment for clang-format

* test modifying the parser and serializer

* update swig requirement

* changes in response to review

* changes in response to review

* rename PipelineResult's *MolBlock members to *MolData

* upgrade swig to 4.2 in the CI environments

* add a few missing export directives

---------

Co-authored-by: greg landrum <[email protected]>
  • Loading branch information
rvianello and greglandrum authored Jul 30, 2024
1 parent 138bdc8 commit 3f7caf0
Show file tree
Hide file tree
Showing 20 changed files with 6,503 additions and 212 deletions.
2 changes: 1 addition & 1 deletion .azure-pipelines/linux_build_java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ steps:
conda create --name rdkit_build -c conda-forge cmake \
libboost=$(boost_version) \
libboost-devel=$(boost_version) \
swig=4.1
swig=4.2
displayName: Setup build environment
- bash: |
source ${CONDA}/etc/profile.d/conda.sh
Expand Down
2 changes: 1 addition & 1 deletion .azure-pipelines/mac_build_java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ steps:
libcxx=$(compiler_version) cmake=3.26 \
libboost=$(boost_version) \
libboost-devel=$(boost_version) \
cairo eigen swig=4.1
cairo eigen swig=4.2
conda activate rdkit_build
displayName: Setup build environment
- bash: |
Expand Down
2 changes: 1 addition & 1 deletion .azure-pipelines/vs_build_swig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ steps:
cmake=3.26 ^
libboost=$(boost_version) ^
libboost-devel=$(boost_version) ^
cairo eigen swig=4.1
cairo eigen swig=4.2
call activate rdkit_build
displayName: Install dependencies
- script: |
Expand Down
4 changes: 2 additions & 2 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ BinPackArguments: true
ColumnLimit: 80
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
DerivePointerAlignment: true
DerivePointerAlignment: false
ExperimentalAutoDetectBinPacking: false
IndentCaseLabels: true
IndentWrappedFunctionNames: false
Expand All @@ -40,7 +40,7 @@ PenaltyBreakString: 1000
PenaltyBreakFirstLessLess: 120
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
PointerAlignment: Right
SpacesBeforeTrailingComments: 2
Cpp11BracedListStyle: true
Standard: Cpp11
Expand Down
97 changes: 52 additions & 45 deletions Code/GraphMol/MolStandardize/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,55 +1,61 @@

rdkit_library(MolStandardize
MolStandardize.cpp
Metal.cpp
Normalize.cpp
Validate.cpp
Charge.cpp
Tautomer.cpp
Fragment.cpp
FragmentCatalog/FragmentCatalogEntry.cpp
FragmentCatalog/FragmentCatalogParams.cpp
FragmentCatalog/FragmentCatalogUtils.cpp
AcidBaseCatalog/AcidBaseCatalogEntry.cpp
AcidBaseCatalog/AcidBaseCatalogParams.cpp
AcidBaseCatalog/AcidBaseCatalogUtils.cpp
TransformCatalog/TransformCatalogEntry.cpp
TransformCatalog/TransformCatalogParams.cpp
TransformCatalog/TransformCatalogUtils.cpp
TautomerCatalog/TautomerCatalogEntry.cpp
TautomerCatalog/TautomerCatalogParams.cpp
TautomerCatalog/TautomerCatalogUtils.cpp
LINK_LIBRARIES ChemReactions ChemTransforms SmilesParse SubstructMatch Descriptors GraphMol )
Pipeline.cpp
MolStandardize.cpp
Metal.cpp
Normalize.cpp
Validate.cpp
Charge.cpp
Tautomer.cpp
Fragment.cpp
FragmentCatalog/FragmentCatalogEntry.cpp
FragmentCatalog/FragmentCatalogParams.cpp
FragmentCatalog/FragmentCatalogUtils.cpp
AcidBaseCatalog/AcidBaseCatalogEntry.cpp
AcidBaseCatalog/AcidBaseCatalogParams.cpp
AcidBaseCatalog/AcidBaseCatalogUtils.cpp
TransformCatalog/TransformCatalogEntry.cpp
TransformCatalog/TransformCatalogParams.cpp
TransformCatalog/TransformCatalogUtils.cpp
TautomerCatalog/TautomerCatalogEntry.cpp
TautomerCatalog/TautomerCatalogParams.cpp
TautomerCatalog/TautomerCatalogUtils.cpp
LINK_LIBRARIES ChemReactions ChemTransforms SmilesParse SubstructMatch Descriptors GraphMol )
target_compile_definitions(MolStandardize PRIVATE RDKIT_MOLSTANDARDIZE_BUILD)

rdkit_headers(MolStandardize.h
Metal.h
Normalize.h
Validate.h
Charge.h
Tautomer.h
Fragment.h
DEST GraphMol/MolStandardize)
rdkit_headers(
Pipeline.h
MolStandardize.h
Metal.h
Normalize.h
Validate.h
Charge.h
Tautomer.h
Fragment.h
DEST GraphMol/MolStandardize)

rdkit_headers(FragmentCatalog/FragmentCatalogEntry.h
FragmentCatalog/FragmentCatalogParams.h
FragmentCatalog/FragmentCatalogUtils.h
DEST GraphMol/MolStandardize/FragmentCatalog)
rdkit_headers(
FragmentCatalog/FragmentCatalogEntry.h
FragmentCatalog/FragmentCatalogParams.h
FragmentCatalog/FragmentCatalogUtils.h
DEST GraphMol/MolStandardize/FragmentCatalog)

rdkit_headers(AcidBaseCatalog/AcidBaseCatalogEntry.h
AcidBaseCatalog/AcidBaseCatalogParams.h
AcidBaseCatalog/AcidBaseCatalogUtils.h
DEST GraphMol/MolStandardize/AcidBaseCatalog)
rdkit_headers(
AcidBaseCatalog/AcidBaseCatalogEntry.h
AcidBaseCatalog/AcidBaseCatalogParams.h
AcidBaseCatalog/AcidBaseCatalogUtils.h
DEST GraphMol/MolStandardize/AcidBaseCatalog)

rdkit_headers(TransformCatalog/TransformCatalogEntry.h
TransformCatalog/TransformCatalogParams.h
TransformCatalog/TransformCatalogUtils.h
DEST GraphMol/MolStandardize/TransformCatalog)
rdkit_headers(
TransformCatalog/TransformCatalogEntry.h
TransformCatalog/TransformCatalogParams.h
TransformCatalog/TransformCatalogUtils.h
DEST GraphMol/MolStandardize/TransformCatalog)

rdkit_headers(TautomerCatalog/TautomerCatalogEntry.h
TautomerCatalog/TautomerCatalogParams.h
TautomerCatalog/TautomerCatalogUtils.h
DEST GraphMol/MolStandardize/TautomerCatalog)
rdkit_headers(
TautomerCatalog/TautomerCatalogEntry.h
TautomerCatalog/TautomerCatalogParams.h
TautomerCatalog/TautomerCatalogUtils.h
DEST GraphMol/MolStandardize/TautomerCatalog)

if(RDK_BUILD_PYTHON_WRAPPERS)
add_subdirectory(Wrap)
Expand All @@ -63,5 +69,6 @@ rdkit_test(molTautomerTest testTautomer.cpp LINK_LIBRARIES MolStandardize )
rdkit_test(molStandardizeSmallTest test2.cpp LINK_LIBRARIES MolStandardize )
rdkit_test(molFragmentTest testFragment.cpp LINK_LIBRARIES MolStandardize )
rdkit_catch_test(molStandardizeCatchTest catch_tests.cpp LINK_LIBRARIES MolStandardize )
rdkit_catch_test(molStandardizePipelineTest testPipeline.cpp LINK_LIBRARIES MolStandardize)


2 changes: 1 addition & 1 deletion Code/GraphMol/MolStandardize/Charge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ void Uncharger::unchargeInPlace(RWMol &mol) {
}
}
}
} // namespace MolStandardize
}

} // namespace MolStandardize
} // namespace RDKit
Loading

0 comments on commit 3f7caf0

Please sign in to comment.