157 Commits

Author SHA1 Message Date
Greg Landrum
6d75052459 Support using iterators with MolSuppliers (#9230)
* iterators for random-access MolSuppliers
add optional caching to SDMolSupplier

* add support to SmilesMolSupplier too
There is a lot of duplicate code between the random-access suppliers that would be worth trying to remove
but at the moment it looks like it would require multiple inheritance, and I think we want to avoid that

* add input iterators for ForwardSDMolSupplier()

* throw when calling begin() on a used supplier

* switch to use the spaceship operator

* init() should reset the mol cache

* Make SDMolSupplier and SmilesMolSupplier safe for multi-threaded reads

* add benchmarking

* add TDTMolSupplier support
improved testing
add benchmarks for parallel iteration
optional TBB support

* better const handling, add reverse iterators

doesn't look like const_iterator is possible since getting data from the underlyng supplier object is non-const

* improve docs
more usings
add reverse iterator to TDTMolSupplier

* tests only try execution::par when it is there

* fix typo

* more testing/demo

* remove accidentally added files

* review changes

* add default ctors

* disable a false-positive compiler warning
it is stupid to have to do this

---------

Co-authored-by: = <=>
2026-05-05 13:36:15 +02:00
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
Brian Kelley
ecdf55ac2a Fixes a boundary issue when indexing SDF (#9162)
* Fixes an index boundary error in SDMolSupplier

* Add test data

* Run clang-format

* Update Code/GraphMol/FileParsers/testMolSupplier.cpp

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

* Update Code/GraphMol/Wrap/rough_test.py

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

---------

Co-authored-by: Ricardo Rodriguez <ricrogz@users.noreply.github.com>
2026-03-12 13:58:33 +01:00
Greg Landrum
3aab2653cd Fixes #9068: raise a ValueError when trying to set properties with empty names (#9085)
* Fixes #9068

* fix a problem with empty labels in s-group parsing

* fix empty column names in smiles suppliers

* add the check to setPODVal()

---------

Co-authored-by: = <=>
2026-02-09 05:58:25 +01:00
tadhurst-cdd
0b5172b62d cleanup of stereogroups and wedges for non-chiral sites (#9051)
* cleanup of stereogroups and wedges for non-chiral sites

* fixed testShapeHelpers for Arm64 build

* reorg the tests a bit

* rename and document option

* add to the python wrappers

---------

Co-authored-by: greg landrum <greg.landrum@gmail.com>
2026-01-30 04:20:32 +01:00
tadhurst-cdd
2ae0a75a25 Handle chiral atoms with 2 hydrogens in SCSR parser (#8939)
* added flag to allow chiral settings on Atoms with 2 hydrogens for SCSR treatment

* added parameter to allow chiral 2Hs on template mols in SCSR parser

* fixed testShapeHelpers for arm64 build

* Remove checking for two Hs in chiral atom in atomChiralTypeFromBondDirPseudo3D

* removal of flag for allow2Hs

* remove setup.bat file
2026-01-29 08:08:14 +01:00
Yakov Pechersky
08552e56b1 atropisomer bond atoms are checked explicitly for SP2 hybridization (#8974)
* atropisomer bond atoms are checked explicitly for SP2 hybridization

before, we checked only on totalDegree = 2 or 3,
but this causes false positives for something like a chiral sulfoxide
since the S is tetrahedral (sp3) but has only 3 substituents.
the hybridization code relies on totalDegree,
but modified to include and making sure to include conjugation
so while this is more expensive per molecule, it is closer to intent

Closes #8973

* assert we got no warnings on sulfinamides

* cleanup

* bring back degree based check, quick pass so that we don't run expensive calc on all mols with wedge bonds

* bring conformer back
2025-12-29 18:04:40 +01:00
tadhurst-cdd
0f03609221 Allow spaces and special chars in SCSR fullname attrs (#8982) 2025-12-29 17:54:56 +01:00
Greg Landrum
c2e48f41d8 Stop writing so many atom properties to cxsmiles (#9002)
* fix a bug in copySelectedAtomsAndBonds()
we need to clear computed properties on the atoms here

* prune back the atom properties written to CXSMILES

* update minimallib tests
2025-12-13 04:35:57 +01:00
tadhurst-cdd
20aeb386e7 Valence error when parsing SCSR (#8948)
* turn off strict valence check for SCSR Templates

* fix to test molecule ValenceErrorScsr.mol

* Add test mols
2025-11-18 17:09:04 +01:00
tadhurst-cdd
c948297d98 added new attributes for scsr template as per BIOVIA doc 2023 (#8911)
* added new attributes for scsr template as per BIOVIA doc 2003

* changed to allow any attributes for an SCSR Template def

* removed unneeded defs for TEMPLATE attribute names
2025-11-06 12:24:45 +01:00
Greg Landrum
00583fc1ab Fix a couple issues related to atom list handling in V3000 mol blocks (#8824)
Fixes #8820
Fixes #8823
2025-10-09 05:26:01 +02:00
tadhurst-cdd
3f60cb5674 Fix for Issue 8602 (#8668)
* Fix for Issue 8602

* Simlified generation of 3d from of ref for atropisomers
2025-08-20 10:10:47 +02:00
tadhurst-cdd
9055646b54 Scsr sgroup error (#8623)
* fix scsr parsing for non-template SUP groups

* Rempoved two tests not related to this PR

* Update Code/GraphMol/FileParsers/SCSRMolFileParser.cpp

added the constexpr as suggested

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

* changed constrexpr to const for std:string

---------

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2025-07-13 11:05:29 +02:00
Brian Kelley
58c21baeba ChemDraw Document and read/write support for the RDKit (#8620)
* ChemDraw Document and read/write support for the RDKit

* Add missing test file

* Rev chemdraw version

* Rev chemdraw version

* Rev chemdraw version for g++11

* Update CMakeLists.txt

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

* Build chemdraw from an external CMake file

* Remove unused platform bigendian check

* Revert changes to constants, remove unused ones

* Keep the original constant names

* Remove __main__ section

* Use as much of the ChemDraw CMakeList as possible

* Skip installing expat

* Rev chemdraw version to fix windows issue

* Don't install expat, set the appropriate CHEMDRAW_BUILD definition

* resolve windows builds

* Fix minimal lib builds

* Move ChemDraw document to private header

* Move utility functions to ChemDraw namespace

* Move ChemDraw to v2 unique ptr api namespace

* Make class enum

* Switch to camelCase

* Response to review

* Move ChemDrawToDocument to ChemDraw namespace

* Update External/ChemDraw/Wrap/rdChemDraw.cpp

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

* Fix typo

* Update External/ChemDraw/Wrap/rdChemDraw.cpp

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

* Add better documentation

* Rev chemdraw version

---------

Co-authored-by: Brian Kelley <bkelley@glysade.com>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2025-07-04 06:36:10 +02:00
Greg Landrum
969b1aadee Revert "ChemDraw Document and read/write support for the RDKit (#8539)" (#8618)
This reverts commit f8fde2f7d8.
2025-07-03 07:57:20 +02:00
Brian Kelley
f8fde2f7d8 ChemDraw Document and read/write support for the RDKit (#8539)
* ChemDraw Document and read/write support for the RDKit

* Add missing test file

* Rev chemdraw version

* Rev chemdraw version

* Rev chemdraw version for g++11

* Update CMakeLists.txt

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

* Build chemdraw from an external CMake file

* Remove unused platform bigendian check

* Revert changes to constants, remove unused ones

* Keep the original constant names

* Remove __main__ section

* Use as much of the ChemDraw CMakeList as possible

* Skip installing expat

* Rev chemdraw version to fix windows issue

* Don't install expat, set the appropriate CHEMDRAW_BUILD definition

* resolve windows builds

* Fix minimal lib builds

* Move ChemDraw document to private header

* Move utility functions to ChemDraw namespace

* Move ChemDraw to v2 unique ptr api namespace

* Make class enum

* Switch to camelCase

* Response to review

* Move ChemDrawToDocument to ChemDraw namespace

* Update External/ChemDraw/Wrap/rdChemDraw.cpp

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

* Fix typo

* Update External/ChemDraw/Wrap/rdChemDraw.cpp

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

* Add better documentation

---------

Co-authored-by: Brian Kelley <bkelley@glysade.com>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2025-07-03 06:01:58 +02:00
Yakov Pechersky
12f3f88036 feed dummy perpendicular point for cross product to prevent zero error in normalization during atropisomer chirality, fixes #8602 (#8603)
* feed dummy perpendicular point for cross product to prevent zero error in normalization during atropisomer chirality, fixes #8602

* remove debug log

* move test, and check that no bonds
2025-06-26 19:34:17 +02:00
tadhurst-cdd
8393e26292 allow nested parentheses in tokens (#8553)
* allow nested parens in tokens

* removed commented old code

* add the test file

* changes as per PR review
2025-06-01 12:46:53 +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
tadhurst-cdd
bebd2ebbce Fix for removing bad stereo indications from Atropisomer parsing (#7984)
* Fix for removing bad stereo indications

* removed one unneed change

* removed mistaken change
2024-12-22 04:47:18 +01:00
tadhurst-cdd
c2168cd8be Fix for kekuleAtrop wedge error (#7992)
* Fix for kekuleAtrop error

* Consolodate repeating code in new tests

* as per PR review - simplification
2024-11-15 04:39:38 +01:00
tadhurst-cdd
0de215a1f8 Fix canonicalization of stereogroups (#7041)
* 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

* test changes

* 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

* Merge branch 'master' into pr/specialQueries

* changes from previous PR

* Iclude false chiral

* rigorous enhnced stereo canoncalization

* Added more tests and clenup

* removed commented out code

* corrected init of SmilesWriteParams

* added MolFileStereoChem.h to the header files

* Renamed Rxn parser to MrvBlockToChemicalReaction

* To make catch2 work, and match the checksum

* Fixed Structchecker errors

* fix CI for DetermineBonds catch test

* error in catch_test for CI

* Allow custom  smileWriteParams  in GetMolLayers

* misnamed entry point

* ReactionFromMrvString change name

* remove adding writeParams to GetMolLayers

* make rigorous enhanced stereo the default, and fix tests

* only one abs group no longer needs Rigorous Enhanced treatment

* changed string_view to string in catch test

* Canonicalize Enhnaced Stereo only resturne unique smiles

* Now allows or and and groups together

* internal routines inside detail scope

* fix test error

* changed string back to string_view and fixed a CHECK

* Fixes for PR review tests

* Fix RDKit_Book.rst failure on build test

* fix xqm sql test

* updated expected files for cxsmiles_test

* Fixed removal of atom attrs

* Fixed tests after merge of master

* More efficient version of Stereo Groups Canonicalization

* Fixes for ctests

* removed debug code

* readded cipLabel test

* fix generalizedSubstruct/catch_tests.cpp error

* hueristics to improve speed

* Rationaized control of abs groups

* removed unused routine

* added rigorous stereo group treatment to test

* some suggested changes

* Changes per PR review and removed some changes to smiles

* Fixed CI errors

* changes per PR review

* more PR review vhanges and cleanup

* Fixed PSql PKL change

* changes as per PR review

* Restored error type for bad mols for canonicalizeStereoGroups and added a test

* Merge master and fix test in MolDraw2D

* Fix for randomize test error and other PR review comments

* Removed unsued variable to fix mac CI

* do not force aromatization in canonicalizeStereoGroups

* changes as per PR review

---------

Co-authored-by: greg landrum <greg.landrum@gmail.com>
2024-10-11 17:09:18 +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
Greg Landrum
18d1ff5f8f Prefer wedging ring bonds around atropisomers (#7373)
* prefer wedging ring bonds for atropisomers

* update expected results

* handle 3D as well

* prefer wedging to larger rings

wedging bonds in 5 rings make later attempts at improving kekulization very difficult

update expected results

* extend those changes to 3D

* update tests for those changes

* avoid wedging atropisomers if possible

response to review
2024-05-08 06:04:23 +02:00
Yakov Pechersky
c25abde7cf Include macrocycles in atropisomer calculation by not sanitizing them away (#7291)
* Include macrocycles in atropisomer calculation

Previously, atropisomeric bonds were sanitized away if they were part of a "ring bond", which happens in macrocyclic systems.
None of the existing test cases fail if that sanitization check is removed.
The sanitization step is removed to support biaryls that are part of a larger macrocyclic system.
A set of test cases is included that cover potential macrocyclic atropisomeric systems

* Remove unmentioned files

* Keep ring check, and narrow it to when bond is in as many rings as atoms

* exclude atropisomer bonds if in rings < 8 atoms

Co-authored-by: tadhurst-cdd <112502803+tadhurst-cdd@users.noreply.github.com>

* Clarify macrocycle behavior in RDKit book

* fix typo

---------

Co-authored-by: tadhurst-cdd <112502803+tadhurst-cdd@users.noreply.github.com>
2024-04-09 06:05:25 +02:00
tadhurst-cdd
7412566a27 Wedge bond from atrop error (#7321)
* changed string_view to string in catch test

* fix bug in atrop wedge determination

* reverted changes from string_view to string
2024-04-03 15:35:42 +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
tadhurst-cdd
eb2606d617 fragmentation of mol loses any sgroups (#7056)
* fragmentatin of mol loses any sgroups

* removed unneeded test

* Fixes #7071

* simplification. tests do not pass

* Changed test for sgroup retention as per PR review

* Fix testing errors

* attempt to get CI windows to build

* removed files incorrectly committed, and removed code no longer needed

---------

Co-authored-by: greg landrum <greg.landrum@gmail.com>
2024-01-25 13:32:55 +01:00
tadhurst-cdd
73b4da2a44 New tests for specical query atoms and atropisomers (#7010)
* New tests for speical query atoms and atropisomers

* fixed error, and used unique_ptrs

* Removed test that makes GraphMol depend on GenericGroups

* More to remove GraphMol dependency on GenericGroups
2024-01-11 05:54:14 +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
Jonathan Bisson
56170a455d Add support for Marvin files (#6575)
* Add support for Marvin files

* And MRV lib to the Java wrapper

* And MRV lib to the Java wrapper

* Removed use of void * in MarvinParser.cpp and MarvinParser.h

* Changes as per code review from Greg

* Changes for PR review - many virtual methods

* changes as per Jonathan's comments

* some suggested changes

* PR review changes and fixed unit tests

* after merge, changes to make it run

* More PR review changes

* removed unneeded std::move()s · rdkit/rdkit@b4b8b9a · GitHub

* More PR review changes

* fix a compile error

* more defensive programming

* reorder

* final? PR review updates

* Erata

---------

Co-authored-by: Tad Hurst <tad.hurst@collaborativedrug.com>
Co-authored-by: greg landrum <greg.landrum@gmail.com>
Co-authored-by: tadhurst-cdd <112502803+tadhurst-cdd@users.noreply.github.com>
2023-09-01 04:50:34 +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
Ric
a8ec687f1e Improve MaeMolSupplier API (#6053)
* implement setData, reset

* implement length

* fix ForwardSDMolSupplier wra[ override

* Document and wrap length, fix test

* add and wrap moveTo and operator[]

* implement 2D/3D detection

* restore rough_test doctest comment

* addres comments

* add test tags
2023-02-08 04:31:51 +01:00
Sreya Gogineni
d6eab054d0 Integrating xyz2mol Into The RDKit Core (GSoC 2022) (#5557)
* Added xyz2mol file parser and tests

* deleted some comments

* Delete file parser

* Delete file parser test

* Revert "Localb"

* adding all files again

* adding file parser and test

* Updated empty string check

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

* Updated atom initialization

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

* Allow zero-atom molecule object

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

* file parser improvements and added 0-atom mol test

* added xyz block parser and other fixes

* Added the DetermineBonds library with atomic connectivity determination

* atomic connectivity updates including EHT methhod addition

* incorporated more suggestions

* adding buggy version of determine bond ordering

* added documentation for determineBonds() use

* fixed unfavorable oxygen bond ordering

* suggested updates

* additional error checking and added determine bond ordering radical testing

* divided test files into categories

* added determineBonds() combining connectivity and bond ordering

* edited determineBonds.h documentation, added readme

* small grammar fixes

* more tiny fixes

* one less letter

* another typo fix

* make the xyz2mol functionality optional

* enable that for the CI builds

* Update CMakeLists.txt

Co-authored-by: Sreya Gogineni <74024376+gosreya@users.noreply.github.com>

* array to vector

* get windows DLL builds working

* rename determineBondOrder -> determineBondOrders

* run clang-format

* add python wrappers
rename determineBondOrder->determineBondOrders

* expose XYZ parsers to python

* changes in response to review

Co-authored-by: Sreya Gogineni <gosreya@gmail.edu>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2022-10-06 05:46:08 +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
Ric
fb432f52f1 Addresses issue #3815 (#3816)
* add test cases for a bad stereo label and undefined chirality

* add fix
2021-02-16 08:04:37 +01:00
shrey183
8ea1ac6112 [GSoC-2020] Generalized and Multithreaded File Reader (#3363)
* fixed issue #2965

* added test case for issue #2965

* fixed formatting and added comment.

* update

* General Reader files

* removed dependency on boost filesystems

* removed class

* clang-format

* added-comments

* further-cleanup

* added clang-formatting

* braces-for-if-else

* changed error messages, added option for windows file path

* fixed getFileName function

* cleanup

* option for filename without path

* further-cleanup

* added tests for determineFileFormat

* cleanup, const arguments for validate function

* init

* cleanup

* cleanup

* clang-format does not work for CMake

* added RDK_TEST_MULTITHREADED option

* add-flag

* cleanup

* Delete ConcurrentQueue.h

This PR deals with the Generalized File Reader.

* Delete testConcurrentQueue.cpp

This PR deals with the Generalized File Reader.

* no change

* concurrent queue

* print values

* Single Producer Multiple Consumer works

* cleanup

* Producer Consumer Example

* update queue methods and tests

* cleanup

* test

* fixed tests

* cleanup, updated tests

* Delete ProducerConsumer.h

* Delete testProducerConsumer.cpp

* cleanup

* futher cleanup

* changes based on feedback

* make queue non copyable

* psuedocode

* possible implementation

* untested implementation

* change class to typename

* basic-setup

* need to fix segfault

* need to fix blocking

* need to fix blocking

* need to fix blocking

* fix indentation

* one possibility

* without lambda function

* possible fix with some test cases

* performance tests

* added support for record id and item text

* cleanup

* cleanup

* fixed memory leak and added methods with tests for getting last id and item text

* cleanup

* added more test cases with different smi files

* cleanup

* SD mol supplier

* modified the parsing for SDMolSupplier

* cleanup

* cleanup

* new file for testing

* added support for reading molecule properties with tests

* thread-safe logging and exception handling

* cleanup

* without thread safe logging

* cleanup

* cleanup, modified MultithreadedSmilesMolSupplier

* cleanup, made reader and writer functions private

* move O2.sdf

* basic python wrapper with tests

* cleanup, added new methods for python wrappers

* made changes suggested by Andrew

* file and compression formats are case-insensitive

* cannot open files with gzstream

* cleanup

* possible fix for opening compressed streams (SMILES)

* removed seekg() and tellg() methods from multithreadeded suppliers

* cleanup

* test cases for python wrappers

* some wrapper cleanup

* cleanup, removed unused functions

* update the MT tests so that they actually do some work
also includes some cleanup here

* cleanup

* remove iterator_next header include

* added support for multithreaded readers

* use getNumThreadsToUse for multithreaded suppliers

* fixed documentation for multithreaded python wrappers

* commented performance test

* first draft of final evaluation report

* removed inline variables

* first draft getting started in python

* fixed typos in getting started in python

* fixed typos

* fix documentation tests

* fixed documentation tests

* added links to important files and PR

* added perfomance results

* first version of wrappers with compressed streams

* getting rid of streambuf stream method

* modified General File Reader

* make this work when building in non-threads mode

* rename a test

* rename a function in the python API

* rearrange the python test a bit

* disable the stream-based constructors in Python

* mark the multithreaded classes as experimental

Co-authored-by: greg landrum <greg.landrum@gmail.com>
2020-10-09 04:31:05 +02:00
Greg Landrum
1a3ce773cf Molecule metadata in PNGs (#3316)
* reader stub. Navigates the file successfullly

* works

* works

* read out all metadata, not just ours

* first pass at reading out molecules

* support mol blocks too

* add python wrapper for parser

* add direct writer

* get rid of multiple definitions in PNParser.h

* update from code review

* robustification

* handle reading compressed metadata

* support compressing metadata too

* reorder arguments to make this more consistent

* add writers to python wrappers

* forgotten file

* add pickle support

* explicit zlib dependency

* get windows builds working
at least with conda boost+zlib

* switch to using boost::iostreams to do the compression/decompression

* switch to using a vector of string pairs to store the metadata

need this so that we can contain "duplicate" keys

* add metadata output to MolDraw2DCairo
still need python test

* add a python test

* initial work at reading/writing reactions from PNGs

refactor the ReactionParser.h header a bit

* cleanup debug messages

* reaction PNG support -> python

* ReactionPickler no longer includes all ProductTemplate props

* handle metadata at the MolDraw2D level
Currently only supported by MolDraw2DCairo, it's worth extending this to SVG too

* support reading multiple molecules from a png

* support multiple molecules from files and in python

* stop duplicating tags with multiple molecules

* update to get windll builds working
this change should be propagated to more cmakelists.txt files

* make sure the metadata ends up in the notebook

* make sure PNGs in the notebook also have metadata

efficiency improvements for some notebook bits (i.e stop going PNG->Image->PNG)

* no need to pretend that we might be using PIL anymore

* documentation

* update docs to show new functionality

* not sure why the doctests failed on linux

* still trying to diagnose those failures

* protect doctests in case python interpreters are being re-used

* switch tags

* the wrapped functions to read png data from files weren't working

* <sigh>... windows dlls
2020-08-25 07:51:18 +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
60566aa35f SGroups with more than one attachment point are now properly parsed (#3072)
* SGroups with more than one attachment point are now properly parsed

Thanks to Roger S for the example and fix.

* Update Code/GraphMol/FileParsers/file_parsers_catch.cpp

Co-Authored-By: Ric <ricrogz@users.noreply.github.com>

Co-authored-by: Ric <ricrogz@users.noreply.github.com>
2020-04-12 10:25:39 +02:00
Ric
4b4085f60e Rework MaeMolSupplier, fix #2617 (#2620)
* merge older changes

* use back() in chirality parsing

* update comments
2019-12-03 15:04:23 +01:00
Eisuke Kawashima
185ec927ab Unset executable flag 2019-10-10 20:18:43 +09:00
Pat Lorton
dc1ccc3d9e Keep PDB info from Maestro files if available (#2619)
* Keep PDB info from Maestro files if available

* Add test and test_data for Maestro PDB data reading
2019-08-23 14:00:52 -07:00
Brian Kelley
fa61fa717d Add test for issue #2285, fix molbundle test (#2301) 2019-02-28 13:47:03 -05:00
Greg Landrum
ca54f64289 Fixes #2229 (#2235)
also some reformatting
2019-01-22 10:53:48 -05:00
Ric
d26d4b076e Support for parsing/writing SGroups in SD Mol files. (#2138)
* Implementation of SGroups

* remove sample files test

* update gitignore with test outputs

* fix RevisionModifier

* re-enable tests

* backup commit; things seem to work so far

* some refactoring; obvious s group tests pass now

* more refactoring

* everything now out of the public API

* not sure why this was still in there

* rename functions; all tests now pass

* remove getNextFreeSGroupId; readd comment in copy SGroups

* clang-format

* squash-merge current master

* squash merge master

* Address comments on PR

- Update to current master.
- Move SGroup parse time checks to SGroupChecks namespace.
- Store SGroups in ROMOl as vector<SGroups>.
- SGroup methods return referenes instead of pointers.
- Use atom/bond/sgroup indexes for properties instead of pointers.
- Have SGroups inherit from RDProps; move properties to RDProps.
- Remove trivial/unused methods.
- Add a link to the SD specification atop SGroup.h
2019-01-22 15:42:27 +01:00
Greg Landrum
8c9795f535 Fix #2225 (#2228)
* Fixes #2225

* A bit of extra cleanup

* forgotten file

* Make this thread safe and add support for v3K mol blocks

* add the file

* update expected results
2019-01-17 11:44:23 -05:00
Greg Landrum
c59d586431 Fixes #2040 (#2085)
* does not yet really work

* tests pass

* store the info about the attachment points in case we want to use it later.

* add a couple more tests; changes in response to review
2018-10-08 22:27:48 +02:00