Commit Graph

5028 Commits

Author SHA1 Message Date
Paolo Tosco
08cc96336c Enable chemist-friendly depiction of R-groups (#6866)
* - added a convenience function to relabel R-groups in a chemist-friendly fashion
- exposed functionality to MinimalLib through a JSON option at molecule creation time
- added relevant unit tests

* changes in response to review

* added missing library

* fixed Python test

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2023-11-11 07:16:54 +01:00
dehaenw
b58b8f1397 MakeScaffoldGeneric isotope removal (#6855)
* makescaffoldgeneric isotopes

reset the isotope to 0

* add tests

add tests, change hash functions cpp

* correct typo

* fix python test

* correct tests and add anonymous graphs

* Delete rdkit/Chem/Draw/github4763.svg

deleted stray image
2023-11-10 20:26:03 +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
Greg Landrum
74e2d2df86 Allow building DetermineBonds without YAeHMOP support (#6885)
* initial pass

* check that during the CI builds
2023-11-10 20:22:45 +01:00
Greg Landrum
f797113a16 cmake cleanup (#6814)
* add RDKIT_CFFI_STATIC option
minimallib cmake cleanup

* clean up a lot of boost::iostreams nonsense

* find_package(boost cleanup

* update the swig wrappers

* updates to psql

* get the Qt demo working again

* fix? coordgen

* only use std::regex in moldraw2d test

this is consistent with the other tests

* cleanup the serialization stuff too
2023-11-10 15:32:54 +01:00
Greg Landrum
63c7e85046 Update CI, remove some warnings (#6882)
* ci updates

* forgotten update

* inch by inch

* remove unused variable

* try a gcc bump

* get rid of a bunch of unused-but-set errors in clang16

* be more selective

* disable a test in an obsolete module which is mysteriously failing
2023-11-09 13:14:00 -05:00
Gareth Jones
1c33f1a393 RGD: Fix doEnumeration true for cores that are not bundles (#6857)
* Fix doEnumeration true for cores that are not bundles

* Fix doEnumeration true for cores that are not bundles
2023-11-09 15:08:27 +01:00
Rachel Walker
7e8c4ef1cc Add support for writing chirality and stereo in MaeWriter (#6810)
* Add support for writing atom numbering chirality and any double bond stereo in maewriter

* Dan's suggestions
2023-11-09 06:36:11 +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
vslashg
049bff2518 Fix build error when serialization is off. (#6867)
Unlike other files that use the `RDK_USE_BOOST_SERIALIZATION` flag, EvenSamplePairs.h does not  wrap the `BOOST_CLASS_VERSION` boilerplate in an #ifdef.

This happens to work anyway when built against older versions of boost, where the required header is being made visible by other boost includes, but this causes a build breakage when compiled against Boost 1.82 or later and with serialization off.
2023-11-04 05:32:58 +01:00
Greg Landrum
ab152a4ed1 Switch over to using pytest to run the python tests (#5916)
* misc adaptations/modernizations
plus a few changes to allow pytest discovery

* get the recap unittests running

* pytest config updates

* all tests pass

* integrate the pytest stuff into ctest

* integrate Projects dir
better cmake integration

* ci build env updates

* ignore more files

* remove six.py

* cleanup UnitTestPandasTools

* cleanup pytest

* remove obsolete use of rdkit.six from doctests

* update release notes

* mysterious CI fix

* add conftest to remove some tests

* remove the old python-based testing infrastructure

---------

Co-authored-by: Ric <ricrogz@gmail.com>
2023-11-03 14:39:24 +01:00
Greg Landrum
908e47cc03 support generalized substructure search in the SubstructLibrary (#6835)
* support generalized substructure search in the SubstructLibrary

* simplify namespaces

* support the new functionality in the swig wrappers

* update mac swig version in CI

* ensure swig4

* switch mac_java ci builds to conda-forge

* change in response to review

* add copy ctor to extendedquerymol

* Back to the way it was
2023-11-01 14:55:28 -04:00
Gareth Jones
81e9cb2386 Fix stereo bond corruption on RGD. (#6832) 2023-10-28 12:47:58 +02:00
Greg Landrum
4a69bc3493 Fixes #6017 (#6825)
* Fixes #6017

* a bit of cleanup work

* remove unused variable

* change in response to review
switch to using std::max(maxMatches,maxRecursiveMatches)

* test the case where maxSubstructMatches<maxMatches
2023-10-25 04:57:29 +02:00
Meng Wu
173f548f8f Remove redundant argument and variable hasCoreDummies (#6779) (#6786) 2023-10-24 04:54:19 +02:00
Greg Landrum
c49692880c Fixes #6309 (#6824) 2023-10-23 16:56:48 +02:00
Greg Landrum
086d2deab4 remove the deprecated python MolStandardize implementation (#6819) 2023-10-22 05:24:07 +02:00
Greg Landrum
42c09f5237 Fixes #6818 (#6820)
* make sure that a full build and test can work even if boost::iostreams is not being used

Hopefully nobody every actually needs this, but as long as we supply the option, the tests should actually work

* update doctests for that change
2023-10-22 05:23:05 +02:00
Paolo Tosco
30d57ebcaa Implement MinimalLib get_mcs() version that returns JSON (#6812)
* - added StoreAll to parseMCSParametersJSON()
- added get_mcs() to MinimalLib which returns results as JSON
- added tests for get_mcs()

* added test

* changes in response to review

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2023-10-22 05:22:14 +02:00
Paolo Tosco
d9d1fe2838 Fixes #6773 (#6785)
* fixes #6773

* removed unused captures

* update release notes and cmakelists for beta (#6788)

* Removed some code duplication between Depictor.cpp and common.h (#6368)

* - implemented alignOnly mode into RDDepict::generateDepictionMatching2DStructure()
- the allowRGroups option now also supports potentially missing R groups (i.e., R groups that do not match any atom, such as those connected to generic aromatic atoms)
- added the adjustMolBlockWedging parameter (which defaults to true)   to invert/clear molblock wedging information as appropriate
- added unit tests for the above new features
- added RDDepict::generateDepictionMatching2DStructure() overloads taking RDDepict::ConstrainedDepictionParams parameter for convenience
- removed some redundant RDDepict:: namespace specifications

* Fix chirality handling when the chiral atom is the first one in a SMARTS (#6730)

* Set _SmilesStart when parsing SMARTS.

* SmartsWriter should also invert first atoms, like SMILES.

* Update test cases now these SMILES match themselves as SMARTS.

* rerun bison

* cleanup a possible repeated define

* When an atom moves from the first to second position winding should flip in SMARTS (i.e. same as SMILES).

---------

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

* Some small cleanups from the UGM Hackathon (#6744)

* move definition of a couple global constants from a .h to a .cpp

* careful removal of some redundant atom PRECONDITIONS

* careful remove of some redundant ROMol PRECONDITIONS
a bit of additional cleanup

* optimization masquerading as modernization

* some more tidying

* a bit more atom cleanup

* change in response to review

* Fixes #6756 (#6780)

* update release notes and cmakelists for beta (#6788)

* move problematic functions to Chirality namespace

* - implemented alignOnly mode into RDDepict::generateDepictionMatching2DStructure()
- the allowRGroups option now also supports potentially missing R groups (i.e., R groups that do not match any atom, such as those connected to generic aromatic atoms)
- added the adjustMolBlockWedging parameter (which defaults to true)   to invert/clear molblock wedging information as appropriate
- added unit tests for the above new features
- added RDDepict::generateDepictionMatching2DStructure() overloads taking RDDepict::ConstrainedDepictionParams parameter for convenience
- removed some redundant RDDepict:: namespace specifications

* move problematic functions to Chirality namespace

* added missing dependency

* let's check what is going wrong

* CoordGen tests should not run if CoordGen support is not available in the build

---------

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
Co-authored-by: John Mayfield <john@nextmovesoftware.com>
Co-authored-by: greg landrum <greg.landrum@gmail.com>

* Revert "Removed some code duplication between Depictor.cpp and common.h (#6368)" (#6797)

This reverts commit ddfe708b37.

* All 3d des (#6741)

* add function to calc all 3D descriptors

* fix indentation in CalcMolDescriptors3D

* add error handling for 2D molecules

* suggested changes

* change exception type

* add unit tests

* add random seed to conf gen in unit tests

* fix function call in unit tests

* fix expected PMI1 value in tests

---------

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

* _moltoimg() should honor drawOptions.prepareMolsBeforeDrawing (#6792)

* _moltoimg() should honor drawOptions.prepareMolsBeforeDrawing and not run PrepareMolForDrawing if requested not to

* _moltoimg() and _moltoSVG() should honor drawOptions.prepareMolsForDrawing and not call PrepareMolForDrawing if asked not to

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>

* Bad lasso (#6751)

* Better separation of lines.

* Only put atoms in colour list once.

* Test.

* Hash codes.

* Response to review.

* First attempt at fixing stray line.

* Tidier.

* Squared distances.

* tag release (#6801)

* fixes #6773

* removed unused captures

* - fixed comment
- fixed bug found in checkIfRingsAreClosed()

* - removed redundant NRing queries
- added ring size queries to avoid incorrect matches with MCS results originated with MatchFusedRingsStrict

* fixed doctests

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
Co-authored-by: John Mayfield <john@nextmovesoftware.com>
Co-authored-by: Rachael Pirie <56546141+RPirie96@users.noreply.github.com>
Co-authored-by: David Cosgrove <davidacosgroveaz@gmail.com>
2023-10-19 05:01:27 +02:00
Greg Landrum
036f75bca3 Removed some code duplication between Depictor.cpp and common.h (#6799)
* Revert "Revert "Removed some code duplication between Depictor.cpp and common.h (#6368)" (#6797)"

This reverts commit 824616c5b9.

* security blanket: add back tests of the current usage pattern

* - fixed bug in get_sss_json() (#6806)

- added unit test for the above

Co-authored-by: ptosco <paolo.tosco@novartis.com>

---------

Co-authored-by: Paolo Tosco <paolo.tosco.mail@gmail.com>
Co-authored-by: ptosco <paolo.tosco@novartis.com>
2023-10-18 04:04:45 +02:00
Gareth Jones
2f6c80c0ab Exclude MCSParametersInternal from SWIG (#6808) 2023-10-17 18:29:46 +02:00
David Cosgrove
24c11d780f Bad lasso (#6751)
* Better separation of lines.

* Only put atoms in colour list once.

* Test.

* Hash codes.

* Response to review.

* First attempt at fixing stray line.

* Tidier.

* Squared distances.
2023-10-13 15:22:29 +02:00
Greg Landrum
824616c5b9 Revert "Removed some code duplication between Depictor.cpp and common.h (#6368)" (#6797)
This reverts commit ddfe708b37.
2023-10-11 06:42:27 +02:00
Paolo Tosco
ddfe708b37 Removed some code duplication between Depictor.cpp and common.h (#6368)
* - implemented alignOnly mode into RDDepict::generateDepictionMatching2DStructure()
- the allowRGroups option now also supports potentially missing R groups (i.e., R groups that do not match any atom, such as those connected to generic aromatic atoms)
- added the adjustMolBlockWedging parameter (which defaults to true)   to invert/clear molblock wedging information as appropriate
- added unit tests for the above new features
- added RDDepict::generateDepictionMatching2DStructure() overloads taking RDDepict::ConstrainedDepictionParams parameter for convenience
- removed some redundant RDDepict:: namespace specifications

* Fix chirality handling when the chiral atom is the first one in a SMARTS (#6730)

* Set _SmilesStart when parsing SMARTS.

* SmartsWriter should also invert first atoms, like SMILES.

* Update test cases now these SMILES match themselves as SMARTS.

* rerun bison

* cleanup a possible repeated define

* When an atom moves from the first to second position winding should flip in SMARTS (i.e. same as SMILES).

---------

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

* Some small cleanups from the UGM Hackathon (#6744)

* move definition of a couple global constants from a .h to a .cpp

* careful removal of some redundant atom PRECONDITIONS

* careful remove of some redundant ROMol PRECONDITIONS
a bit of additional cleanup

* optimization masquerading as modernization

* some more tidying

* a bit more atom cleanup

* change in response to review

* Fixes #6756 (#6780)

* update release notes and cmakelists for beta (#6788)

* move problematic functions to Chirality namespace

* - implemented alignOnly mode into RDDepict::generateDepictionMatching2DStructure()
- the allowRGroups option now also supports potentially missing R groups (i.e., R groups that do not match any atom, such as those connected to generic aromatic atoms)
- added the adjustMolBlockWedging parameter (which defaults to true)   to invert/clear molblock wedging information as appropriate
- added unit tests for the above new features
- added RDDepict::generateDepictionMatching2DStructure() overloads taking RDDepict::ConstrainedDepictionParams parameter for convenience
- removed some redundant RDDepict:: namespace specifications

* move problematic functions to Chirality namespace

* added missing dependency

* let's check what is going wrong

* CoordGen tests should not run if CoordGen support is not available in the build

---------

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
Co-authored-by: John Mayfield <john@nextmovesoftware.com>
Co-authored-by: greg landrum <greg.landrum@gmail.com>
2023-10-11 06:41:37 +02:00
Greg Landrum
db918d377a Fixes #6756 (#6780) 2023-10-05 20:55:52 +02:00
Greg Landrum
a7c781c107 Some small cleanups from the UGM Hackathon (#6744)
* move definition of a couple global constants from a .h to a .cpp

* careful removal of some redundant atom PRECONDITIONS

* careful remove of some redundant ROMol PRECONDITIONS
a bit of additional cleanup

* optimization masquerading as modernization

* some more tidying

* a bit more atom cleanup

* change in response to review
2023-10-05 06:13:18 +02:00
John Mayfield
dd475b3677 Fix chirality handling when the chiral atom is the first one in a SMARTS (#6730)
* Set _SmilesStart when parsing SMARTS.

* SmartsWriter should also invert first atoms, like SMILES.

* Update test cases now these SMILES match themselves as SMARTS.

* rerun bison

* cleanup a possible repeated define

* When an atom moves from the first to second position winding should flip in SMARTS (i.e. same as SMILES).

---------

Co-authored-by: greg landrum <greg.landrum@gmail.com>
2023-10-05 06:02:49 +02:00
Greg Landrum
9158208cd5 some modernization of the memory handing in the canonicalization code (#6763)
* some modernizations w.r.t. memory

* get rid of more mallocs

* remove a clang warning

* missed one

* response to review
2023-10-03 12:07:14 +02:00
Paolo Tosco
32655f5365 Extract the core matching logic into a separate function (#6754)
* - extracted the core matching logic into a separate function
- added relevant C++ and Python tests

* Update Code/GraphMol/RGroupDecomposition/RGroupDecomp.cpp

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

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2023-09-28 15:21:22 +02:00
Ric
3720c2ceaf Fixes #6703 (#6705)
* add test

* fix the issue

* make imines w/ implicit H unspecified, but allow unknown

* improve test in 6527

* do not mark double bonds as EITHERDOUBLE if no neighbors
2023-09-28 05:16:17 +02:00
Paolo Tosco
0a3fe92528 fixes #6728 (#6755)
Co-authored-by: ptosco <paolo.tosco@novartis.com>
2023-09-27 17:01:53 +02:00
Greg Landrum
1d0050caee Use the connect-the-dots algorithm by default in DetermineBonds (#6740)
* add connect-the-dots option to xyz2Mol

* make connect-the-dots the default
2023-09-26 06:10:20 +02:00
Richard Gowers
4db63b8ec1 Issue 6411 ROMol hasquery (#6739)
* added ROMol::hasQuery

* python bindings for Mol.HasQuery

* at least I checked that my Python tests were running...

* hasQuery use C++11 range iterators
2023-09-25 13:23:37 +02:00
Dan N
2761441b02 Add trans layout for double bonds in rings (#6709)
* Add trans layout for double bonds in rings

If there is a trans double bond in a ring, it's important to
add a trans 2d depiction! This is important for visualization,
but it is also important for chemical accuracy. SDF uses the 2D
coordinates to discern bond stereochemistry, and some 3D embedding
techniques may start from 2D.

Without this commit, trans double bonds in rings invert on
roundtrip through SDF.

Here's a very simple assertion that fails before this commit
and passes after:

    smi = "C1=C/CCCCCCCCCCCC/1"
    assert smi == Chem.MolToSmiles(Chem.MolFromMolBlock(Chem.MolToMolBlock(Chem.MolFromSmiles(smi))))

* Fix "or" keyword to "||".

* Make sure that `embedRing()` signature is unchanged.
2023-09-25 13:19:35 +02:00
Riccardo Vianello
ccf450e236 remove incorrect comment (#6717) 2023-09-15 09:06:07 +02:00
Paolo Tosco
1d9be05a08 fixes failing flexicanvas JS test (#6712) 2023-09-15 09:04:23 +02:00
Paolo Tosco
a23eaf1856 add missing Python parameter and reformat (#6707) 2023-09-15 09:02:27 +02:00
Greg Landrum
83cf752eb0 extract continuous lines from the conrec code (#6676) 2023-09-15 09:00:26 +02:00
Brian Kelley
cccee15a91 Add hasQueryHs (#6702) 2023-09-15 08:59:56 +02:00
David Cosgrove
9249ca5cc8 Make reaction drawings deal with padding properly. (#6686)
* Make reaction drawings deal with padding properly.

* Move large lambdas into anonymous namespace.
Correct totWidth after scaling plusWidth.

* Update some hashcodes.

* Take out debugging setting.  Bugger.

* Padding on height as well.

* Hash codes.

* Delay padding use in flexiCanvas.

* More centring.

* Light grey background in side_by_side table.

* Tweak agents layout for testReactionCoords.

* Fully ignore missing reagents and products.

* Hash codes.

* Const references.

---------

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
2023-09-09 06:46:35 +02:00
David Cosgrove
e4419675c1 Catch meanBondLen of 0.0 (#6699)
* Catch meanBondLen of 0.0

* Change PRECONDITION to ValueErrorExecption.

---------

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
2023-09-08 14:18:26 +02:00
Greg Landrum
99713f9d59 export Mrv{File,Block}IsReaction to python (#6701)
* export Mrv{File,Block}IsReaction to python

* get the MRV writing functions working in python
add basic tests for MRV reading/writing from python

* addition to PR6701

---------

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2023-09-08 11:06:17 +02:00
Ric
052d48e34e patch + test (#6697) 2023-09-08 06:45:24 +02:00
Ric
ea06500c5d Allow some tolerance in flatness determination (#6696)
* allow a minimal z tolerance in flat structures

* allow tolerance in Z coordinate

---------

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2023-09-07 16:50:56 +02:00
Greg Landrum
85cb6feafb expose the CDXML reaction parsers to python (#6700) 2023-09-07 15:00:15 +02:00
Greg Landrum
91d32dda50 fix order of cleanupOrganometallics() in sanitizeMol() (#6690)
* fix order of cleanupOrganometallics in sanitizeMol

* make sure cleanupOrganometallics() works on non-sanitized molecules
2023-09-07 12:58:03 +02:00
Ric
90d22c94c5 Fixes #6664 (#6692)
* add some testing

* fix issue

* update doctests
2023-09-07 12:32:38 +02:00
Greg Landrum
59fa87a207 make sure bond attachpt info is pickled (#6698)
* store more bond properties (if present) when pickling

* store the attachpts stuff more efficiently in pickles

* better error reporting in the cartridge

* updated cartridge use cases
2023-09-07 12:21:36 +02:00
Greg Landrum
4be7b2a169 we should not be doing adjustqueryprops by default in the cartridge (#6680) 2023-09-05 12:22:55 +02:00