Commit Graph

199 Commits

Author SHA1 Message Date
Riccardo Vianello
ccf450e236 remove incorrect comment (#6717) 2023-09-15 09:06:07 +02:00
Ric
052d48e34e patch + test (#6697) 2023-09-08 06:45:24 +02:00
Ric
90d22c94c5 Fixes #6664 (#6692)
* add some testing

* fix issue

* update doctests
2023-09-07 12:32:38 +02:00
Ric
8176f5c962 Fail CI builds on compiler warnings + some fixes (#6675)
* enable Werror on Mac and Linux

* do not fail on boost multiprecision pessimizing move

* fix eigen array_bounds warning

* Fix unused arg in Rascal MCS

* fix range-loop-construct warning in Rascal MCES

* fix sign mismatched comparison

* drop unused lambda capture

* allow FMCS timeout test more time under Debug (not a warning!)

* fix fwd declaration of struct RascalClusterOptions

* fix deallocator mismatch

* fix two minor leaks

* fix a real leak

* more minor leaks

* fix another real leak, plus some potential ones

* fix std::move preventing copy ellision

* allow longer run time for debug builds

* make maxBondMatchPairs and getLargestFragSize unsigned int

* make snake case camel case

* update to current master, fix new warnings

* update again and more fixes

* add #include <optional>

* fix char array deallocation

* update and fixes in Marvin writer

* unsigned int

* more copy ellision fixes

* more copy ellision fixes, and typos

* and some more
2023-09-02 04:38:45 +02:00
Jonathan Bisson
eec44e4171 Support additional generic groups (#6570)
* Add search groups (#32)

Tracker story: 184574393 - Support additional query features [1]

All the special groups and atom from the Ketcher extended table are now supported in RDKit. The newley added ones include:
ABH, ACH, AEH, AHH, ALH, AOH, ARH, AYH, CAH, CBH, CEH, CHH, CXH, CTH, G, G*, GH, GH*, R, and the atom query types D, T, H+., and Pol

* Fix tests

Remove Marvin specific code

* Fix windows build

* Fix windows build

* Remove atom matches

* Remove test

* Fix doc

* Update Code/GraphMol/GenericGroups/GenericGroups.h

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

* Update Code/GraphMol/GenericGroups/GenericGroups.h

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

* Update Code/GraphMol/GenericGroups/GenericGroups.h

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

* Update Code/GraphMol/GenericGroups/GenericGroups.h

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

* Update Code/GraphMol/GenericGroups/GenericGroups.h

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

* Update Code/GraphMol/GenericGroups/GenericGroups.h

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

* Update Code/GraphMol/GenericGroups/GenericGroups.h

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

* Update Code/GraphMol/GenericGroups/generic_tests.cpp

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

* Update Code/GraphMol/GenericGroups/generic_tests.cpp

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

* Update Code/GraphMol/GenericGroups/GenericGroups.h

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

* Added test for groups added manually to a query
as per PR review suggestion

* stop reading generic groups as atomnull queries

---------

Co-authored-by: tadhurst-cdd <112502803+tadhurst-cdd@users.noreply.github.com>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
Co-authored-by: Tad Hurst <tad.hurst@collaborativedrug.com>
2023-08-10 06:36:38 +02:00
thomp-j
7053e97a15 Fix vulnerabilities found by fuzzer. (#6579)
* Fix vulnerabilities found by fuzzer.

* Fix Typo in RWMol.cpp

* Update RWMol.cpp

This is an attempt to double check where the test failure is coming from.

* Update RWMol.cpp

Re-adding changes to test tests.
2023-08-06 06:33:08 +02:00
Ric
d033aee043 Optionally forward Enhanced Stereo Group ids (#6560)
* add id members to StereoGroup class

* add optional read id argument to StereoGroup constructors

* add functions forward Stereo Group Ids and assign the missing ones

* update ops updating stereogroups to forward read id

* update CX Smiles to parse/write stereogroup ids

* Add test cases for stereo group id forwarding/canonicalization

* update mol block (V3K only) to parse/write stereogroup ids

* update pickling to parse/write stereogroup ids

* update cdxml parser to store stereogroup ids

* update mol interchange to parse/write stereogroup ids

* update draw code with new stere group ids

* update test

* add some tests

* Update Code/GraphMol/Wrap/rdmolfiles.cpp

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

* Update Code/GraphMol/Wrap/rdmolfiles.cpp

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

* Update Code/GraphMol/Canon.cpp

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

* Update Code/GraphMol/SmilesParse/CXSmilesOps.cpp

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

* review

---------

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2023-07-27 18:53:40 +02:00
Jonathan Bisson
12e23a62d2 Add support for dative bonds in MOL files (#6566)
* Add support for dative bonds in MOL files

Dative bonds cannot be read in mol files V2000.
(really not supposed to be, but some software systems put them in there anyway)

* Add documentation about dative bonds in V2000

* suggestion from review

---------

Co-authored-by: Tad Hurst <tad.hurst@collaborativedrug.com>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2023-07-21 08:43:23 +02:00
Timothy Ngotiaoco
1b8b7d1cb4 Fixes #6395: Move string index appropriately with molfiles (#6402)
* Fixes #6395: Move string index appropriately with molfiles

This code gives a fix to issue #6395, where properties lines in molfiles might not be processed correctly when dealing with pairs of values.

* Update tests to reflect molblock parsing changes
2023-05-31 06:14:50 +02:00
Greg Landrum
bfea269b38 Fixes #6241 (#6257)
* handle the cases when the flag is set

* add python wrapper

* Fixes #6241

update and finish?

* set the chiral flag to 0 in the mol file parsers

* adjust to the chiral flag always being present

* add note
2023-04-13 15:38:29 +02:00
Gareth Jones
a5e9d63d3c ReactionFromRxnBlock fails on bond with reacting center status set (#6199)
* Fixed bug in MolFileParser::toInt.  Added test

* Also fix MolFileParser::toUnsigned

* ToInt and ToUnsigned to return 0 when parsing blank string

* Update Code/GraphMol/FileParsers/MolFileParser.cpp

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

* Update Code/GraphMol/FileParsers/MolFileParser.cpp

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

---------

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2023-03-16 17:39:47 +01:00
Greg Landrum
286cb21302 Allow unrecognized atom types when strictParsing=False (#5891)
We should just read them in as dummies instead of throwing an exception.
A bit of light refactoring to accompany that
2022-12-28 08:25:34 -05:00
Eloy Félix
fde09f5f47 Fix #5810 in V2000 mol files. (#5864)
* fix #5810 for V2000

* fix #5810 for V2000

* fix #5810 for V2000

* fix #5810 for V2000

* fix test molfile indentation
2022-12-14 14:58:04 +01:00
Greg Landrum
2c16e09796 Fixes #5718 (#5825)
* add test

* Fixes #5718
2022-12-02 14:58:32 +01:00
Greg Landrum
f37abdd75c Fixes #5810 (#5811)
* Fixes #5810

* expand the test
2022-12-01 17:11:00 +01:00
Greg Landrum
2640819383 Fixes #5763 (#5764)
* Fixes #5763

* another test
2022-11-16 08:29:44 -05: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
Ric
0d8ea2aec1 Fixes #5423 (#5424)
* fix

* always remove molTotValence
2022-07-13 05:36:54 +02:00
Greg Landrum
fbbddc6035 Start using string_views in the file parsers (#5301)
* slow steps towards a string_view experiment

* Move first set of file-handling code to use string_view
This is about 12% faster on my machine

* oops, yaehmop had not been updated to C++17

* start moving v3000 over

* disable storing string_views in Dicts.

* a bit more optimization

* get windows builds working

* fix a couple leaks in the test code

* changes in response to review

* changes suggested in review
+ more refactoring

* fix an oversight

* remove another one

* remove debugging numbers
2022-06-14 17:18:40 -04:00
Greg Landrum
d640eb98c9 [WIP] Fixes #5327 and #5328 (#5330)
* Fixes #5328
Fixes #5327

probably a good idea to add a bit more testing here

* more tests!
2022-06-01 04:45:14 +02:00
Greg Landrum
6e5b01200b Add support for Pol and Mod pseudoatoms (#5264)
* reading pseudoatoms

* basics of writing

* switch to using dummyLabel to make this consistent
add cxsmiles read/write support
2022-05-07 11:10:57 +02:00
Sreya Gogineni
757d088157 Fixes #5165 (#5209)
* Improved regex whitespace handling

Change was made in the parseEnhancedStereo function

* Files for Github #5165 test case

Both files use enhanced stereochemistry, but differ in whitespace content

* Test case for Github Issue #5165

Catches whitespace parsing error

* Improves test case check

Makes test case more specific, less prone to potential invalid access to container

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

* Improves test case check

Makes test case more specific, less prone to potential invalid access to container

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

* Update test case "Github #5165"

Add 'require(mol)' to confirm valid molecule before additional testing

* Cleans up test for Issue #5165

* Cleans up test for Issue #5165

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2022-04-17 17:35:43 +02:00
Paolo Tosco
67d8dd3dcd Add a couple of depiction helper functions and some JS bindings (#5115)
* - adds normalizeDepiction() and Python wrappers
- adds straightenDepiction() and Python wrappers
- adds an early check for R-labels to be in the accepted range to avoid throwing an exception later on
- adds a kekulize flag to process_details() to enable depicting molecules which fail to kekulize from JavaScript
- adds JavaScript functions to get fingerprints as Uint8Array
- adds JavaScript function to generate pickled molecule as Uint8Array
- adds JavaScript function to restore molecule from Uint8Array pickled
- adds has_coords() JavaScript function
- adds set_new_coords() to set JSMol coordinates in-place
- adds get_mol_copy() to obtain a JSMol copy

* fix build failures

* changes in response to review

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2022-03-22 14:18:30 +01:00
Eisuke Kawashima
ba6d8e0d3b clang-tidy: readability-simplify-boolean-expr (#4639) 2022-03-17 13:50:50 +01:00
Greg Landrum
8390dfd181 Fixes #4785: aromatic bonds no longer set aromatic flags on atoms (#4806)
* preliminary

* all tests pass

* cleanup

* more testing!

* we do still want to raise errors for aromatic atoms not in rings
fix one missed change for mol blocks

* update expected results for psql test
2021-12-17 10:26:59 +01:00
Greg Landrum
d20e5cadc8 Fixes #4561 (#4562) 2021-09-27 04:48:59 +02:00
Greg Landrum
58e6743df0 Fixes #4468 and #4476 (#4482)
* stop removing substance groups with replaceAtom()
change default for keepSGroups argument to replaceBond()

* enable logging output for the fileparserscatch

* basics of parsing SMARTSQ SubstanceGroups

* Fixes #4476
test coming in the next commit

* handle multi-atom SMARTS as recursive
more testing
Test #4476

* a bit of cleanup

* get the tests working

* additional testing

* Update Code/GraphMol/FileParsers/MolFileParser.cpp

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

Co-authored-by: Ric <ricrogz@users.noreply.github.com>
2021-09-05 05:43:13 +02:00
Ric
c0923565e4 Fixes #4473 (#4474)
* allow MRV_COORDINATE_BOND_TYPE sgroups to reference bonds

* update to match Marvin behavior (always use bonds)
2021-09-04 16:55:55 +02:00
Greg Landrum
69b143edd0 Swap from RDUNUSED_PARAM to unnamed parameters (#4433)
* cleanup

* more cleanup
2021-08-24 17:19:46 -04:00
Ric
6b1a2eead3 Turn MRV_COORDINATE_BOND_TYPE data Substance Groups into coordinate bonds (#4299)
* add test

* add fix

* document wrapper

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2021-07-07 06:13:17 +02:00
Greg Landrum
2f8079f563 Fixes #4256 (#4269)
* Fixes #4256

* the V2000 part of the fix
2021-07-01 15:15:22 +02:00
Greg Landrum
5d0eb77c65 allow more recoverable SGroup errors when strictParsing=false (#4210) 2021-06-07 15:39:49 +02:00
Greg Landrum
c02e53d7aa Fixes #4099 (#4132)
Fixes #4131
2021-05-12 12:40:17 -04:00
Greg Landrum
193f27730c make sure atom and bond bookmarks survive replaceAtom/Bond (#4033)
* make sure atom and bond bookmarks survive replaceAtom/Bond

* fixes oss-fuzz #30572

* fix possible memory-access error in error reporting

* more defensive deserialization

* switch that recursive smarts error handling to not use an exception
2021-04-16 04:54:09 +02:00
Greg Landrum
0f6da8d3b6 allow short atom lines in mol blocks when strictParsing is disabled (#3961) 2021-03-23 04:42:43 +01:00
Greg Landrum
36c7c04344 basic h bond support (#3871) 2021-03-06 09:39:13 -05:00
Paolo Tosco
4084284ba5 Make better use of strictParsing for SGroups (#3705)
* - eliminate some documentation ambiguity about the role of the strictParsing flag
- fix some inconsistencies between SGroup parsing function prototype declarations and implementations
- add a workaround for accepting malformed V2000 'M  SAP' entries affecting older version of MarvinJS (only if strictParsing is set to false)
- if strictParsing is set to false, malformed V2000/V3000 SGroups are ignored rather than causing the parsing to fail
- fix a couple typos in warnings

* changes in response to review
2021-01-14 10:29:41 +01:00
greg landrum
7564a4af8b Merge branch 'feat/bond_query_drawing' of https://github.com/greglandrum/rdkit into greglandrum-feat/bond_query_drawing 2020-12-17 06:43:49 +01:00
Greg Landrum
b82b3c0695 Fixes #3620 (#3621) 2020-12-09 04:37:13 +01:00
greg landrum
55bc8d7ec1 backup 2020-12-08 15:39:45 +01:00
Paolo Tosco
7d0d7df5f0 Fixes a number of issues flagged by clang (#3498)
* - fixes a number of issues flagged by clang

* - removed commented line
2020-10-15 15:03:34 +02:00
Greg Landrum
819e46ed1e Fixes #3413 (#3414) 2020-09-18 05:44:24 +02:00
Paolo Tosco
a9da05570e Fixes a couple of query-related bugs (#3398)
* - fixes a bug with the MDL MolParser (M  ALS queries clobber previously existing queries)
- fixes a regression introduced by #3389 (duplicate formal charge queries may arise)

* changes in response to review

* forgot to commit
2020-09-17 08:16:43 +02:00
Greg Landrum
02d76edc09 more bug fixes and cleanups from fuzz testing (#3339)
* ossfuzz #22301

* ossfuzz 22307

* memory leak when failing cxsmiles

* MolPickler things found by ossfuzz

* changes in response to review
2020-08-17 06:51:24 +02:00
Greg Landrum
f14f8a60de Expanded support for CXSMILES features (#3292)
* move replaceAtomWithQueryAtom() and completeMolQueries() to QueryOps namespace

* support ring bonds from cxsmiles

* add a test that is still failing

* update nonHydrogenDegree query, add SMARTS extension for that

* some cleanup

* unsaturation and substitution count

* fix typo in test

* update expected result

* add linknodes

* add variable attachment points

* improve documentation of supported cxsmiles features

* clarifying the docs

* support leaving out the outer atoms in LN specs
2020-07-25 05:06:08 +02:00
Greg Landrum
a9010da8a4 Small bug fixes and cleanups from fuzz testing (#3299)
* fix ossfuzz issue 24074

* fix ossfuzz issue 23896

* switch to throw exceptions when reading ints/floats

* remove extraneous benchmarking code

* change type of AH query

* confirm an invariant while finding rings

* no sense in adding these tests to github

* switch to use fail() instead of failbit
switch to acceptSpaces by default
2020-07-22 16:57:31 +02:00
Greg Landrum
1630540ef0 Add cxsmiles query atoms to CTAB parsers and writers (#3261)
* allow CXSMILES generic query atoms to be parsed from mol;
need more tests here

* remove vestigial directory

* Add d_queryType to Query
This opens up additional flexibility with customizing the way queries are handled
Also includes some assorted cleanups in the Query directory

* remove the MolFileSymbol hack added in #3235
We don't need it anymore

* Add support for additional ChemAxon extensions and document them

Signed-off-by: greg landrum <greg.landrum@gmail.com>

* bump pickle version

* add an additional test
2020-07-03 12:51:19 -04:00
Greg Landrum
cc4b726c55 LINKNODEs are ignored by the CTAB parsers (#3247)
* make sure LINKNODE is saved from v3k mol files
v2k still needs work since the format is different

* write v3k linknodes

* support reading V2000 mol blocks too
2020-06-23 12:56:32 -04: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
cc05e57180 fixes #3207 (#3221)
* fixes #3207

* changes in response to review

* logic problem
2020-06-16 04:34:51 +02:00