135 Commits

Author SHA1 Message Date
Yakov Pechersky
0986d22c58 Deterministic kekulize, independent of atom and bond order (#9125)
* Make kekulization deterministic

* Add tautomer order-independence regression (python)

* Adjust tautomer tests for deterministic kekulization

* Update graphmol wedged-bond kekulization checks

* SmilesParse: update aromatic bond index expectations

* SmilesParse: refresh cxsmilesTest expected files

* Depictor: update testDepictor expected MolBlocks

* Depictor: update depictorCatch expectations

* Depictor Wrap: update expected MolBlock for pyDepictor

* MarvinParse: update testMrvToMol expected outputs

* FileParsers: refresh testAtropisomers expected outputs

* FileParsers: update tests for deterministic kekulization

* MolDraw2D: refresh brittle bond assertions

* RascalMCES: update expected cluster size

* MinimalLib: make cffi wedging check order-independent

* documentation fix

* MinimalLib: update Kekulé bond table in aligned-coords test

* Hoist duplicated lambdas to TEST_CASE scope

* Remove unused originalWedges variable

* Remove redundant bounds check; clarify wedge-end preference

* Pre-sort allAtms by wedge-end + rank

* Use mol.atomNeighbors() for neighbor iteration

* Check inAllAtms before linear-scanning done

* Drop redundant optsV/wedgedOptsV sorts

* Remove unused Canon.h include

* Add canonical parameter to Kekulize; skip ranking during sanitization

* Test canonical re-kekulization preserves stereo across atom orderings

* MinimalLib: update Kekulé bond orders in invertedWedges

* Change Kekulize canonical default to false, expose in Python wrappers

* keep rank order, push_back

* Revert "RascalMCES: update expected cluster size"

This reverts commit a81bb39495.

* docstring change

* expose new flag to python wrapper

* document changes in ReleaseNotes.md

* revert minimallib test changes again

* canonical = true defaults

* Revert "revert minimallib test changes again"

This reverts commit 039e1d84da.

* Reapply "RascalMCES: update expected cluster size"

This reverts commit 7b83a7a3e8.

---------

Co-authored-by: greg landrum <greg.landrum@gmail.com>
2026-03-19 08:43:13 +01:00
Ricardo Rodriguez
474df5a9a8 Exclude Zero order bonds from FindRingFamilies() and add arguments for includeDativeBonds, includeHydrogenBonds (#9118) 2026-02-20 19:54:13 +01:00
Ricardo Rodriguez
d9850596aa Fixes #8726 (#8874)
* 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>
2025-10-17 16:51:22 +02:00
Ricardo Rodriguez
af4e8cf01f propagate string_view (#8858) 2025-10-14 19:15:37 +02:00
tadhurst-cdd
ca41fa5bfd Add SCSR parsing to RDKit (#8147)
* Parsing SCSR

* add scsrol to mol

* removed bad include file

* loosen distGeom test slightly

* add wrap test for SCSRMol

* Add test for scsr in python

* tests added for scsr and strict parsing removed

* remove extra stuff

* More fully specified use of SCSRMol for PR CI build

* Added flags for SCSR expansion to not include any leaving groups

* Added MolFromScsrParams to Wrap for python

* added SCSRMol destructor

* Added two tests for RNA macromols, and fixed a bug they revealed

* Added new tests abd expected files

* changes as per PR review

* SCSR Chnages for leaving groups

* fixed testScsr.py

* hydrogen bond treatment

* in SCSR expand, allow Hbond to be autoatically detected

* changes as per code review

* Adding new test file

* chages for SCSR contructors, destructors for CI build

* fixed pyton for SCSR hydrogen bond modes, and added tests

* Added new test files

* fixed edge case for SCSR

* fix checksum for inchi

* consistent capitalization of SCSR throughout

* switch to enum class

* make things shorter

* simplify

* get rid of the ATTCHORD class

* New section for SCSR in RDKit_book

* addeed section to RDKit_Book

* SCSRMol is no longer exposed in Python

* fix leak in MolFromSCSRFile()
light refactoring

* expose MolFromSCSRFile() to python
make the MolFromSCSR functions work with default args
a bit more testing

* removed C++ access to SCSRMol

* CXMsiles now ouputs hbonds, fix to template matching, and a few other things

* Addl fix for bad aromaticity in Hbond rings

* Test files needed

* Test files needed

* try to fix a CI build errors

* CI error fix

* Added missing test file

* CMake version - for CI build

* remove full file compoarison from macromol test file

* accidental change to debug restored to release

* Code review changes

* As per PR review

---------

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2025-05-14 13:37:59 +02:00
Greg Landrum
8ea8ec5e3f Fixes #7983 (#8342)
* Fixes #7983

move the call to cleanupAtropisomerStereoGroups() into assignStereochemistry()

* Additional tests from @susanhleung in #8323

* more testing

* changes in response to review

* changes for review
2025-03-20 07:40:33 +01:00
Greg Landrum
b40f99eee3 Fixes #8304 (#8316)
* 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>
2025-03-04 14:56:08 +01:00
Greg Landrum
fa048eacc5 Replace GetImplicitValence() and GetExplicitValence() with GetValence() (#7926) 2025-01-28 21:09:03 +01:00
Paolo Tosco
8c1bf34ed7 implemented JSON parsers for SanitizeFlags and RemoveHsParameters for CFFI and MinimalLib (#8000)
Co-authored-by: ptosco <paolo.tosco@novartis.com>
2024-11-16 05:16:25 +01:00
Greg Landrum
cf29f0895f Documentation updates (#7933)
* doc updates

* add rdShapeAlign to the docs

* fix shape docs

* let's not add too much here, revert deprecation

* response to review
2024-10-19 17:19:59 +02: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 Cosgrove
293328845b Add overloads of MolOps::getMolFrags and MolOps::getMolFragsWithQuery (#7823)
* Add overloads of getMolFrags and getMolFragsWithQuery that fill in using std::unique_ptr rather than boost::shared_ptr.

* Response to review - do things in unique_ptrs from the outset rather than raw pointers.

---------

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
2024-09-20 09:48:08 +02:00
Juuso Lehtivarjo
9824a9d964 Expose MMFF aromaticity model for SetAromaticity (#7765)
* Expose MMFF aromaticity model for SetAromaticity

* Test, backward compatibility, missing AromaticityModel wrapper
2024-09-18 05:59:02 +02:00
Greg Landrum
b1663052b8 Remove Descriptors as a dependency of many other RDKit libraries (#7700)
* 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>
2024-08-13 13:22:43 +02:00
Greg Landrum
db952786b6 Expose a couple of additional functions to Python (#7444) 2024-05-17 04:47:30 +02:00
Greg Landrum
01ec60a856 Fixes #7078 (#7155)
* add MolOps::expandAttachmentPoints, along with tests

* support expandAttachmentPoints in the mol file parser

* switch the v2 stuff in the guts of the reaction parser

* add collapseAttachmentPoints()
add addAsQueries option to expandAttachmentPoints()

lots of testing

* an edge case and some cleanup

* add python wrapper for those two functions

* Update Code/GraphMol/FileParsers/FileParsers.h

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

* changes in response to review

- support addCoords in expandAttachmentPoints()
- support the new attachment point stuff to/from CXSMILES
- add MolOps::details::addExplicitAttachmentPoint() and MolOps::details::isAttachmentPoint() utility functions

---------

Co-authored-by: Ric <ricrogz@users.noreply.github.com>
2024-02-28 17:05:53 +01:00
Paolo Tosco
a4c9ef9e56 Fix #7157 (#7166)
* - fix #7157
- add the assignCIPLabels flag to MinimalLib's mol_from_input()
- added cffi and JS tests
- refactored process_details(), process_mol_details() and process_rxn_details() to take a struct reference as parameter rather than a long list of parameters
- this also allowed to get rid of one of the ugly GET_JSON macros
- exposed panelWidth, panelHeight and noFreetype (the latter is useful for testing)
- made width and height to default to -1 in mol_to_svg since we now support flexicanvas

* added a bunch of assignments I'd forgotten in the deprecated process_mol_details() overload

* MSVC does not like inner functions

* updated docstrings

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2024-02-22 13:31:30 +01:00
tadhurst-cdd
d5d4d194ec atropisomer handling added (#6903)
* 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>
2023-12-22 04:58:18 +01:00
Paolo Tosco
36deaefb07 Fixes #6816 (#6827)
* fixes #6816

* cover the case where `CFG=0` is specified, which was missing

* roundtripping a CTAB should not change a cis/trans double bond into a crossed bond after calling reapplyMolBlockWedging(), no matter if the molecule is sanitized or not

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2023-11-10 20:23:15 +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
Brian Kelley
cccee15a91 Add hasQueryHs (#6702) 2023-09-15 08:59:56 +02:00
Jonathan Bisson
8a2d034f8f Add a new parameter to mol_adjust_query_properties for generic query parameters (#6332)
* Add a new parameter to mol_adjust_query_properties for generic query parameters (#46)

Adds a new parameter to mol_adjust_query_properties:"setGenericQueryFromProperties"
that defaults to false (so no change of behavior until used).

This PR also removes the previous way of doing it that involved reprocessing the query molecule for every comparison.

On datasets of 200k molecules the speed-up is between 2 (large complex substructure searches with repeating units) to 5 times (tiny substructures search).

Add support for generic query in PG cartridge

* Add generic groups to the lib

* Move the querying with generic groups out of MolOps to not bloat the library.

* Fix Python calls

* Update doc

* Proof that last 3 commits are mine.

* Fix missing headers

* Fix typo

* Fix call

* Fix calls

* suggested changes

* Update Code/GraphMol/GenericGroups/GenericGroups.h

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

* Add adjustquery test with default parameters.

---------

Co-authored-by: greg landrum <greg.landrum@gmail.com>
2023-08-03 15:41:43 +02:00
David Cosgrove
2d881e0abb Fix cleanupOrganometallics and reinstate to sanitisation (#6357)
* Fix canonically correct single to dative bond conversion for organometallics.

* Cleanups from review.

* Process atoms in canonical order.
Extra test.

* Only do the expensive bit if there's something to fix.

---------

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
2023-05-23 09:49:40 +02:00
Greg Landrum
7c93c02205 remove cleanupOrganometallics() from the default sanitization (#6292)
* remove cleanupOrganometallics() from the default sanitization

* doc update
2023-04-14 08:49:26 +02:00
Greg Landrum
93428d5048 Do not include dative bonds in ring finding by default (#6231)
* change default behavior so that dative bonds are not included in ring finding

* make sure that generating 2D coords does not lose the rings

* cleanup some leftover problems
2023-03-30 18:09:24 +02:00
David Cosgrove
5fe20d270f Improved handling of organometallics (#6139)
* First stab at disconnecting organometallics the Syngenta way.

* Add support for Li and Na compounds, with tests.

* Correct docstrings.

* Add -1 valence to sodium.

* Add changes from PR 5997.

* Move declaration of disconnectOrganometallics.

* Re-factor tests for disconnectOrganometallics to read V3000 files rather than hard-code in file.

* Add optional options to constructor.

* Python wrapping for disconnectOrganometallics.

* Python tests.

* Correct docString.

* Test using in place overload of disconnect free function.

* options_ should not be a reference.

* Re-work the wrappers.

* Added test MOL files.

* Correct charge on iron atoms.

* Fix tests for charged iron.

* Added some more test complexes.

* Port Marco's oxidation number Python to C++ Descriptor.

* Rename functions.

* Another test.

* Python wrappers.

* Comment in test.

* Throws exception if atom-based function called with non-kekulized parent.

* Fix typo.

* Allow potassium as well.

* Whole molecule calculations for oxidation number only.
Rename prop to OxidationNumber.

* Add OxidationNumber to common_properties.

* Extra comment.

* When deleting atom, update any ENDPTS props on bonds.
Copied in from stale PR ExtraDoc.

* Added hapticBondsToDative with python wrapper.

* Extra test.

* Re-factor endpts parsing.

* Typo.

* Add function for haptic end points inc. Python wrapper.

* Add dative bonds in separate step.

* C++ version of dativeBondstoHaptic.

* Update test mols.

* Python wrapper.

* Fix indents in Python test script.

* Corrected expected test result.

* Only do non-metal to metal conversion of single bond to dative if the explicit valence of the non-metal allows it.

* Fix test broken in a non-material way by previous change.

* Export for DLL.

* Remove redundant function declaration.

* Dave hates Windows.

* Move hapticBondEndpoints to Molops::details.

* And take it out of the Python wrappers.

* Run yapf on reformatted test script.

* Get the DLL builds going.

* addDativeBond -> addHapticBond.

* Batch edits.

* Position arithmetic.

* setQuery.

* Dummy positions for all confs.

* Fix tests for dummy positions for all confs.

* Move tests to catch_organometallics.cpp.

* Modern docString.

* Change member variable names.

* sProp length, bonus batchEdit.

* Add options object to disconnectOrganometallics.

* Tidied license.
Atom precondition.

* GetIntProp.

* Test opts aren't defaults.

* Python wrapper for disconnectOrganometallics with options.

* Minor edit.

* Slightly random attempt to fix Java build.

* Response to review.

* Another stab at the doc strings.

---------

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2023-03-18 04:36:38 +01:00
David Cosgrove
42782d31cf Change IUPAC metal->non-metal single bonds to dative (#6038)
* Change atom to metal bonds from single to dative if appropriate.

* Pedantic change whilst I was in the area.

* Reinstate all tests, leave in debugging writes to see failing tests.

* Re-did it.  Failing tests now pass.

* Move any positive charge from the non-metal to the metal.
Fix expected test results.

* Write dative bond to JSON.

* Bump currentRDKitJSONVersion to 11, but allow parser to still read 10.

* Only move 1 unit of charge at a time from non-metal to metal.

* Greg's hack to not do it for O+ and N+ etc.
Explicitly exclude H, He, F, Ne from dative bonds.
Fix tests.

* Update expected PostGres json version to 11.

* suggestions for PR

* Correct comment.

---------

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
Co-authored-by: greg landrum <greg.landrum@gmail.com>
2023-02-06 04:37:32 +01:00
Greg Landrum
fd44d72fb7 Fixes #5849 (#5861)
* Fixes #5849
This may not be the best fix since it adds another step to canonicalization

* more test cases

* update docs
2022-12-28 20:10:13 +00:00
Greg Landrum
42eed2605d Add CXSMILES support for bond wedging and wiggly bonds (#5575)
* initial support for wiggly and wedged bonds in cxsmiles
add CX_ALL_BUT_COORDS convenience option to CXSMILES writer

* move ClearSingleBondDirFlags to MolOps

* do a better job of handling the wiggly bonds

* mark 3D conformers from CXSMILES

* remove some extraneous printing

* test wD as well

* remove non-applicable test

* basic tests (not passing) for parsing t/c/ctu

* remove test for unimplemented feature

* changes in response to review

* changes in response to review

check for attempt to set the wedging more than once
testing for invalid w blocks
fix a bad comment
2022-09-24 05:44:01 +02:00
Gareth Jones
cc613ba660 By default mergeQueryHs now will not remove isotopes (#5563) 2022-09-16 17:29:32 +02:00
Greg Landrum
c1f68ea574 Fixes #5505: problems when kekulizing molecules with query bonds (#5550)
* Fixes #5505

* Switch to using hasBondTypeQuery()

* update the docs

* ensure we still fail with non-ring aromatic atoms

* changes in response to review
2022-09-13 14:49:45 +02:00
Eisuke Kawashima
77db9ede80 fix doxygen comments (#5254) 2022-07-11 13:55:35 +02:00
Ric
b06bd882c7 Allow removal of non-special H atoms in SGroups (#5399)
* 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>
2022-07-07 11:05:18 +02:00
Greg Landrum
fbaa6fd36c Fixes #5307 (#5310)
* Fixes #5307

* python doc string
2022-06-09 06:11:17 +02:00
Greg Landrum
cd74dc2207 Initial support for non-tetrahedral stereochemistry (#5084)
* 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
2022-05-20 09:07:16 +02:00
Greg Landrum
f0cf0b0f20 Fixes #4789 (#4790) 2021-12-13 14:15:26 +01:00
Greg Landrum
5215914bb9 Do the deprecations for the 2022.03 release (#4626)
* remove deprecated useCountSimulation argument

* remove the mol_from_smarts() function from the cartridge

* remove the balabanj

* a couple final cleanups to the countSimulation thing

* document changes
2021-11-04 04:25:05 +01:00
Greg Landrum
e970148830 Allow applying single-reactant/single-product reactions in place (#4511)
* 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
2021-09-26 14:35:23 -04:00
Greg Landrum
df72c241c5 Improve test coverage and some bug fixes (#4536)
* test getIdOfEntryWithBitId()

* remove unused functions

* improve bv tests in python wrapper

* more UniformGrid tests

* improve deprotect coverage

* improve abbreviations coverage

* add operator!= to DeprotectData

* more testing for adjustQueryProperties

* fix a copy-paste bug

* copy-paste bug

* more testing

* more testing

* more testing

* fix an edge case bug in getValenceContrib

* more bond tests

* add operator!= to StereoInfo
tests StereoInfo::operator==

* make some internal functions testable

* more testing

* minor code cleanup

* fix some bad caching behavior in getDistanceMat() and get3DDistanceMat()

testing

* test FixeMolSizeMolBundle() copy ctor

* deprecate BalabanJ

* more testing

* testing

* mods to get things working for windows DLL builds
(don't bother running some of the tests there)

* fix a typo
2021-09-26 07:45:06 +02:00
jasondbiggs
5065340b20 a few doxygen comment fixes (#4368)
* collection of doxygen fixes

* more files with fixed doxygen comments

* more doxygen fixes

* more doxygen fixes

* last set of doxygen comment fixes

Co-authored-by: Jason Biggs <jasonb@wolfram.com>
2021-08-09 04:58:01 +02:00
Greg Landrum
1702a227e2 Fixes #3998 (#4248)
* add KekulizeFragment()

more testing wouldn't be bad

* oversight

* Fixes #3998
2021-06-19 06:00:45 +02:00
Paolo Tosco
0e3aa77fd0 Make sure that added R-groups have non-zero coordinates (#3877)
* 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>
2021-03-19 08:17:56 +01:00
Gareth Jones
81d3705358 R group match any issue (#3767)
* 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>
2021-03-10 12:56:42 +01:00
Greg Landrum
5747c4f283 Issue a warning when embedding a molecule with no Hs (#3807)
* 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
2021-02-22 06:57:50 +01:00
jasondbiggs
3438b72c39 Fix comment to match the code in RemoveHsParameters (#3747)
* removeNonimplicit is the opposite of the deprecated option implicitOnly, fix the comment to reflect that.

* fix docstring to match function argument type

Co-authored-by: Jason Biggs <jasonb@wolfram.com>
2021-01-20 16:53:29 +01:00
Paolo Tosco
24e644dd29 Add better support for isotopic Hs to removeHs() and addHs() (#3396)
* 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>
2020-09-24 05:09:42 +02:00
Greg Landrum
b55376f284 Adds more options to adjustQueryProperties (#3235)
* add documentation

* backup

* first pass at 5-rings working

* add a static method to initialize an empty parameter object

* expose static method to python

* additional testing

* support the single bond adjustments

* cleanup

* preserve the symbol used in the query from a CTAB

* support the way the MDL code adjusts five-ring aromaticity in query rings

* in-code documentation

* while we're at it, cleanup the way Q and A atoms are handled in the v3k parser

* changes in response to review

* make this C++14 again.

* change in response to review
2020-06-22 09:17:50 -04:00
Greg Landrum
dc36ff437f Fixes #3231 (#3233)
* Fixes #3231

* DOCS: make the documentation for assignStereochemistry() more complete
2020-06-19 04:50:19 +02:00
Eisuke Kawashima
e86e2c1d5d Modernization: use nullptr (#3143) 2020-05-25 09:40:01 +02:00
Greg Landrum
95613b6279 Allow SubstanceGroups to survive molecule edits (#3170)
* 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
2020-05-19 17:35:08 +02:00