Commit Graph

36 Commits

Author SHA1 Message Date
Ricardo Rodriguez
e3f2e4651e Refactor iostreams includes (#8846)
* refactor iostreams includes

* restore ostream to MonomerInfo.cpp
2025-10-31 13:42:16 +01:00
Ricardo Rodriguez
3eb71c50ca A few mem fixes in tests (#8521)
* mol suppliers leaking mols on multiple tests

* test leaks query
2025-05-13 12:17:52 +02:00
David Cosgrove
9b058c263b Github8353 (#8354)
* Add PRECONDITION for attempt to expand empty query.

* Improved test, maybe.

---------

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
2025-03-17 19:54:15 +01:00
Eisuke Kawashima
11532089de Run clang-format against cpp (#4358) 2021-10-20 04:25:27 +02:00
Greg Landrum
4c2a580ad1 Fixes github #4311 (#4312)
* a bit of simple refactoring

* Fixes #4311

- adds getValenceContrib() to QueryBond
- adds hasBondTypeQuery() and hasComplexBondTypeQuery() to QueryOps namespace
- atoms with complex bond type queries now have explict and implicit valences of 0
- adds tests for the above

* add a test
2021-07-09 15:06:54 +02:00
Greg Landrum
9991c5247a cleanup of the SMILES/SMARTS parsing and writing code (#2912)
* first cleanup

* next round of changes. all tests pass

* Fixes #2909

* Fixes #2910

* further cleanup

* some cleanup/refactoring of the Dict class

* remove now extraneous calls to hasProp() before clearProp()

* minor refactoring of RDProps.h

* Switch from using our own version of round() to std::round()

* replace some boost::math stuff with the equivalents from std::

* cleanups in SmartsWrite

* refactor out a bunch of duplicated code

* fix an instance of undefined behavior

* changes in response to review
2020-01-29 15:13:39 +01:00
Brian Kelley
b6e5bdd111 Fix/rgroup sdf isotope (#2449)
* update version of japanese docs

* Remove external labels from cores

* Fix syntax errors

* Add better autodetection of labels, add dummyatom label, don't fall back to indexes when onlyMatchAtRgroups are set

* Add better autodetection of labels, add dummyatom label, don't fall back to indexes when onlyMatchAtRgroups are set

* Move autodetection before alignment, fix final core labelling

* Fix stupid bit twiddling mistake

* None of the original mol's should actually match the cores with onlyMatchAtRgroups

* Convert PRECONDITION to CHECK_INVARIANT

* Run clang-format

* use nullptr instead of 0 for pointers

* Handle cases where molecules don't have anything for an R-group properly.

Here's the python demo of the bug:

```
In [14]: scaffold2 = Chem.MolFromSmiles('c1c([*:1])cncn1')

In [15]: scaffold = Chem.MolFromSmiles('c1c([*:1])cccn1')

In [19]: mols2 = [Chem.MolFromSmiles(smi) for smi in 'c1c(F)cc(O)cn1 c1c(F)cncn1 c1c(Cl)cc(O)cn1'.split()]

In [20]: print(rdRGroupDecomposition.RGroupDecompose([scaffold,scaffold2],mols2,asSmiles=True,asRows=False))
({'Core': ['c1ncc([*:2])cc1[*:1]', 'c1ncc([*:1])cn1', 'c1ncc([*:2])cc1[*:1]'], 'R1': ['F[*:1]', 'F[*:1]', 'Cl[*:1]'], 'R2': ['[H]O[*:2]', '[H]O[*:2]', '']}, [])
```

* Fixes #2471
2019-06-04 15:41:20 +02: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
Greg Landrum
dfae8377dd Some optimization of the queries constructed from SMARTS (#1940)
* Fixes #1929

* add a tests to make sure bogus template directories work

* add a combined atomic number + aromaticity query operation to speed up SMARTS matches
Still needs to be recognized by the SMARTS writer, serialization, and no doubt a few other places.

* add a combined query for the single/aromatic bond query that shows up in SMARTS

* Stop using a dead pointer in the when parsing Marvin SMARTS in a CTAB

* At this point all tests pass on windows

* debugging info back in

* update the bison output
2018-06-30 20:22:06 -04: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
42eecc664d Integrate Coordgen (#1708)
* first pass, does not yet actually work

* pass2, same problems

* pass2, same problems

* another test

* new tests; bugfix

* move the code out to a header

* add a double bond example

* enable auto-downloads of the code

* move the function to its own namespace

* first pass at a basic python wrapper

* change coordgen commit used

* try supporting bond stereo; does not currently work

* cis/trans seems to now work.

* first pass at templates; needs testing

* use the fixed flag too

* need mol align

* expand test

* initial pass at python wrapper for template

* simplify tests

* add an option to directly use a substructure match for alignment

* scaling

* add #define

* Define a cache setting for RDK_COORDGEN_LIBS to allow these to be used in other packages

* return the conformer id from addCoords

* Make CoordGen the default when it’s available.
This is a backup commit… the tests don’t even come close to passing.

* add some debugging options for a bit

* add alignment step to testing when using non-fixed coords

* Add global to allow use of CoordGen to be disabled
get the basic depictor tests working

* make coordgen the default when it is available

* make sure things continue to work when coordgen is disabled

* get windows builds working

* mods to get this building on windows.
something is screwy with the fileParsersTest1

* no need to generate coords for the 1K C string

* fix java wrappers

* works on linux

* update the (stupid) way dependencies were handled on windows.
this allows a lot of cleanup of cmake files (still more to do)
the linux build is unlikely to work due to the way _statics aren't handled

* docs

* extend forceRDKit applicability

* switch coordgen version

* try using templates

* try to get the template dir finding reasonably robust w.r.t. conda install

* continuing to iterate on the way the template file is installed

* fix a problem caused by the merge

* remove test that should never have been checked in

* update expected results for cartridge tests

* switch back to using the RDKit as the default coordinate generator
2018-02-15 05:36:03 +01:00
Greg Landrum
ba12d98ad0 Removes ATOM/BOND_SPTR in boost::graph in favor of raw pointers (#1713)
* Removes ATOM/BOND_SPTR in boost::graph in favor of raw pointers

* Actually delete atoms and bonds...

* RWMol::clear now calls destroy to handle atom/bond deletion

* Changes broken Atom lookup for windows/gcc

* Adds tests for running with valgrind

* Adds test designed for valgrind and molecule deletions

* Removes RNG, actually tests bond deletions

* update swig wrappers

* deal with most recent changes on the main branch
2018-01-07 14:19:47 -05:00
Greg Landrum
4049814132 Support some cactvs extensions to SMARTS (#1704)
* add queries for the number of heteroatom neighbors

* support cactvs "z" extension
this includes support for range queries on z that could
be extended to other query types as well

* extend range query extension to other SMARTS primitives

* add the less-than and greater-than versions of the range queries

* updates and new tests

* update .cmake files

* support [#6] in SMILES

* document SMILES extensions (such as they are)

* Add support for cactvs's Z queries

* add support for ^4 and ^5

* get tests running
doc update

* book updates

* update .cmake files
2018-01-04 12:00:39 -05:00
Greg Landrum
7c0bb0b743 clang-tidy output 2017-04-22 17:09:24 +02:00
Greg Landrum
6745264a82 Adds some additional canned atom and bond query definitions (#1047)
* atoms: radical electrons and presence of a chiral tag

* bonds: presence of stereo

* add new atom queries to python wrapper

* add queries for missing atom chiral tags
2016-09-09 10:31:02 -04:00
Greg Landrum
e08e0d16d8 first pass, using google style 2015-11-14 14:58:11 +01:00
Greg Landrum
797db2fa82 remove Atom::setMass() 2015-03-22 17:57:04 +01:00
Brian Kelley
7fcf0bda9e RDKit learns how to query Atom/Bond properties
QueryBond qB;
  qB.setQuery(makePropQuery<Bond, double>("foo", 2));

  QueryAtom qA;
  qA.setQuery(makePropQuery<Atom, string>("foo", “bar”));
2015-02-27 08:28:17 -05:00
Brian Kelley
7a8df171d0 RDKit learns how to query properties on Atoms
Examples:

    QueryAtom qA;
    qA.setQuery(makeAtomHasPropQuery("foo"));

    QueryAtom qA;
    qA.setQuery(makeAtomPropQuery<double>("foo", 2));

    QueryAtom qA;
    qA.setQuery(makeAtomPropQuery<std::string>("foo", "bar"));
2015-02-25 15:28:34 -05:00
Greg Landrum
eb15c98f97 clean up some leaks in one of the tests 2014-06-23 21:14:54 +02:00
Greg Landrum
34ab68ca2a introduce QueryBond::QueryMatch, as with QueryAtoms;
all tests passing;
performance tests still needed
2014-05-07 05:29:25 +02:00
Greg Landrum
924fc373ef Fixes #165 2013-12-31 07:52:08 +01:00
Greg Landrum
53e37810ba initial tests 2013-12-14 10:17:49 +01:00
Greg Landrum
b45423be3e rename makeAtomNumEqualsQuery() to makeAtomNumQuery() 2013-12-14 09:14:57 +01:00
Greg Landrum
4a14a52674 Fixes #153 2013-11-15 06:47:18 +01:00
Greg Landrum
a99ad44859 clean up some compiler warnings 2011-12-31 15:58:57 +00:00
Greg Landrum
3b3d44db16 remove exe property from source files 2011-01-13 04:22:56 +00:00
Greg Landrum
f3fbef45c5 update copyright statements 2010-09-26 17:04:37 +00:00
Greg Landrum
2eb3f1f39f test issue2892580 2010-01-14 16:08:21 +00:00
Greg Landrum
9cabf87374 remove vflib from Jamfiles
remove const specifiers from return values in DataStructs
add initial pass at query-query matching for Atoms and Bonds
fix and test for sf.net issu 2738320
add Mol.AddRecursiveQuery() method to Mol
2009-06-29 11:47:38 +00:00
Greg Landrum
d99c43df74 remove obsolete FIX comment; make this a bit more robust to fp error 2008-08-13 06:38:02 +00:00
Greg Landrum
57be4a92ef This is a fix for sf.net issue 1968930:
http://sourceforge.net/tracker/index.php?func=detail&aid=1968930&group_id=160139&atid=814650

In order to fix the problem, the value of the query function for atomMass queries
is being multiplied by a constant factor (currently 1000) before converting
to an int. This allows distinguishing between things like [CH4] (where the
C has mass 12.011) and [12CH4] (where the C has mass 12.000).
2008-08-13 04:56:48 +00:00
Greg Landrum
a3e6cb057e this is a mass of cleanup stuff; mostly line endings 2008-07-07 13:21:24 +00:00
Greg Landrum
5d03333c22 setup svn keywords (should have done this before import... grn) 2006-05-06 22:54:39 +00:00
Greg Landrum
75a79b6327 initial import 2006-05-06 22:20:08 +00:00