79 Commits

Author SHA1 Message Date
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
86141183c1 Moving towards getting all tests to pass when using the new stereo code (#8409)
* Fixes #8379

* check in some working tests

* test passes

* test passes

* test passes

* test passes

* test passes

* ensure that the invariants flush the streams on failure

* tests pass

* test passes

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* tests pass

* Fixes #8391

* tests pass

* fix a test with legacy
not clear why this was not causing problems before

* make a test work

* Fixes #8396

* gcc builds work

* fingerprint tests pass

* mention backwards incompatible change

* fix a problem with FindMolChiralCenters

* more testing details

* enable the test status output

* Fixes #8432

fix a bug in double-bond stereo handling for template matching

* all depictor tests pass

* use the new-stereo chiral ranks in the depiction code

* always assign new-stereo chiral ranks

* make _ChiralAtomRank a computed property
This is analogous to _CIPRank

* tweak to the way the atom ordering is computed for 2D coordinate generation

* update two expected results

* backup

* response to review

* tests pass

* tests pass

---------

Co-authored-by: = <=>
2025-04-15 14:00:32 +02:00
Greg Landrum
fa048eacc5 Replace GetImplicitValence() and GetExplicitValence() with GetValence() (#7926) 2025-01-28 21:09:03 +01:00
Hussein Faara
f35e7e6414 remove no-op macros and dead code (pt 1) (#8012) 2024-11-19 04:31:56 +01:00
Greg Landrum
724716b2c6 Switch to isoelectronic valence model (#7491)
* change valence model to use isolobal analogy

Remove support for five-coordinate C+ and, by analogy, five-coordinate N+2

Removes support for charge states that take atoms past the end of the periodic table
  i.e. [Lv-4] is no longer supported

* update the tests for that

* remove valence state of 6 for Al

* fix representation of phosphate in the mol2 parser

this is a correction of what was done during #5973

* cleanup the exceptions for P, S, As, and Se

* drop valence states:

Si 6, P 7, As 7

* a couple of additional changes from #7397

* update java tests

* fix an inconsistency: Rb now supports valence -1

* documentation

* - replace operator[] with at() for bounds check
- extract some code into a function to avoid duplication
- use TAB as separator throughout in the periodic table data for consistency

* removing the .at() usage

We know that these vectors aren't empty, so there's no need for the bounds check.

---------

Co-authored-by: ptosco <paolo.tosco@novartis.com>
2024-06-25 15:38:49 +02:00
Anna Brünisholz
82dbf4c66b switch to range-based for loops (#7278)
* switch to range-based for loops

* Update Code/GraphMol/testChirality.cpp

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

* fix a leak in the new DCLV code (#7279)

* fixes #7295 (#7303)

* tag 2024.03 release (#7308)

* tag release

* attempt to solve constant MD5 problems

* switch to getting the ComicNeue font from github instead of as a zip

* open new release cycle (#7314)

* restrict the application of 1,3- 1,5- conjugated cation normalization (#7287)

* propagate yaehmop build status (#7316)

* Fixes #7299 (#7304)

* clean up of python and c++ for-loops

* clang formatted testChirality

* fix test file

---------

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
Co-authored-by: Riccardo Vianello <riccardo.vianello@gmail.com>
2024-04-08 14:16:27 +02:00
Brian Kelley
eef5aa648e Fixes #7115 (#7117)
Co-authored-by: Brian Kelley <bkelley@relaytx.com>
2024-02-01 05:02:46 +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
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
Greg Landrum
fee12b0aa6 Switch to determining atom chiral types from pseudo 3D instead of bond dirs (#6456)
* backup

* backup

* passes a lot of tests

* cleanup; still failing some tests

* pay attention to bond starting points... duh

* all tests pass

* invert y coords

* Scale bonds, make the Wedge detection cleaner, add more tests

* Readd comment

* Use document bond length

* Adds roundtrip test through a molblock

* a bit of cleanup

* remove the old code since we aren't using it any more.

* changes in response to review

---------

Co-authored-by: Brian Kelley <bkelley@relaytx.com>
2023-07-04 04:48:55 +02:00
Greg Landrum
9fa1df1cf6 Drop usage of CIP information from the canonicalization code (#5385)
* stop using CIP codes in the atomic canonicalization

this will change results in some cases, so lots of tests need to be updated.

* stop breaking string literals... ARGH

* tests now pass

* update double bond canonicalization

* update a python test

* some cleanup

* update expected results for cartridge
2022-07-13 05:40:23 +02:00
Eisuke Kawashima
11532089de Run clang-format against cpp (#4358) 2021-10-20 04:25:27 +02:00
Ric
f0feb1198e Fixes #4494 (#4495)
* add fix

* add test

* Update Code/GraphMol/Chirality.cpp

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

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2021-09-13 04:39:55 +02:00
Greg Landrum
19bdd21de1 Updated code for chirality perception (#3324)
* add new test (it fails, of course)

* isAtomPotentialTetrahedralCenter() there and tested
tests cases for molecular stereo written (but failing, of course)
create new_chirality.cpp, we will probably want to change this at some point
new StereoInfo structure

* more infrastructure
- isBondPotentialStereoBond()
- two getStereoInfo() functions
- associated unit tests

* backup

* oops

* backup

* switch to always using four atoms for bonds

* backup

* add new test (it fails, of course)

* isAtomPotentialTetrahedralCenter() there and tested
tests cases for molecular stereo written (but failing, of course)
create new_chirality.cpp, we will probably want to change this at some point
new StereoInfo structure

* more infrastructure
- isBondPotentialStereoBond()
- two getStereoInfo() functions
- associated unit tests

* backup

* oops

* backup

* switch to always using four atoms for bonds

* backup

* this now actually works

* doc update

* add a test to demo that ring stereo is not working

* more testing

* add a fun CIP test

* add review note

* debugging

* remove extraneous debugging
turn off tests for ring-double bond stereo

* disable the ring-stereo fix... this breaks a few tests, but we will recover

* works, needs cleanup, chirality code needs re-testing

* nothing works

* Fixes #3322

* Python and C++ tests now pass

* clang-format

* first pass at python wrappers

* improve doctest

* basic optimization...
stop with the copying

* rename

* all tests passing again

* optimization

* fix the sort in the tests

* looks like this might fix the windows-dll build problems

* update tests

* the fun never ends

* comment cleanup

* handle deliberately unspecified atoms/bonds

* add cleanIt option

* add flagPossible

* add option to use the new code to the SMILES parser

* additional testing

* additional testing

* a bit of additional testing never hurts

* changes in response to review

* fixes a bug with potential parastereo not being cleared

other changes in response to review

* update docs
2020-09-02 15:00:29 +02:00
Greg Landrum
1dd2d75615 Fixes #3314 (#3318)
Cleans up and simplifies (a bit) the code for perceiving chirality
based on a conformer and wedged bonds.
2020-08-10 13:12:01 -04:00
Greg Landrum
d41752d558 run clang-tidy with readability-braces-around-statements (#2899)
* run clang-tidy with readability-braces-around-statements
clang-format the results
clean up all the parts that clang-tidy-8 broke

* fix problem on windows
2020-01-25 14:19:32 +01:00
Paolo Tosco
7d24ed6014 Resolves #2823 (#2863)
* Resolves #2823

* - changes in response to review

* Update Code/GraphMol/Chirality.cpp

Co-Authored-By: Greg Landrum <greg.landrum@gmail.com>

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2019-12-29 06:25:52 +01:00
Greg Landrum
ab061d532f fix start/end atoms when wedging bonds (#2861) 2019-12-27 07:21:49 -05:00
Greg Landrum
494faf119a Fixes #2422 2019-04-26 16:43:35 +02:00
Greg Landrum
98abd6f16f Fixes #2266 (#2269) 2019-02-15 10:35:09 -05:00
Ric
a6b26253ff Fix (most of) mem problems (#2123)
* do not use new on loggers

* del pointers in testDistGeom

* Update Dict hasNonPOD status on bulk update

* delete new Dicts in memtest1.cpp

* fixes in MolSuppliers and testFMCS

* PeriodicTable singleton as unique_ptr

* fix EEM_arrays leak

* fix leaks in testPBF

* fix ParamCollection leak in test UFF

* fix leaks in MMFF

* clear prop dict before read in in pickler

* fix leaks in testFreeSASA

* fix leaks in test3D

* modernize Dict.h & SmilesParse.cpp

* fix leaks in testQuery

* fix leaks in testCrystalFF

* fix leaks in cxsmilesTest

* fix leaks in Catalog & mol cat test

* fix leaks in ShapeUtils & tests

* fix leaks in testSubgraphs1

* fix leaks testFingerprintGenerators

* fix leaks in Catalog/FilterCatalog

* fix leaks in graphmolqueryTest

* these changes reduce bison parse leaks

* fixed leaks in testChirality.cpp

* fix leaks + 2 tests in testMolWriter

* fix 4m leaks in substructLibraryTest

* small improvements to molTautomerTest; still leaks

* fix leaks in testRGroupDecomp

* fix leaks in test; parser still leaks

* fix leaks in itertest

* fix 4m leaks in testDepictor

* fixes in smatest; still leaking due to parser

* fixes in testSLNParse; still leaking due to parser

* flex/bison: always add atoms with ownership; smarts error cleanup

* fix leaks in testReaction

* fix leaks in testSubstructMatch

* fix leaks in resMolSupplierTest

* fix leaks in testChemTransforms + bug in ChemTransforms

* fix leaks in testPickler

* fix leaks in testMolTransform

* fix leaks in testFragCatalog

* fix leak in testSLNParse. Still leaks due to Smiles

* fixed most leaks in testMolSupplier

* pre bison fix

* fix some atom & bond parse problems; others still fail

* bison smiles & smarts, atoms & bonds more or less fixed

* fix leaks in molopstest.cpp

* fix leaks in testFingerprints, MACCS.cpp & AtomPairs.cpp

* fix leaks in moldraw2Dtest1

* fix leaks in testDescriptors

* fix leaks in testInchi

* fix leaks in testUFFForceFieldHelpers

* fix leaks in hanoiTest & new_canon.h

* fix leaks in testMMFFForceField

* fix leaks in graphmolTest1

* fix leaks in testMMFFForceFieldHelpers

* fix leaks in testDistGeomHelpers

* fix leaks in testMolAlign

* initialize occupancy & temp facto with default values

* fix leak in TautomerTransform

* updated suppressions

* fix testStructChecker

* fix logging & py tests

* fix TautomerTransform class/struct issue

* remove misplaced delete in testSLNParse

* deinit in testAvalonLib1

* fix Avalon-triggered(?) bug in StructChecker/Pattern.cpp

* fix random testMolWriter/Supplier fails

- diversify output file names to avoid clashing.
- unify Writers close/destruct behavior.
- flushing/closing in tests.

* use reset in FFs Params.cpp

* comments on testMMFFForceField

* unrequired 'if's added to mol suppliers

* correct cast in FilterCatalog.h

* use unique_ptr in MACCS Patterns

* remove unrequred if in new_canon

* update & move suppressions
2018-10-29 14:33:26 +00:00
Paolo Tosco
f7c888844d moved test.h from RDBoost to RDGeneral for consistency with export.h (#2074) 2018-10-11 17:35:23 -04:00
Dan N
eaa44b40c2 Enhanced stereo read/write support in SDF files. (#2022)
* add a couple test files

* backup

* first pass at some theory documentatin

* it's a draft

* Update enhanced stereochemistry documentation

Adds initial target use case and caveats about the tentative
nature of the current implementation.

* Support read/write of molfile enhanced stereochemistry

This includes reading and writing of enhanced stereochemistry
from v3000 molfiles (sdf). Enhanced stereochemistry encodes
the relative configuration of stereocenters, allowing
representation of racemic mixtures and compounds with
unknown absolute stereochemistry.

It does not include:
* Python wrapping
* invalidation of the enhanced stereochemistry
* use of enhanced stereochemistry in search
* depiction of enhanced stereochemistry.

* Update to reflect changes from #1971

* change names of enum elements to allow compilation in VS2017

I think it's also clearer to do things this way

* Addressed most review comments.

* Run missed test "testEnhancedStereoChemistry"
* In tests, added size checks to group equality checks
* Updated copyright statements
* Deleted mol created for a test
* Use perfect forwarding in RWMol::setStereoGroups()
* use references for stereo groups that are checked in write and pickle
* Updated stereogroup.h in hopes of fixing compilation on Windows.
* clang-format

* try allowing a switch to boost regex and requiring it for g++-4.8

* do a better job of that

* typo

* Code review comments. Updated Copyright notice.

* When an atom is deleted, delete stereo groups containing it.

Also updates StereoGroup toUse accessors instead of
constant member attributes. This allows move of StereoGroups.

* RDKit style guide

* Add header required on Windows.

* get the SWIG wrappers to build
2018-09-26 15:44:23 +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
3637cd4d75 Fixes Issue 1614 (#1781)
* This makes assignStereochemistry cleanIt=True not remove CIS/TRANS
bond stereo chemistry that was manually added as described in issue #1614.

Incorrect CIS/TRANS stereochemistry will still be removed by
'cleanIt=true' if symmetry is detected. However, this symmetry
detection doesn't work in more complex pseudo-stereo chemistry cases:
bond stereo that depends on other bond stereo to break symmetry; and
bond stereo that depends on other atom stereo centers to break
symmetry. Test cases for these cases have been added ifdef'd in based
on USE_NEW_STEREOCHEMISTRY.

However, getting USE_NEW_STEREOCHEMISTRY to work in a copacetic way is
not trivial, I tried a little bit here to no avail. I'm leaving the
test cases checked in as they should be useful when we decide to make
the plunge into using Canon::chiralRankMolAtoms for symmetry detection
instead of the CIP ranks.

So this fixes at least the glaring issue of STEREOCIS and STEREOTRANS
being incorrectly removed by 'cleanIt=true' when it is indeed valid
stereo. The checks made for symmetry are rudimentary, but don't feel
complete.

* add another test; make what's being tested explicit

* test smiles generation and function when Hs have been added

* add a test that fails

* I think that it's ok to remove this

* backup

* At this point all tests pass.
Bond wedging is now handled even if sanitization is turned off when mol files are read

* adjust to code changes

* fix a couple problems caused by rebase

* update docs
2018-04-01 17:48:36 +02:00
Greg Landrum
3f136946e3 Start using "*" instead of "[*]" in SMILES (#1788) 2018-03-23 15:52:52 -04:00
Brian Kelley
87dda6acd2 Fixes #1735 (#1743)
* Fixes #1735

I’m unsure if this is the correct solution, it appears
empty molecules never initialize their rings.

* Return immediately when ranking empty molecules

* Make github issue the correct one

* Always resize results to the number of atoms
2018-02-15 05:39:02 +01:00
Paolo Tosco
503b84995c - make bond stereo detection in rings consistent (#1727) 2018-02-01 04:28:10 +01:00
Greg Landrum
d15efc1ac9 Make the defaults for some functions less error prone. (#1690)
* auto generate coords in mol block writer if includeChirality = True

* default to include chirality when writing mol blocks/files

* make isomeric smiles the default; note that not all tests are passing at the moment

* update a reaction test

* update expected cartridge search results
at this point all python, c++, and cartridge tests pass

* docs

* update incompatibility docs

* update doctests

* these now build

* minor example update

* update expected c++

* typo

* make allowCXSMILES=true the default

* add auto perception of chirality when reading 3D structures from mol blocks

* explain changes in release notes

* further doc update
2017-12-22 08:09:36 -05:00
Greg Landrum
64399a46f0 Fixes github1497 (#1555)
* move detectBondStereoChemistry() into MolOps

* switch more code over to using the new function

* add an addStereoChemistryFrom3D() function. Needs testing still.

* add some tests

* cleanups and rename
2017-09-11 08:37:32 -04:00
Greg Landrum
d5fd08369b Fixes #1423 (#1424)
* Fixes #1423

* hanoTest fails; otherwise ok

* remove a redundant dir spec on input

* address comments from review

* typo

* typo (sigh)
2017-06-03 09:32:07 -04:00
Greg Landrum
f2c1a95c6e Fixes #1294 (#1302)
* Fixes #1294
There was no reason to require only two ring bonds.

* code now matches the docs
2017-02-10 08:50:28 -05:00
Greg Landrum
d0ed0e900c Fixes #803 2016-03-09 05:05:33 +01:00
Greg Landrum
e08e0d16d8 first pass, using google style 2015-11-14 14:58:11 +01:00
Greg Landrum
acf69ea1b8 Fixes #553 2015-08-09 07:19:46 +02:00
Nadine Schneider
47dbaf2304 Fix: ring stereo chemistry was swapped incorrectly 2015-02-11 18:21:15 +01:00
Greg Landrum
2d9f809770 fix some broken tests; pyDistGeom is still failing 2015-01-23 06:43:12 -05:00
Greg Landrum
6d7b2b0914 merge with master 2015-01-22 06:30:51 -05:00
Brian Kelley
95a92282d1 Dictionary access is saniztized and optimized.
o rdkit gains a RDKit::common_properties namespace that contains common string value properties

 o Dict.h and below gain getPropIfPresent that attempts to retrieve a property and returns
  true/false on success or failure.  This is used to optimize access.

 o rdkit learns how to pass property keys by reference, not value.

A new namespace has been added to RDKit, common_properties
that contains the std::string values for commonly used
properties.  This helps to avoid typos in string values
but also avoids a creation of std::strings from character
values.  All accessors (has/get/clear and getPropIfPresent) now pass
the key by reference.

Additionally, getPropIfPresent removes the double lookup
of hasProp/getProp which can be a significant speedup
in the smiles and smarts parsers (10-20%)
2015-01-15 12:23:29 -05:00
Greg Landrum
9f36ec2534 now testChirality passes 2014-12-29 07:26:25 +00:00
Greg Landrum
9d55833ec1 testChirality passes with the exception of the one test that is commented out
(testIssue2705543)
2014-12-24 06:16:20 +00:00
Greg Landrum
ab0f1dcf60 rename to new_canon (probably should come up with a better name, but this will do for now) 2014-12-22 07:56:26 +00:00
Greg Landrum
e17d93078f remove most everything from RankAtoms.h; remove RankAtoms.cpp from the files included in the build.
This compiles, but has yet to be tested.
NOTE that there are untested mods in testChirality.cpp that may not work
2014-12-22 06:58:54 +00:00
Greg Landrum
bc96ccdf1b Merge with master 2014-12-21 07:36:24 +01:00
Greg Landrum
b640be11d9 some cleanup 2014-12-19 13:49:16 +01:00
Greg Landrum
7fb24da423 merge with master 2014-09-21 21:06:40 +02:00
Greg Landrum
a94ce46a43 smiles tests now pass as well 2014-08-27 22:32:49 +02:00
Greg Landrum
e170195421 backup commit; this does not completely work yet 2014-08-03 08:01:58 +02:00
Greg Landrum
6f909ed449 switch chirality to using unsigned ints 2014-07-27 08:09:00 +02:00
Greg Landrum
0839cf41ad Fixes #210 2014-02-03 05:25:27 +01:00