- str_to_c() should check the ptr returned by malloc for non-nullness before using it
- change has_coords() mol_pkl parameter to const
- use assert.equal in JS tests where possible
Co-authored-by: ptosco <paolo.tosco@novartis.com>
* normalizeDepiction() should always center coordinates on the coordinate centroid, irrespective of the canonicalize parameter
* Update Code/GraphMol/Depictor/catch_tests.cpp
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
* fix catch test
---------
Co-authored-by: ptosco <paolo.tosco@novartis.com>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
* Add RealValueVect.
* Add UniformRealValueGrid3D
* Add Molecular Interaction Fields (MIFs)
* line endings
* cherry-pick f1bc94a4c8
* format
* Adapt tests for python3.
* Adapt RealValueVector pickling for python3.
* Speed-up of MIF calculations.
* Bugfix in MIFDescriptors.cpp.
* all tests pass
* clean up some memory leaks
* update copyrights
* rename
* rename the library
* complete the rename
* lost file
* another forgotten file
* cleanup
* clang-tidy
* clang-tidy
* windows DLL builds work
* python wrapper and tests cleanup
* convert to catch2 testing
* switch RealValueVect to use std::vector
* remove obsolete friend
* - Replace explicit loops with stdlib implicit equivalents
- Replace explicit types with auto where possible
- Avoid unnecessary copy operations where possible
- Replace raw pointers with exception-safe unique_ptr
- Replace C-style #define with constexpr
- Replace C-style casts with C++ casts
- Replace C-style arrays with std::vector
- Avoid code duplication with templated operators
- Replace VdWaals class taking multiple atom type definitions and force-field name as string parameter with force-field-specific classes deriving from an abstract VdWaals class
- Replace x,y,z doubles with Point3D class where possible
- Removed unused (and untested) DistanceToClosestAtom class
- Renamed some variables and functions for better clarity
- Converted tabs to spaces
- Made the mol parameter in cube read/write functions optional for convenience
- Made the Python wrappers more pythonic (e.g., avoid C++-style passing objects as parameters which are modified in place)
- Implemented alternative Python class constructors using boost::python::make_constructor rather than with external non-class functions
- The Python wrappers taking a sequence of Point3D now take a sequence of sequences, such that the output of Conformer.GetPositions() can be passed
- Made the Python wrapper sequence parsing more robust
- Removed duplicated code from Python wrappers
* - avoid an unnecessary copy
* progress
* works
* more cleanup
* all tests pass
* changes in response to review
---------
Co-authored-by: dfhahn <dfhahn@users.noreply.github.com>
Co-authored-by: ptosco <paolo.tosco@novartis.com>
* Allow fragments of aromatic rings to match.
* Use existing code for checking bond is in ring.
---------
Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
* make sure that loggers can be enabled, disabled, captured and tee'd from MinimalLib without issues
* changes in response to review
* change in response to review
---------
Co-authored-by: ptosco <paolo.tosco@novartis.com>
* Move atom labels round if they clash.
* Tidy.
* Re-work orientation logic.
Remove virtual fns from AtomSymbol.
---------
Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
* Handle DOS files.
* Smaller test file.
Add DOS file to .gitattributes.
* Update Code/GraphMol/SynthonSpaceSearch/substructure_search_catch_tests.cpp
---------
Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
* - Fix#8029
- avoid unnecessary rounding errors in the JSON writer
- remove a warning when compiling MinimalLib without SubstructLIbrary support
* changes in response to review
* changes in response to review
---------
Co-authored-by: ptosco <paolo.tosco@novartis.com>
* First pass at splitting molecule.
* Interim commit. Reading libraries from file in original format.
* Basic search seems to be working.
* Pattern fingerprint screening.
* Connector region heuristic.
* Fixed triazole (aromatic/non-aromatic connectors).
* Fix search with non-split parent query, where query is substructure of a single reagent.
* Remove duplicate hits by reaction/reagents used.
* Implement largest fragment heuristic.
* Extra test files.
* Read/write binary file.
Program for conversion from text format to binary format.
* Remove empty reagent sets on reading, probably due to synthon number counting from 1 rather than 0.
* Tidy SSSearch functions.
* Stash pending major surgery for triazole bug.
* Revert to using unique_ptr.
Correct use of reagent order.
* Function to summarise Hyperspace.
* Delay building hits till end and put cutoff on number.
* Earlier bale-out in getHitReagents.
* Streamline checkConnectorRegions.
* Remove free functions for search.
* Correct name of Python test.
* First stage of Python wrappers.
* Rename namespace.
* Parameters object.
* Mysterious windows export thing.
* Fix bug - not matching number of connectors in fragment and synthon.
* Back like it was. The connector count wasn't the problem.
* Put the substructure results into their own class.
* gcc 14 didn't like my use of std::reduce.
Update expected test results.
* Remove write statement.
* Tidy.
* Tidy.
* Enable random sample of hits.
* Test that complex SMARTS works.
Update Python wrappers.
* Rename Hyperspace to SynthonSpace.
* More renaming.
Python test.
* Enable Python test.
Remove write.
* Plug memory leak.
* Response to Greg's initial look.
* More response to Greg's initial look.
* get the windows DLL builds working
* Do away with mutable.
Purge a few more uses of reagent in favour of synthon.
Remove the c++ exe for converting text to binary databases.
* Better Synthon c'tor.
* More feedback from Greg.
* Tidy the Python wrapper.
* Remove tags from catch tests.
* Don't allow copying of SubstructureResults.
* Revert to allow copying of SubstructureResults. The Python wrapper needs it.
* Refinements based on CLion/clangd suggestions.
* Allow for map numbers in connectors in space file.
* Refactor to make the searcher a separate class from the space.
* Transfer Greg's review suggestions from Hyperspace merge.
* First cut of fingerprint searcher.
* Python wrapper.
Some tidying.
* Better random selection.
* Fix bug in preparing frags for fingerprints.
Re-factor.
* Minor-refactor.
* Sort hits by similarity if available.
* Option for a few different fingerprint types. Pending a better solution.
* Write fingerprints to binary file.
* Use any fingerprint generator for similarity searching. No Python wrapper yet.
* Python wrapper.
* Change random selection to use distribution weighted by number of hits in each reaction.
* Lots of suggestions from CLion/clang.
* Use boost discrete_distribution for cross-platform consistency.
* Tidy test up.
* Try boost rng as well.
* uniform_int_distribution to boost also.
* Small tidy.
* Method to write enumerated library.
* Windows export thing.
* Windows export thing.
* Allow for commas in tab-separated fields.
* win64 dll builds now work
* More aliphatic synthon, aromatic product joy.
* Force ring finding if it hasn't been done.
* Fingerprint hits not being sorted if maxHits reached.
* Remove debugging write. Doh!
* Response to review of SynthonSpace2.
* Missed one.
* Add test file.
* Hand merge Greg's #8050.
* Discard nodiscard.
* Move include of export.h inside include guards.
* Response to review.
* Fix memory leaks.
---------
Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
* Fix for connector regions and missing ringinfo.
* Merge in the fix for comma-separated names in tab-separated space files.
* Response to review.
---------
Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
The explicit default constructor actually blocks the other
defaults. It also means this is no longer a "plain struct",
and so designated initializers aren't available.
I wanna be able to do:
Compute2DCoordParameters params{.useRingTemplates = true};
Or even:
RDDepict::compute2DCoords(*mol, {.useRingTemplates = true};
* [fix] re: issue #7572; added precondition check to prevent setting a root atom when more than one fragment exists
* tests for #7572, precondition rootAtAtom if more than one fragment exists
* test the fix to issue #7572
* [fix] moved the precondition to a block which get atom at index to prevent unhandled exceptions, MHFP tests pass now
---------
Co-authored-by: Eric Boittier <ericdavid.boittier@unibas.ch>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
* Catch exceptions in MultithreadedMolSupplier callbacks
* In next(), simply ignore any exceptions from nextCallback.
* In reader(), if readCallback throws, log a warning and proceed using
the unmodified record.
* (The writer() was already handling exceptions from writeCallback.)
* Remove unused parameter names
Hopefully this will placate the warning/error settings used by the Linux
build.
* throw if close to zero
* fix moldraw2DTestCatch
* Fix testRGroupDecomp
* fix one test in distGeomHelpersCatch
* fix tests in distGeomHelpersCatch
* retry finding a dir vector when adding Hs
* push UFF fixes to calculateCosY
* fix the setTerminalAtomCoords deg 4 patch
* add a test
* reduce zero tolerance
* First pass at splitting molecule.
* Interim commit. Reading libraries from file in original format.
* Basic search seems to be working.
* Pattern fingerprint screening.
* Connector region heuristic.
* Fixed triazole (aromatic/non-aromatic connectors).
* Fix search with non-split parent query, where query is substructure of a single reagent.
* Remove duplicate hits by reaction/reagents used.
* Implement largest fragment heuristic.
* Extra test files.
* Read/write binary file.
Program for conversion from text format to binary format.
* Remove empty reagent sets on reading, probably due to synthon number counting from 1 rather than 0.
* Tidy SSSearch functions.
* Stash pending major surgery for triazole bug.
* Revert to using unique_ptr.
Correct use of reagent order.
* Function to summarise Hyperspace.
* Delay building hits till end and put cutoff on number.
* Earlier bale-out in getHitReagents.
* Streamline checkConnectorRegions.
* Remove free functions for search.
* Correct name of Python test.
* First stage of Python wrappers.
* Rename namespace.
* Parameters object.
* Mysterious windows export thing.
* Fix bug - not matching number of connectors in fragment and synthon.
* Back like it was. The connector count wasn't the problem.
* Put the substructure results into their own class.
* gcc 14 didn't like my use of std::reduce.
Update expected test results.
* Remove write statement.
* Tidy.
* Tidy.
* Enable random sample of hits.
* Test that complex SMARTS works.
Update Python wrappers.
* Rename Hyperspace to SynthonSpace.
* More renaming.
Python test.
* Enable Python test.
Remove write.
* Plug memory leak.
* Response to Greg's initial look.
* More response to Greg's initial look.
* get the windows DLL builds working
* Do away with mutable.
Purge a few more uses of reagent in favour of synthon.
Remove the c++ exe for converting text to binary databases.
* Better Synthon c'tor.
* More feedback from Greg.
* Tidy the Python wrapper.
* Remove tags from catch tests.
* Don't allow copying of SubstructureResults.
* Revert to allow copying of SubstructureResults. The Python wrapper needs it.
* Refinements based on CLion/clangd suggestions.
* Allow for map numbers in connectors in space file.
* Response to review.
* update binary file spec
* Changes after review.
---------
Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
* Expose tautomer scoring functions to python
* Add more tests/documentation
* Rename getDefaultTautomerSubstructs to getDefaultTautomerScoreSubstructs
* Remove ROMOL_SPTR
* Add full custom scoring function example
* Run clang format
* Use proper BOOST_PYTHON_FUNCTION_OVERLOADS
* Use default copy constructor
* Use new Morgan fingerprint generator.
* Add script to build fragments database and amend score script to use it.
* Remove redundant imports.
* Response to review.
* Clarify interaction of canonical and random in MolToSmiles.
---------
Co-authored-by: Dave Cosgrove <david@cozchemix.co.uk>
* Implements #TODO
This attempts to improve the SMILES parsing procedure to provide more
information about bad inputs by pointing to general location of the offending token.
The improved error messages currently only apply to syntax errors, inputs with
extra close parentheses, and inputs with too large numbers, but this will
provide a way to extend that in the future
Some examples of the improved error messages
| old version | new version |
|----------------------------------------|------------------------|
|syntax error while parsing: c%()ccccc%() | syntax error while parsing input:<br /> `c%()ccccc%()` <br /> `~~~^` |
|syntax error while parsing: c%(100000)ccccc%(100000) | syntax error while parsing input: <br /> `c%(100000)ccccc%(100000)` <br /> `~~~~~~~~^` |
|syntax error while parsing: COc(c1)cccc1C#|syntax error while parsing input: <br /> `COc(c1)cccc1C#` <br /> `~~~~~~~~~~~~~^` |
|extra close parentheses while parsing: C) | extra close parentheses while parsing input: <br /> `C)` <br /> `~^` |
| extra close parentheses while parsing: C1C)foo | extra close parentheses while parsing input: <br /> `C1C)foo` <br /> `~~~^` |
| number too large while parsing: [555555555555555555C] | number too large while parsing input: <br /> `[555555555555555555C]` <br /> `~~~~~~~~~~^` |
This was achieves by extending the lexing and parsing procedure to track
the current token position with a new variable, so the reported position
may not be 100% accurate at all times but should be helpful in reducing
the amount of work done to find the bad location.
Additionally, I updated the build instructions to strip the #line macros
from the generated C++ files, which required a modern flex/bison
versions.
* fix build failure on windows
* static vars are not captured implicitly
* copy generated files to fix windows build failure
* fix long input truncation
* copied the wrong files again :(
* Review suggestions
* update error messges for extra open brackets
These aere example error messages:
```
[09:54:03] SMILES Parse Error: extra open parentheses while parsing: C1CC1(CC
[09:54:03] SMILES Parse Error: check for mistakes around position 6:
[09:54:03] C1CC1(CC
[09:54:03] ~~~~~^
[09:54:03] SMILES Parse Error: Failed parsing SMILES 'C1CC1(CC' for input: 'C1CC1(CC'
[09:54:03] SMILES Parse Error: extra open parentheses while parsing: C1CC1(CC(CC
[09:54:03] SMILES Parse Error: check for mistakes around position 6:
[09:54:03] C1CC1(CC(CC
[09:54:03] ~~~~~^
[09:54:03] SMILES Parse Error: extra open parentheses while parsing: C1CC1(CC(CC
[09:54:03] SMILES Parse Error: check for mistakes around position 9:
[09:54:03] C1CC1(CC(CC
[09:54:03] ~~~~~~~~^
```
* fix bad merge artefact.
* FingerprintGenerator improvements
1. simplify construction by adding ctors taking FingerprintArguments
2. remove inexplicable boost::noncopyable from FingerprintArguments
* Switch FingerprintType to be an enum class
* Fixes#7521
* dumb mistake
* initialize everything
* get the defaults right
* Update Code/GraphMol/ChemReactions/ReactionFingerprints.cpp
Co-authored-by: Paolo Tosco <paolo.tosco.mail@gmail.com>
---------
Co-authored-by: Paolo Tosco <paolo.tosco.mail@gmail.com>