127 Commits

Author SHA1 Message Date
Ricardo Rodriguez
7b7a8a4e17 Refactor iostreams includes (#8846)
* refactor iostreams includes

* restore ostream to MonomerInfo.cpp
2025-10-08 16:08:01 +02:00
Greg Landrum
86141183c1 Moving towards getting all tests to pass when using the new stereo code (#8409)
* Fixes #8379

* check in some working tests

* test passes

* test passes

* test passes

* test passes

* test passes

* ensure that the invariants flush the streams on failure

* tests pass

* test passes

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* Fixes #8391

* tests pass

* fix a test with legacy
not clear why this was not causing problems before

* make a test work

* Fixes #8396

* gcc builds work

* fingerprint tests pass

* mention backwards incompatible change

* fix a problem with FindMolChiralCenters

* more testing details

* enable the test status output

* Fixes #8432

fix a bug in double-bond stereo handling for template matching

* all depictor tests pass

* use the new-stereo chiral ranks in the depiction code

* always assign new-stereo chiral ranks

* make _ChiralAtomRank a computed property
This is analogous to _CIPRank

* tweak to the way the atom ordering is computed for 2D coordinate generation

* update two expected results

* backup

* response to review

* tests pass

* tests pass

---------

Co-authored-by: = <=>
2025-04-15 14:00:32 +02:00
Greg Landrum
fa048eacc5 Replace GetImplicitValence() and GetExplicitValence() with GetValence() (#7926) 2025-01-28 21:09:03 +01:00
Hussein Faara
8411f4535e remove no-op macros and dead code (pt 2) (#8035)
* remove no-op macros and dead code (pt 2)

* test failures due to whitespace changes?

* actually run the testFeatures tests

---------

Co-authored-by: greg landrum <greg.landrum@gmail.com>
2025-01-11 14:10:00 +01:00
Greg Landrum
da6cd73168 Run clang-format across everything (#7849)
* run clang-format-18 across Code/*.cpp and Code/*.h

* run clang-format-18 across External
2024-09-26 13:39:02 +02:00
David Lounsbrough
4b78547bf9 fixing issue 5890 (#7152) 2024-02-09 13:24:59 +01:00
tadhurst-cdd
d7c01af9c8 Fixes for canonicalization, and stereochemistry (#6743)
* Fixes for canonicalization, and stereochemistry

* chnages from code review

* test that was omitted for canon correction

* PR review changes

* changes as per PR review

* missed file checkint to make PR tests compile

* PR conflict resolution

* change to fix PR buld errors (hopefully)

* line delete to force re-running of tests

* changes as per PR review

* resolve merge conflicts with master

* some suggestions

* revert chirality modifications when sanitization isn't being done

* addl changes: no stereo percept when no sanitize

* missing test expected files added

---------

Co-authored-by: greg landrum <greg.landrum@gmail.com>
2023-11-06 07:40:23 +01:00
Ric
58d135a874 Reformat C/C++ code ahead of 2023.03 release (#6295)
* format files

* format template files too
2023-04-28 04:42:35 +02:00
Brian Kelley
6cc277f961 Fix/github6138 (#6193)
* Fixes #6138

* If we aren't initialize, don't dump AllProps

* Save atom props for agents as well

---------

Co-authored-by: Brian Kelley <bkelley@relaytx.com>
2023-03-15 15:42:18 +01:00
Greg Landrum
9fa1df1cf6 Drop usage of CIP information from the canonicalization code (#5385)
* stop using CIP codes in the atomic canonicalization

this will change results in some cases, so lots of tests need to be updated.

* stop breaking string literals... ARGH

* tests now pass

* update double bond canonicalization

* update a python test

* some cleanup

* update expected results for cartridge
2022-07-13 05:40:23 +02:00
Alan Kerstjens
a720f772da Add ChemicalReaction copy assignment implementation (#5299) 2022-05-21 05:52:03 +02:00
Alan Kerstjens
ab760b8d93 Allow the compiler to generate default ChemicalReaction copy assignment operator (#5265)
Co-authored-by: Alan Kerstjens <alan.kerstjens@uantwerpen.be>
2022-05-08 09:27:58 +02:00
Alan Kerstjens
a860d16700 Add multi-template isMoleculeXOfReaction overloads (#5171)
* Add multi-template isMoleculeXOfReaction overloads

* Refactored isMoleculeXOfReaction overloads to remove code duplication

* Added tests for multi-template isMoleculeXOfReaction overloads

* Added negative tests for isMoleculeXOfReaction

Co-authored-by: Alan Kerstjens <alan.kerstjens@uantwerpen.be>
2022-04-12 05:32:24 +02:00
Ric
adc8707d6e Fixes #4410 (#4414)
* consider reversed bonds

* add test

* check smiles
2021-08-13 12:47:49 +02:00
jungb-basf
21f6b88be0 Update MDLParser.cpp (#4218)
* Update MDLParser.cpp

Fix length of expected strings "BEGIN AGENT" and "END AGENT"

* Add files via upload

* Delete v3k_with_agents.rxn

* fixes #4183

* Update testReaction.cpp

added testcase fixes #4183
2021-06-17 16:52:31 +02:00
Ric
d1574a2a05 Fixes #4114 (#4207)
* copy props for reactant/null query bonds

* add test
2021-06-06 07:46:06 +02:00
Paolo Tosco
8c06446f15 fixes #4162 (#4171)
Co-authored-by: Paolo Tosco <paolo.tosco@novartis.com>
2021-05-27 07:29:52 -04:00
Ric
bfbb4d2b24 Addresses #3078 (second try) (#3729)
* add test

* default reaction-edge stereo bonds to STEREONONE

* update older test
2021-02-04 17:54:13 +01:00
Paolo Tosco
4510bec9f3 Allow passing explicit removeHs, sanitize and strict flags to the MDL rxn parser (#3411) 2020-09-18 08:01:58 +02:00
Maciej Wójcikowski
0cac0ef11f Reactions should not use strict implicit valence calculations (#3098)
* Make non-strict implicit Hs calculation

* Update Code/GraphMol/ChemReactions/testReaction.cpp

Co-authored-by: Ric <ricrogz@users.noreply.github.com>

Co-authored-by: Ric <ricrogz@users.noreply.github.com>
2020-05-04 17:28:44 +02:00
Ric
39bcee635e Mem checkup (#3083)
* clean up in testDatastructs

* avoid jump on unassigned mem in rxns

* set valgrind error exit code

* update suppressions

* clean up RDValue in testDict

* don't leak mol if parsing Maestro file fails

* don't leak mol if parsing PDB block fails

* cleanup leftover rxns in testReaction

* cleanup mol if CX extensions cannot be parsed

* cleanup leftover mols in smiTest1

* cleanup leftover mols in moldraw2DTest1

* cleanup leftover mols in testSubstructMatch

* make testEnumeration go easier on valgrind

* reduce R counts
2020-04-17 17:48:58 +02:00
Greg Landrum
d41752d558 run clang-tidy with readability-braces-around-statements (#2899)
* run clang-tidy with readability-braces-around-statements
clang-format the results
clean up all the parts that clang-tidy-8 broke

* fix problem on windows
2020-01-25 14:19:32 +01:00
Greg Landrum
c988dc4c68 Cleanup some unintended consequences of #2553 (#2735)
* backup

* output bond stereoAtoms in debugMol()

* stop removing STEREOCIS/STEREOTRANS markers in setDoubleBondNeighborDirections()

* Re-establish bond dirs in reaction products.

* test all that
(the first set of tests, should do more)

* cleanups

* add SetDoubleBondNeighborDirections() to python API and test it

* add more tests

* changes in response to review

* add another c++ test, fix the java tests
2019-10-25 04:31:06 +02:00
Ric
79735d91d2 Bond stereo in reactions (#2553)
* Enable getStereoAtoms() for E/Z stereo bonds

* do not copy reactant bond directions to product & refactor

* new bond stereo mechanism

* update tests & add some more

* fix problems in E/Z getStereoAtoms()

* use make_iterator_range in Bonds.cpp

* backwards match, refactor, +1 test

* Apply suggestions from code review

Co-Authored-By: Greg Landrum <greg.landrum@gmail.com>

* Apply more suggestions, clang-format

* add comments, mixed pair stereo forwarding, tests; fix bug

* make Bond::getStereoAtoms threadsafe

* Revert "make Bond::getStereoAtoms threadsafe"

This reverts commit c5902d9dfb.

* Revert "Enable getStereoAtoms() for E/Z stereo bonds"

This reverts commit 9ef8c4d1f8.

* add back findStereoAtoms() to ReactionRunner

* add missing brace in conflict resolution
2019-08-18 07:10:50 +02:00
Ric
01fbec33ff Removal of redundant wildcards in SMARTS (Null Atom/Bond Query combination) (#2595)
* add nullQuery algebra

* update tests

* add header to CMake file

* add ownership notice to docstrings

* rename functions

* remove mergeNullQSecond

* fix function name

* Add comment about SMARTS changed to release notes
2019-08-15 14:37:17 +02:00
Brian Kelley
99ba4871df Fix #2547 (#2548)
* Fix #2547

* Add c++ test
2019-08-12 15:56:11 +02:00
Brian Kelley
3b4326c1c7 Add tests for #1868 (#2497)
* Add tests for #1868

* Fix github bug number

* Fix #2 for correcting issue number

* Fixes #1868

The primary problem here was that when v3K reactions were being processed,
a bunch of "finalization" steps were being skipped for the reactants and products.
This remedies that.

* update the python test so that it tests the actual problem
2019-07-12 05:51:16 +02:00
Ric
6224a42516 Build warnings revisited (#2318)
* unused vars in bison parser cleanup

* initialization order in TopologicalTorsionGenerator

* unused params in SLN bison

* sln flex unused params

* throwing destructor in TDTWriter

* signed comparison in substructmethods

* unused input param in smiles/smarts bison

* unused ms param in sln bison

* signed comparison in FingerprintGenerator

* store return of fscanf in StructCheckerOptions

* unreferenced var in catch

* uninitialized value in FileParserUtils

* avoid override overload warning in MolDraw2DSVG

* non-final overrides in Validate.h

* unused static var in Avalon

* unused vars in catch blocks

* make AvalonTools avalonSimilarityBits & avalonSSSBits const int

* assert fscanf result in StructCheckerOptions
2019-03-08 16:42:54 +01:00
Ric
a6b26253ff Fix (most of) mem problems (#2123)
* do not use new on loggers

* del pointers in testDistGeom

* Update Dict hasNonPOD status on bulk update

* delete new Dicts in memtest1.cpp

* fixes in MolSuppliers and testFMCS

* PeriodicTable singleton as unique_ptr

* fix EEM_arrays leak

* fix leaks in testPBF

* fix ParamCollection leak in test UFF

* fix leaks in MMFF

* clear prop dict before read in in pickler

* fix leaks in testFreeSASA

* fix leaks in test3D

* modernize Dict.h & SmilesParse.cpp

* fix leaks in testQuery

* fix leaks in testCrystalFF

* fix leaks in cxsmilesTest

* fix leaks in Catalog & mol cat test

* fix leaks in ShapeUtils & tests

* fix leaks in testSubgraphs1

* fix leaks testFingerprintGenerators

* fix leaks in Catalog/FilterCatalog

* fix leaks in graphmolqueryTest

* these changes reduce bison parse leaks

* fixed leaks in testChirality.cpp

* fix leaks + 2 tests in testMolWriter

* fix 4m leaks in substructLibraryTest

* small improvements to molTautomerTest; still leaks

* fix leaks in testRGroupDecomp

* fix leaks in test; parser still leaks

* fix leaks in itertest

* fix 4m leaks in testDepictor

* fixes in smatest; still leaking due to parser

* fixes in testSLNParse; still leaking due to parser

* flex/bison: always add atoms with ownership; smarts error cleanup

* fix leaks in testReaction

* fix leaks in testSubstructMatch

* fix leaks in resMolSupplierTest

* fix leaks in testChemTransforms + bug in ChemTransforms

* fix leaks in testPickler

* fix leaks in testMolTransform

* fix leaks in testFragCatalog

* fix leak in testSLNParse. Still leaks due to Smiles

* fixed most leaks in testMolSupplier

* pre bison fix

* fix some atom & bond parse problems; others still fail

* bison smiles & smarts, atoms & bonds more or less fixed

* fix leaks in molopstest.cpp

* fix leaks in testFingerprints, MACCS.cpp & AtomPairs.cpp

* fix leaks in moldraw2Dtest1

* fix leaks in testDescriptors

* fix leaks in testInchi

* fix leaks in testUFFForceFieldHelpers

* fix leaks in hanoiTest & new_canon.h

* fix leaks in testMMFFForceField

* fix leaks in graphmolTest1

* fix leaks in testMMFFForceFieldHelpers

* fix leaks in testDistGeomHelpers

* fix leaks in testMolAlign

* initialize occupancy & temp facto with default values

* fix leak in TautomerTransform

* updated suppressions

* fix testStructChecker

* fix logging & py tests

* fix TautomerTransform class/struct issue

* remove misplaced delete in testSLNParse

* deinit in testAvalonLib1

* fix Avalon-triggered(?) bug in StructChecker/Pattern.cpp

* fix random testMolWriter/Supplier fails

- diversify output file names to avoid clashing.
- unify Writers close/destruct behavior.
- flushing/closing in tests.

* use reset in FFs Params.cpp

* comments on testMMFFForceField

* unrequired 'if's added to mol suppliers

* correct cast in FilterCatalog.h

* use unique_ptr in MACCS Patterns

* remove unrequred if in new_canon

* update & move suppressions
2018-10-29 14:33:26 +00:00
Paolo Tosco
f7c888844d moved test.h from RDBoost to RDGeneral for consistency with export.h (#2074) 2018-10-11 17:35:23 -04:00
Greg Landrum
f0c0e6a035 Resolve #1269 (#1991)
* this is not anything like done

* Adjust reduceProductToSidechains() to the change

* reformatting

* switch to using global properties
2018-09-04 10:24:27 -04:00
Greg Landrum
8a099085ea Fixes #1988 (#1997)
* Fixes: #1988
This just handles the atomic number part. Still need to think about the bond types

* update the tests
This includes adding UnitTestSaltRemover.py to the list of tests to be run

* fix bug from interacting PRs
2018-08-13 18:40:28 +02:00
Greg Landrum
ba157fd397 Fixes #1869 (#1961)
Fixes #1955
2018-07-18 09:06:21 +02:00
Greg Landrum
4613d1a123 Fixes #1950 (#1958)
* Fixes #1950

* Changes from review:
- replace MolAtomList with MolAtomQuery
- support MRV SMA as well
2018-07-17 09:11:02 -04:00
Paolo Tosco
c08ea49bda - enable building DLLs on Windows (#1861)
* - enable building DLLs on Windows

* - export.h and test.h are now auto-generated by CMake
2018-05-16 08:42:41 +02:00
Greg Landrum
8cfa694035 Add Properties interface to ChemicalReactions (#1848)
* initial pass at pickling reaction properties

* move more of the property handling functions to props.hpp
Wouldn't be bad to rename these at some point.

* add reaction properties to python wrappers
2018-05-05 04:39:10 +02:00
Greg Landrum
3f136946e3 Start using "*" instead of "[*]" in SMILES (#1788) 2018-03-23 15:52:52 -04:00
Greg Landrum
d15efc1ac9 Make the defaults for some functions less error prone. (#1690)
* auto generate coords in mol block writer if includeChirality = True

* default to include chirality when writing mol blocks/files

* make isomeric smiles the default; note that not all tests are passing at the moment

* update a reaction test

* update expected cartridge search results
at this point all python, c++, and cartridge tests pass

* docs

* update incompatibility docs

* update doctests

* these now build

* minor example update

* update expected c++

* typo

* make allowCXSMILES=true the default

* add auto perception of chirality when reading 3D structures from mol blocks

* explain changes in release notes

* further doc update
2017-12-22 08:09:36 -05:00
Brian Kelley
3a5939bcb3 Turns off exception throwing for certain classes of Rlabel sanitization
It now does the best it can and moves on (#1621)
2017-11-15 06:44:05 +01:00
Greg Landrum
87786c08b5 Merge branch 'master' into modern_cxx
# Conflicts:
#	.travis.yml
#	Code/GraphMol/FileParsers/MolFileParser.cpp
#	Code/GraphMol/FileParsers/MolFileStereochem.cpp
#	Code/GraphMol/ForceFieldHelpers/UFF/testUFFHelpers.cpp
#	Code/GraphMol/MolAlign/testMolAlign.cpp
#	Code/GraphMol/MolDraw2D/MolDraw2D.cpp
#	Code/GraphMol/MolDraw2D/Wrap/rdMolDraw2D.cpp
#	Code/GraphMol/QueryOps.cpp
#	Code/GraphMol/ROMol.cpp
#	Code/GraphMol/SmilesParse/test.cpp
#	Code/GraphMol/Trajectory/Trajectory.cpp
#	Code/GraphMol/Wrap/Atom.cpp
#	Code/GraphMol/Wrap/Bond.cpp
#	Code/GraphMol/new_canon.cpp
#	Code/RDGeneral/testDict.cpp
#	Code/SimDivPickers/Wrap/MaxMinPicker.cpp
2017-10-05 05:58:38 +02:00
Greg Landrum
8dc371619b Fixes github #1544 (#1545) 2017-09-11 08:46:42 -04:00
Greg Landrum
915cf08faa run clang-format with c++-11 style over that 2017-04-22 17:19:10 +02:00
Greg Landrum
7c0bb0b743 clang-tidy output 2017-04-22 17:09:24 +02:00
Greg Landrum
d3ad7d2770 Fixes #1387 (#1392)
* backup

* Fixes #1387
this passes the bug tests, but needs the full tests run

* all tests pass

* remove some droppings left from an earlier attempt at a fix

* remove some additional printing

* cleanup
2017-04-07 11:57:43 -04:00
Brian Kelley
a02f2b0bb1 Fix/sanitizerxn merge hs (#1367)
* Fixes exceptions to use correct functionName

* Deprecates ChemDrawAdjustParams name sciquest integration/eln searching
 doesn’t map to this behavior.  renamed  MatchOnlyAtRgroupAdjustParams

* Python wrapper for deprecated API

* fixHs now is more intelligent about merging hs.

The only cases where hs can’t be merged is if they are mapped
to a non hydrogen in the product.

* Updates deprecated ChemDrawAdjustParams
2017-03-20 14:30:36 +00:00
Greg Landrum
c775b0c04e Fixes #1266 (#1270) 2017-01-20 09:23:18 -05:00
Brian Kelley
fa89438358 Dev/reaction enumeration (#1111)
* Adds C++ Enumeration Engine to the RDKit

* Adds Sanitization helpers, wrappers and tests

* Clang format

* Remove unused enumerationStateOnly flag

* Fixes docStrings to current API

* Adds doc strings

* Removes RGroupPosition, adds getPosition to EnumerationBase

* Fixes readability.

* Adds EnumerateLibraryBase::reset and getReaction

* Added getReagents method to EnumerateLibrary

* Make the tests have the same naming

* Need to save the initial state for resetting.

* Stupid case-insensitive file systems

* Moves ResetState to EnumerateLibraryBase

* Adds removeNonmatchingReagents helper

* Renames currentPosition to getPosition

* Adds Enumeration Toolkit tutorial

* Fixes Python3 serialization and enumerators

* Verified to run on python2 and 3

* Fixes integer issues on windows

* The number of enumeration should be unsigned.

* Adds deserialization constructor

* Moves boost_serialization to the end

* Deprecates Clone in favor of copy

* Update tests to use copy.copy not Clone

* Move RGROUPS and BBS into an EnumerationTypes namespace

* Make sure old pickles work

* Adds pickle for backwards compatibility

* Moves to uint64_t from size_t for public api

* Whups, accidentally used the binary archiver.

* Commits boost 1.55 serialization

* Makes serialization turnoffable Like Filter Catalog

* Fixes tests when serialization not available.  Adds more enumeration strategy tests

* Fixes a syntax error on some versions of python

* Fixes sanitizeRxn to actually make proper RGroup atoms

* Updates SanitizeRXN python API

* Updates Enumeration API to a parameter class - fixes reagent removal

* Adds a mess of tests

* Change stats to return a string.

* Exposes EvenPairSamplingStrategy Stats to python

* Fixes a crash bug in SanitizeRxn

* Adds better testing of the even pair sampling

* Fixes namespace

* One more try to fix gcc

* Enum classes are c++11 and a microsoft extension.

* Fix typo

* Fixes np.median for python3

* Fixes atom iterators

* Adds virtual tags to derived virtual functions (for clarity)

* Fixes size comparison issues

* Adds doc string

* Small cleanup (has no effect since flags aren’t used)

* fixes crash bug on windows

* get the tests working on windows

* Updates tutorial

* Adds Glare implementation to Contrib
2016-11-05 14:42:52 +01:00
NadineSchneider
61ca812972 ChemReactions: Bugfix in copy constructor (#996) 2016-07-27 10:22:13 -04:00
Greg Landrum
3e5605e793 Fixes #975 (#976) 2016-07-21 15:22:32 -04:00
Greg Landrum
bb4df7c082 stop including isotope labels on dummies from reduceProductToSideChains()
The atom-map info is there and is sufficient, adding the redundant isotope info does not help
2016-04-08 03:38:06 +02:00