* 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
* Implements #8222 adds react_idx (index of reactant) to product atoms
* Remove react_idx from mol enumerator products
* Response to review, add test to ensure product only atoms aren't tagged
* Reenable tests
* Fixes#7669
Still need to add:
- testing for bond stereogroups
- code to handle the cases where the stereogroups should not be copied over
* backup
* stereogroups in the product templates take
priority over stereogroups in the reactant
* stereogroups in the product templates take
priority over stereogroups in the reactant
* backup
* fix handling of existing stereo groups
Atoms which are in template stereogroups are removed from reactant stereogroups,
but otherwise reactant stereogroups are preserved.
All tests pass
* response to review
* move mol weight and formula calculators to MolOps and refactor them a bit.
The descriptors are still there and should remain.
* remove other unnecessary dependencies on Descriptors
* Update adapter.cpp
Co-authored-by: Paolo Tosco <paolo.tosco.mail@gmail.com>
---------
Co-authored-by: Paolo Tosco <paolo.tosco.mail@gmail.com>
* atropisomer handling added
* fixed non-used variables, linking directives
* BOOST LIB start/stop fixes, linking fix
* Fixes for RDKIT CI errors
* minimalLib fix
* changed vector<enum> for java builds
* check for extra chars in CIP labeling
* removed wrong deprecated message
* fix ostrstream output error?
* restored _ChiralAtomRank to lowercase first letter
* changes for merged master
* Fixed catch label for new Catch package
* update expected psql results
* get swig wrappers building
* restore MolFileStereochem to FileParsers
* fix java wrapper for reapplyMolBlockWedging
* some suggestions
* move a couple functions out of Bond
* Merge branch 'master' into pr/atropisomers2
* merged master
* Renamed setStereoanyFromSquiggleBond
* atropisomers in cdxml, rationalize atrop wedging, stereoGroups in drawMol
* fix for CI build
* attempt to fix java build in CI
* attempt to fix java build in CI #2
* New routine to remove non-explicit 3D-geneated chirality
* changed to use pair for atrop atoms and related bonds
* Changes as per PR reviews
* PR review respnses
* PR review reponse - more
* Fix merge from master
* fixing java ci after merge
* Updated the help doc for atripisomers
* update the atropisomer docs
* improve the images
* add the source CXSMILES
---------
Co-authored-by: greg landrum <greg.landrum@gmail.com>
* reionizer and uncharger and normalizer can now operate in place
* add removeUnmatchedAtoms argument to in-place version of runReactant
When set to false atoms which are not explicitly removed by the reaction are preserved
* Fix a case where transforms were incorrectly updating atomic numbers
* add more inplace operations to MolStandardize
* support those in the Python layer
* support inplace for the rest of the python wrappers
* move a few more functions over to the inplace code
* backup
* basic tests pass
* add JSON out to substruct match parameters
* serialize the substruct match parameters in reactions
* add that to the python wrapper
* more testing
* add ROMol::atomBonds() and ROMol::atomNeighbors() methods
* remove some warnings
* start using the new code
* add default for those template params
* some more applications
* get the SWIG builds working
* get rid of extraneous ref
* remove extraneous comments
* minor preparatory refactor
* add test
* add reaction literals
* tests for the new literals
* add runReactant
first steps to making things work
* remove works
* backup
* all current tests passing except bond-order changes
some atom-property copying fixed
* bond changes now work
* handle atomic stereo
* some cleanup and more tests
* docs
* not-working
* add KekulizeIfPossible()
* return a value from KekulizeIfPossible
* Revert "not-working"
This reverts commit 2ebd8a5519.
* add in-place reactions to python wrapper
* simplify deprotection wrapper code
* support in-place deprotection
* changes in response to review
* forgotten change
* 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
* 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 tests for the problem
* more testing (still no fix)
* Fixes#2891
Try to be more robust w.r.t. atom reordering in input SMILES
* better handling of differing numbers of bonds between reactants and products
all tests now passing
* update the rdkit book with more details about chirality in reactions
* changes in response to review
* add port of centres
* Several changes:
- Added a test based on RDKit issue 2984
(default RDKit fails it, this gets it right)
- Use bond directions for bond stereo (label is no longer required)
- Fix bugs in rules 4b and 5new
- Fix some mem errors
- clang-formatted
- some other minor cleanups
* Several changes and some improvements:
- Added LGPL license, as well as a mention in the doc.
- Fix/update/add some comments
- Fix typo/bug in Mancude calculation
- Fix bug in rules 4b, 5New
- Fix Sp2 Bond dir reference
- Re clang-format
- other minor changes suggested by Dan
* Another bunch of changes:
- require integer-order bonds; kekulize when required
- fix fraction comparison
- rename sq Cis/Trans e/z
- replace queues with vectors
- update copyright notices
- revert LGPL changes
- fix Asymmetric typo
* move to separate lib/mod, add python validation test
* Moving away from the original implementation:
- Rename to CIPLabeler
- Remove the abstraction layer
- Remove some stats stuff
- Push some CIPMol functions down to Node
- Use RDKit's isotope info
* Another bundle of changes. The most relevant ones:
- fix parity translation
- use cis trans as bond reference -- breaks #2984 test
- kill a lot of unused code
- use lists for queues
- store nodes and edges in digraph
- add prefixes to class data member names
- update changeRoot() test
- use fastFindRings() for mancude rings
- update docs
- add references to the scientific paper
- Document the Mancude functions
- Fix Mancude atom types and their comments
- remove mol data member from SequenceRule
- replace Fraction with boost::rational
- update comments, docstrings and the doc
* fix building the test
* Changes here include:
- adding bitset overload for the labeling function
- python wrap of the overload
- handling trigonal pyramids with implicit H
- setting bond labels sets stereo atoms, cis/trans
- nix LEFT/RIGHT/TOGETHER/OPPOSITE constants
- don't use GLOB in cmake
- a decent amount of refactoring
* Minor edits to new_CIP_labeling (#6)
* Some changes for clarity
Added some documentation and changed some variable names to match
my understanding. Also a ran clang-tidy to ensure that all blocks
were brace-enclosed.
* Return a reference instead of a copy for performance
This is called many times and showed up after some light
profiling. This change bumped throughput by about 20%
* move out of Graphmol
* move .hpp headers to .h
* update documentation; add label set of atoms test
* Address comments:
- Added references to centres to CIPLabeler.h and Python Wrap.
- Update validation test to skip sanitization.
- Document mancude fractional atomic number calculation.
- Use unittest assertions in python test.
- Update mancude docstrings to 'resonance' instad of 'tautomers'.
- Rename prioritise() to prioritize().
- Add postcondition to check carriers size in Tetrahedral.cpp.
- Use getNeighbors() in Tetrahedral.cpp.
- Move findStereoAtoms to Chirality namespace.
- Move code back into GraphMol.
- Fix typos and reformat doc.
* More comments:
- Mention why we use boost's unordered map rather than the std one.
- Fix include in Python wrapper.
* Addressed second batch of comments:
- fix the bug in rule 4b
- fix docstring for rule 2
- move atomic mass calculation from rule 2 to node
- addressed some build warnings
- simplify sp2bond::label(comp)
- add start/end atoms to Sp2Bond constructor
- update system/local includes
Co-authored-by: Dan N <dan.nealschneider@schrodinger.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>
* 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
* a round of cleanups courtesy of PVS studio
* add a test to make sure that a warning is a false alarm
* bug fix
* Fix a UFF bug
* more PVS studio cleanups
* next round of PVS studio cleanups
* completely remove the chances for that bug
* changes in response to review
* add an additional test
+ a bit of reformatting that snuck in
* 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
* 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
* Potential implementation of copying enhanced stereo groups
Copies the enhanced stereo if all atoms in the reactant
end up in the same molecule of the product with valid
ChiralTags.
Current implementation: Only copy StereoGroup if all atoms are "valid" in the product.
Possible implementation: Copy StereoGroup for all atoms that are "valid" in the product.
Details:
Uses ChiralTag invalidation to decide whether StereoGroup should be copied. If
the product atoms have valid ChiralTag, then the reaction was able to
meaningfully propogate chirality from the reactant to the product. This means
that it is also meaningful to propogate the StereoGroup from the reactant to
the product.
The only exception to this is if the product template defines a specific
absolute configuration for an atom. This means that the reaction defines the
stereochemistry for the atom, so the stereochemistry of that atom is no longer
relative.
If an atom from a reactant StereoGroup appears multiple times in the product,
all copies of that atom are put in the same product StereoGroup.
Still developing test cases.
from rdkit import Chem
from rdkit.Chem import AllChem
# Duplicate a molecule example:
mol1 = Chem.MolFromSmiles('Cl[C@@H](Br)C[C@H](Br)CCO |&1:1,4|')
mol2 = Chem.MolFromSmiles('CC(=O)C')
rxn = AllChem.ReactionFromSmarts('[O:1].[C:2]=O>>[O:1][C:2][O:1]')
for prods in rxn.RunReactants([mol1, mol2]):
for p in prods:
for a in p.GetAtoms():
for k in a.GetPropsAsDict():
a.ClearProp(k)
print(Chem.MolToCXSmiles(p))
Output:
[21:26:08] product atom-mapping number 1 found multiple times.
CC(C)(OCC[C@@H](Br)C[C@@H](Cl)Br)OCC[C@@H](Br)C[C@@H](Cl)Br |&1:6,9,15,18
* Issue 2366: Documentation and fix stereo group invalidation
Adds some documentation to EnhancedStereo.md
Also invalidates StereoGroup if a reaction specifies the
stereochemistry of a center. This destroys the relative
relationship of the center to other centers.
* Demo python file examples for Enhanced Stereochemistry in reactions
This is not intended to be pushed. These probably will become test
cases. For the output looks like this:
0a. Reaction preserves stereo:
[C@:1]>>[C@:1]
F[C@H](Cl)Br |o1:1|
>>
F[C@H](Cl)Br |o1:1|
0b. Reaction preserves stereo:
[C@:1]>>[C@:1]
F[C@@H](Cl)Br |&1:1|
>>
F[C@@H](Cl)Br |&1:1|
0c. Reaction preserves stereo:
[C@:1]>>[C@:1]
FC(Cl)Br
>>
FC(Cl)Br
1a. Reaction ignores stereo:
[C:1]>>[C:1]
F[C@H](Cl)Br |a:1|
>>
F[C@H](Cl)Br |a:1|
1b. Reaction ignores stereo:
[C:1]>>[C:1]
F[C@@H](Cl)Br |&1:1|
>>
F[C@@H](Cl)Br |&1:1|
1c. Reaction ignores stereo:
[C:1]>>[C:1]
FC(Cl)Br
>>
FC(Cl)Br
2a. Reaction inverts stereo:
[C@:1]>>[C@@:1]
F[C@H](Cl)Br |o1:1|
>>
F[C@@H](Cl)Br |o1:1|
2b. Reaction inverts stereo:
[C@:1]>>[C@@:1]
F[C@@H](Cl)Br |&1:1|
>>
F[C@H](Cl)Br |&1:1|
2c. Reaction inverts stereo:
[C@:1]>>[C@@:1]
FC(Cl)Br
>>
FC(Cl)Br
3a. Reaction destroys stereo:
[C@:1]>>[C:1]
F[C@H](Cl)Br |o1:1|
>>
FC(Cl)Br
3b. Reaction destroys stereo:
[C@:1]>>[C:1]
F[C@@H](Cl)Br |&1:1|
>>
FC(Cl)Br
3c. Reaction destroys stereo:
[C@:1]>>[C:1]
FC(Cl)Br
>>
FC(Cl)Br
3d. Reaction destroys stereo (but preserves unaffected group):
[C@:1]F>>[C:1]F
F[C@H](Cl)[C@@H](Cl)Br |o1:1,&2:3|
>>
FC(Cl)[C@@H](Cl)Br |&1:3|
3e. Reaction destroys stereo:
[C@:1]F>>[C:1]F
F[C@H](Cl)[C@@H](Cl)Br |&1:1,3|
>>
FC(Cl)[C@@H](Cl)Br
4a. Reaction creates stereo:
[C:1]>>[C@@:1]
F[C@H](Cl)Br |o1:1|
>>
F[C@@H](Cl)Br
4b. Reaction creates stereo:
[C:1]>>[C@@:1]
F[C@@H](Cl)Br |&1:1|
>>
F[C@@H](Cl)Br
4c. Reaction creates stereo:
[C:1]>>[C@@:1]
FC(Cl)Br
>>
F[C@@H](Cl)Br
4d. Reaction creates stereo (preserve unaffected group):
[C:1]F>>[C@@:1]F
F[C@H](Cl)[C@@H](Cl)Br |o1:1,&2:3|
>>
F[C@@H](Cl)[C@@H](Cl)Br |&1:3|
4e. Reaction creates stereo:
[C:1]F>>[C@@:1]F
F[C@H](Cl)[C@@H](Cl)Br |o1:1,3|
>>
F[C@@H](Cl)[C@@H](Cl)Br
5a. Reaction preserves unrelated stereo:
[C@:1]F>>[C@:1]F
F[C@H](Cl)[C@@H](Cl)Br |o1:3|
>>
F[C@H](Cl)[C@@H](Cl)Br |o1:3|
5b. Reaction ignores unrelated stereo:
[C:1]F>>[C:1]F
F[C@H](Cl)[C@@H](Cl)Br |o1:3|
>>
F[C@H](Cl)[C@@H](Cl)Br |o1:3|
5c. Reaction inverts unrelated stereo:
[C@:1]F>>[C@@:1]F
F[C@H](Cl)[C@@H](Cl)Br |o1:3|
>>
F[C@@H](Cl)[C@@H](Cl)Br |o1:3|
5d. Reaction destroys unrelated stereo:
[C@:1]F>>[C:1]F
F[C@H](Cl)[C@@H](Cl)Br |o1:3|
>>
FC(Cl)[C@@H](Cl)Br |o1:3|
5e. Reaction creates unrelated stereo:
[C:1]F>>[C@@:1]F
F[C@H](Cl)[C@@H](Cl)Br |o1:3|
>>
F[C@@H](Cl)[C@@H](Cl)Br |o1:3|
6e. Reaction splits StereoGroup atoms into two Mols:
[C:1]OO[C:2]>>[C:2]O.O[C:1]
F[C@H](Cl)OO[C@@H](Cl)Br |o1:1,5|
>>
O[C@@H](Cl)Br + O[C@H](F)Cl
>>
O[C@H](F)Cl + O[C@@H](Cl)Br
7. Add two copies:
[O:1].[C:2]=O>>[O:1][C:2][O:1]
Cl[C@@H](Br)C[C@H](Br)CCO |&1:1,4| + CC(=O)C
[17:15:38] product atom-mapping number 1 found multiple times.
>>
CC(C)(OCC[C@@H](Br)C[C@@H](Cl)Br)OCC[C@@H](Br)C[C@@H](Cl)Br |&1:6,9,15,18|
8. Add two copies:
[O:1].[C:2]=O>>[O:1][C:2][O:1]
Cl[C@@H](Br)C[C@H](Br)CCO |&1:1,4| + CC(=O)C
[17:15:38] product atom-mapping number 1 found multiple times.
>>
CC(C)(OCC[C@@H](Br)C[C@@H](Cl)Br)OCC[C@@H](Br)C[C@@H](Cl)Br |&1:6,9,15,18|
* Updates StereoGroup strategy in reactions to copy all possible atoms.
Copy all atoms for which the stereochemistry was not created or destroyed
in the reaction. Any StereoGroup which has at least one atom will appear
in the product.
Also updates the documentation to match this description, and adds C++
and Python tests which fail before this PR and pass after. The Python
tests are more extensive.
Test output was validated by hand (especially the stereo groups
generated. I'm less confident in the reaction processing in my head,
but I truested the existing validation there.)
For future diagnosis: Python unittest failures will look like:
AssertionError: 'F[C@H](Cl)Br' != 'F[C@H](Cl)Br |&1:1|'
- F[C@H](Cl)Br
+ F[C@H](Cl)Br |&1:1|
? +++++++
For future diagnosis: C++ Catch2 failures will look like:
CHECK( MolToCXSmiles(*p) == "F[C@H](Cl)Br |o1:1|" )
with expansion:
"FC(Cl)[C@@H](Cl)Br |&1:3|"
==
"F[C@H](Cl)Br |o1:1|"
* Add a couple of new tests.
* rename "relative" to "enhanced"
some reformatting
* Factor out test helper function.
* Actually, enhanced stereo groups are exposed ot Python
* Added discussion of enhanced stereochemistry in reactions to docs
* Fix new test
* Removes ATOM/BOND_SPTR in boost::graph in favor of raw pointers
* Actually delete atoms and bonds...
* RWMol::clear now calls destroy to handle atom/bond deletion
* Changes broken Atom lookup for windows/gcc
* Adds tests for running with valgrind
* Adds test designed for valgrind and molecule deletions
* Removes RNG, actually tests bond deletions
* update swig wrappers
* deal with most recent changes on the main branch
* Fixes atom documentation
* Fixes#1461
This is a complicated one. Basically URANGE_CHECK when
used on unsigned integers has a problem when the size of
the range it’s checking is 0. The standard operations is
to check
URANGE(num, size-1)
Which (for unsigned integers) obviously rolls over.
This fixes all usage cases to be
URANGE(num+1, size)
And fixes the bugs found. (addBond and the mmff tests)
* Fixes#1461 - Updates URANGE_CHECK to be 0<=x<hi
* 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