26 Commits

Author SHA1 Message Date
Brian Kelley
9558cb8114 Check for correctly sized propertylists to avoid dropping molecules (#8921)
* Fixes #8918

* Use only the one check for compatible sizes

---------

Co-authored-by: Brian Kelley <bkelley@glysade.com>
2026-01-08 06:08:54 +01:00
Ricardo Rodriguez
7b7a8a4e17 Refactor iostreams includes (#8846)
* refactor iostreams includes

* restore ostream to MonomerInfo.cpp
2025-10-08 16:08:01 +02:00
Greg Landrum
d12932f13e support bond property lists in SDF (#8778)
* backup
builds but no tests

* deprecate old form

* initial basic tests for bond property lists

* Tests pass

Fixes #8777

* add deprecations to release notes

* - avoid computing size of a constant at runtime
- replace multiple instances of a numeric constant with a literal constant
- avoid unnecessary copying of strings in iterations and function calls

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2025-09-17 16:17:12 +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
08c964075a Fixes #7306 (#7510)
* Fixes #7306

Do not cross bonds which were previously aromatic

* revert one of the test changes

* change in response to review

---------

Co-authored-by: Riccardo Vianello <riccardo.vianello@gmail.com>
2024-07-01 05:00:24 +02:00
PatrickPenner
aaa06faa0f Custom decimal precision (#7229)
* MolToMolBlock V3000 double precision coordinates

- Added MolWriteParams
- Added python interfaces with MolWriteParams
- Added double precision test

* Added params interface for file writing functions

* First comments

- read precision from stream and reset
- MolWriteParams renamed to MolWriterParams

* MolToMrv and MolToXYZ precision interface extension

- extend the mol to marvin and mol to XYZ functions with coordinate precision
- propogate to python interface
- harmonized documentation occasionally

* Implement review
2024-03-17 06:03:03 +01: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
Greg Landrum
a2ecd6723c Fixes #5819 (#6897)
* Fixes #5819
still some things to think about there

* test parsing

* make sure the fix for 5819 also shows up in reactions

* patch some other holes
2023-11-22 17:35:58 +01: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
90c6ffa472 Support writing V3000 reactions (#4982)
* first pass at writing v3K rxns

* python wrapper

* test other C++ call

* cleanup

* Fixes Windows DLL build issue

* changes in response to review

Co-authored-by: Paolo Tosco <paolo.tosco.mail@gmail.com>
2022-02-08 14:37:53 +01: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
Dan N
d0d9742a71 Add RDKIT_FILEPARSERS_EXPORT to finishMolProcessing (#2551)
This addresses a linking error when using dynamic libraries on Windows:

    MDLParser.cpp.obj : error LNK2019: unresolved external symbol "void __cdecl RDKit::FileParserUtils::finishMolProcessing(class RDKit::RWMol *,bool,bool,bool)" (?finishMolProcessing@FileParserUtils@RDKit@@YAXPEAVRWMol@2@_N11@Z) referenced in function "void __cdecl RDKit::`anonymous namespace'::ParseV3000RxnBlock(class std::basic_istream<char,struct std::char_traits<char> > &,unsigned int &,class RDKit::ChemicalReaction * &)" (?ParseV3000RxnBlock@?A0xcb91cdb2@RDKit@@YAXAEAV?$basic_istream@DU?$char_traits@D@std@@@std@@AEAIAEAPEAVChemicalReaction@2@@Z)
    ..\..\..\bin\RDKitChemReactions.dll : fatal error LNK1120: 1 unresolved externals

We may want to set default visibility on Linux to hidden, too, so that we can catch linking errors like this more easily.
2019-07-28 06:26:25 +02:00
Brian Kelley
3b4326c1c7 Add tests for #1868 (#2497)
* Add tests for #1868

* Fix github bug number

* Fix #2 for correcting issue number

* Fixes #1868

The primary problem here was that when v3K reactions were being processed,
a bunch of "finalization" steps were being skipped for the reactants and products.
This remedies that.

* update the python test so that it tests the actual problem
2019-07-12 05:51:16 +02:00
Greg Landrum
84c1ea5e7a some much-needed optimization work on the new property lists (#2317) 2019-03-06 16:06:32 -05:00
Greg Landrum
180c15fe0e support reading/writing atom props from SD files (#2297)
* first crude pass

* fix a deprecation

* change naming scheme, support bools

* add standalone function

* add a default value for missings

* support long lines

* stupid typo

* make operator[] work

* revisit missing value handling

* modify missing value handling

* switch to an alternate scheme for specifying missing values

* clang-format

* First pass at property list parser
still needs more tests

* add test for processMolPropertyLists

* get this working as part of the ForwardSDMolSupplier

* first pass at python wrappers and tests

* clang-format run

* add creation of property lists at the mol level

* wrap long lines on output

* remove PoC implementation

* fix python wrappers

* remove out-of-date reference to the Python PoC

* changes in response to review
2019-03-03 13:17:13 -05:00
Greg Landrum
2738c35178 Fixes #1903 (#1971)
* Fixes #1903

* update SWIG bindings too
2018-07-25 09:14:17 +02:00
Paolo Tosco
c08ea49bda - enable building DLLs on Windows (#1861)
* - enable building DLLs on Windows

* - export.h and test.h are now auto-generated by CMake
2018-05-16 08:42:41 +02:00
Greg Landrum
270f7b76e5 Partial support for reading CXSMILES (#1237)
* add a SmilesParserParams object to prepare for this

* add a SmilesParserParams object to prepare for this

* add tests for the SmilesParseParmas

* support name parsing, should it be the default?

* rename CXNSmiles to CXSmiles;
add a spirit parser for CXSmiles coordinate that is at least syntax correct

* abandon boost::spirit for now; crude atom token parser

* support params in smiles parser (not tested, may not build)

* can read coords and atom labels along with mol names; crude, but works

* read coordinate bonds

* remove some compiler warnings with VS2015

* remove a bunch of compiler warnings on windows

* remove more warnings on windows

* remove more warnings on windows

* backup commit: first pass at parsing query features

* radical spec parsing

* handle attachment points using atom mapping

* switch to a named property for atom labels

* fix handling of the "A" atom query

* add functions to construct A and Q queries (needs more work)

* fix a problem created while cleaning up warnings earlier

* add some additional convenience functions for making generic atoms.
Still need M and to recognize these while writing CXSMILES

* add M queries; update some tests

* fix a linux compile problem

* get the cxsmiles stuff working in python; basic testing

* support "M" in CXSMILES
2017-01-31 13:50:36 -05:00
Greg Landrum
e08e0d16d8 first pass, using google style 2015-11-14 14:58:11 +01:00
Greg Landrum
8c70417690 Fixes #88 2013-08-21 20:45:54 +02:00
Greg Landrum
dbd78604c8 fix and test issue 3477283
add a new option for ctab parsing to cause the parser to be less strict about
  errors in the file syntax.
2012-01-22 09:40:54 +00:00
Greg Landrum
f3fbef45c5 update copyright statements 2010-09-26 17:04:37 +00:00
Greg Landrum
4d168b2637 further leak stoppage 2010-06-09 18:30:22 +00:00
Greg Landrum
a09fd9f63a cleanup work on file parsers code; add v3K rxn support 2010-06-03 06:59:48 +00:00