V3000 parsing sets aromatic flags on bonds but not atoms. When removeHs
strips an explicit H from nitrogen in an aromatic ring, molRemoveH
checked heavyAtom->getIsAromatic() to decide whether to increment
numExplicitHs — but that flag was always false for V3000-parsed atoms.
Without the explicit H count, the kekulizer cannot distinguish pyrrole N from pyridine N,
causing
"Can't kekulize mol" errors on valid ChemDraw-exported molblocks.
Fix: use isAromaticAtom(), which checks both atom and bond aromatic
flags
* Do not reset the ringInfo information when adding bonds
This call was inconsistent (for example, the version of addBond() in ROMol did not do it)
and is unnecessary since the standard assumption is molecules need
to be re-sanitized after adding atoms and bonds
* response to review
clear the property cache on atoms after adding a bond.
* add a property cache update to the reaction runner
* add something to the release notes
* do not remove hydrides by default
* add a minimal test
* add release note about behavior change
* require Hydrides to have degree 1
* also allow hydrides with degree 0 (ionic bond)
* suggested changes
---------
Co-authored-by: greg landrum <greg.landrum@gmail.com>
* first pass, does not pass all tests
* add an option to control the new behavior
* add that to the python wrapper too
Fixes#8304
* Update Code/GraphMol/MolOps.h
Co-authored-by: Ricardo Rodriguez <ricrogz@users.noreply.github.com>
* undo some extra comment reformatting
* typo
Co-authored-by: Ricardo Rodriguez <ricrogz@users.noreply.github.com>
---------
Co-authored-by: Ricardo Rodriguez <ricrogz@users.noreply.github.com>
* throw if close to zero
* fix moldraw2DTestCatch
* Fix testRGroupDecomp
* fix one test in distGeomHelpersCatch
* fix tests in distGeomHelpersCatch
* retry finding a dir vector when adding Hs
* push UFF fixes to calculateCosY
* fix the setTerminalAtomCoords deg 4 patch
* add a test
* reduce zero tolerance
* Changing flags if doIsomericSmiles is false
* Ignoring cis-trans bonds as well
* Tests for removing enhanced stereo
* Fix#6237 by checking chiral tag instead of CIP
* Remove unnecesary calls to fabs
* Modify AddHs
* Tets for #6237
* Rerun Checks
* do not remoge H if it has a special purpose in an SGroup
* flip the removeinSGroup default
* do not remove H from H-only SGroups
* remove atoms/bonds from SGroups
* update existing tests
* add tests
* Apply suggestions from code review
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
* very basics: actually parsing the new atom stereochem features
* add some input verification for the chiral permutations
* fix a typo
add quadruple bond SMILES/SMARTS extension
* add forgotten files
* patch from Roger
* add Roger's parsing examples
* typo
* new tests
* adjusted version of next PR from Roger:
- add SP2D hybridization for square planar (this may change)
- some modernizationof Chirality.cpp
- stop using < HybridizationType in Chirality.cpp (should probably do this elsewhere too)
- improved handling of hybridization assignment for new stereochem
- handle new stereo/hybridization in UFF
- tests for the above
* perception of non-tetrahedral stereo from 3D (from Roger S)
Basic testing of SP and TB based on opensmiles docs
* potential fixes for octahedral assignment
more tests
* docs update
need way more!
* map the TH tags directly to @ tags
* very basics of SMILES writing
this does not work with anything that changes the permutation order
like canonicalization or writing things in rings.
* start to support the getChiralAcross API
* more testing
* consistency
* add hasNonTetrahedralStereo() and getIdealAngleBetweenLigands()
* assignStereochemistry should only remove non-tetrahedral stereo
* re-simplify those tests
* cleanup matrix stream output
* initial pass at supporting nontet stereo in distgeom
* backup
* start on the reference docs
* TBP reference
* first pass at Oh finished
* update SP section
* more doc updates
* fix a typo
* add param to not remove Hs connected to non-tetrahedral atoms
* VERY basic coord generation for square planar
* TBP basics
* basic OH depiction
* start testing missing ligands
allow non-tet stereo in rings (ugly, but correct)
* add new TBP functions from Roger
* update depiction code for new API
* backup, the new tests work so far
* Finish the TB tests
* OH tests pass too
* cleanup
* first pass at getting correct SMILES with reordering
need way more testing than this
* ensure permutation 0 is correctly preserved
* some progress towards adding non-tetrahedral stereo to StereoInfo
* doc update
* add non-tet chiral classes to python wrappers
* make sure removeAllHs also gets neighbors of non-tetrahedral centers
more testing
* a bit of depictor cleanup
* make the assignment from 3D more tolerant
more testing
* improve the bulk testing
* cleanup
* remove a bit of redundant code
* ensure we don't write bogus permutation values to SMILES
* fix some rebase problems
* allow assignStereochemistryFrom3D() to be called without sanitization
* allow disabling the non-tetrahedral stereo when it's not explicit
* get that working on windows too
* resolves oss-fuzz #24399
* clean up some undefined behavior
* fix some UB in mergeQueryHs
* be more defensive
* defensive programming
* fix a _cxsmilesBondIdx bug
* more defensive programming
* Make sure that added R-groups have non-zero coordinates
* - renamed setHydrogenCoords to setTerminalAtomCoords (and parameters accordingly)
- switched from ROMol* to RoMol& to remove a PRECONDITION
- documented the newly exposed C++ function
- added a Python wrapper
- added C++ and Python tests
* fixed conflicts and added a test
* Update Code/GraphMol/RGroupDecomposition/testRGroupDecomp.cpp
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
* Update Code/GraphMol/RGroupDecomposition/testRGroupDecomp.cpp
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
* Update Code/GraphMol/MolOps.h
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
* Update Code/GraphMol/Wrap/MolOps.cpp
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
* changes in response to review
Co-authored-by: Paolo Tosco <paolo.tosco@novartis.com>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
* backup
* simple first pass, passes all tests
* cleanup a bunch of existing uses
* ensure that we can safely add atoms/bonds while in edit mode
* add context manager on python side
* handle exceptions properly in those
* changes in response to review
* RGD modifications for any atom and index labels
* Continued development
* All tests working
* Added comment
* CR changes suggested by PTosco
* Fix catch_rgd for autocrlf
* Core dummy matches on output. RGroups on heavy atom. Dummy atoms User rgroups only when they are degree 1.
* Start work on test fixes
* testRGroupDecomp test working
* CPP and Python tests working
* Removed options for matching core query atoms on sidechains
* Windows build fix
* R groups off ring. User group matches single heavy substituent. Remove extraneous hydrogens
* Updated fingerprint variance score and tie selection
* Refactor fingerprint variance score functions to class
* Removed fingerprint distance score
* Boost::trim fix
* Updated RGD test notebook
* Fixed AddHs.cpp
* - fixes the kekulization issue
- avoids that empty R-group labels are included in cores
- makes sure that SMILES cores are always canonical
- adds a few missing const declarations and avoids unintentional copying
* Support for allowNonTerminalRGroups parameter. Remove R groups that contain H or Nothing. Ignore R group labels on non-dummy atoms
* Fixed tests for Paolo's changes. Rebuilt test notebook. Increased weighting of rgroup penalty in fingerprint variance score
* remove some debug output
Co-authored-by: Brian Kelley <fustigator@gmail.com>
Co-authored-by: greg landrum <greg.landrum@gmail.com>
- switched to using std::vector<int> instead of std::list<int> for _ErGAtomTypes property
- added RegisterListConverter<std::vector<unsigned int>>
Co-authored-by: Paolo Tosco <paolo.tosco@novartis.com>
* add "needsHs()" query
* add warning for embedding without Hs
* add H checks to UFF and MMFF as well;
a small amount of cleanup in the MMFF atom typing
* remove include from headers
* update implementation files
* completely remove BOOST_FOREACH (#7)
* convert those changes to use auto
* get rid of all usage of BOOST_FOREACH
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
* Add better support for isotopic Hs to removeHs() and addHs()
* simplify the new code to add Hs back
* Changes in response to review
* revert FindCairo.cmake that I pushed by mistake (grrr)
Co-authored-by: greg landrum <greg.landrum@gmail.com>
* run clang-tidy with modernize-use-default-member-init
* results from modernize-use-emplace
* one uniform initialization per line
otherwise SWIG is unhappy
Co-authored-by: Brian Kelley <fustigator@gmail.com>
* Progress on #3168
* Fixes#3167
* Fixes#3169
* deal with CBONDS too
* test PATOMS
* Fixes#3175
* a bit of code simplification and test updates
still needs more testing
* more testing
* handle s-group hierarchy
also a couple of other changes in response to the review
* add forgotten test file
* changes in response to review
* Fixes#3150
Fixes removeHs removing Hydrides by adding a removeHydrides flag to RemoveHsParameters.
If removeHydrides is false, Hydrogen atoms with formal charge -1 and degree less than or equal to 1 are kept
removeHydrides is kept true by default
* Made suggested changes
Removed extraneous comments and redundant code
Added tests for both ```removeHydrides = true``` and ```removeHydrides = false```
Added tests that ```removeAllHs()``` also removes hydrides
Exposed ```removeHydrides``` parameter to python
* Explicity Added removeHydrides=true in removeAllHs
Corrected typo for removeHydrides
* make formatting consistent
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
* do not throw in desctructor
* remove unused var; reserve
* provide operator= for DiscreteValueVect
* provide operator= for SparseIntVect
* remove unknown 'omp' #pragmas; refactor loop
* remove unused var
* remove unused variables
* give EmbeddedAtom a default constructor & early exit on self assignç
* handle unused vars/args
* catch exception by ref
* address unused args
* fix signed type comparison; refactor extra checks
* remove unused variable
* suppress switch fallthtough warning
* handle signed type comparison
* handle signed type comparison
* potentially uninitialized vars
* fix abs() of bool
* unused vars in catch statements
* remove unused variables
* python::list returns will be copied
* give ValidationMethod constructor & virtual destructor
* remove extra semicolon
* 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
* backup commit; won't even compile
* backup commit
* Fixes#2848
* A few changes
- add a bunch of tests
- some fixes
- add ROMol version to API
* add python wrapper and associated tests
* add RemoveAllHs()
* changes in response to review
- add removedMapped option
- add docstrings for options
* changes in response to review
* first round of cleanups based on PVS-studio suggestions
* a couple more
* a few more cleanups
* another round of cleanups
* undo one of those cleanups
we want the integer rounding behavior here
* add a comment to make that clear
* Fix for filter catalog PRECONDITION redundancy
* Modify removeHs so that it does not remove degree 0 atoms
Update the docs at the same time.
* include a warning when not removing some Hs
* clear up a problem with the warning log