Commit Graph

550 Commits

Author SHA1 Message Date
Greg Landrum
2ee798ddca Add support for the rest of the v3000 atom properties (#3007)
* Add convenience functions for generating v3K mol blocks and mol files

* first pass at parsing/writing the remaining atom properties from the CTAB spec

* handle SUBST

* write out the bond props that were being read but not written

* add an additional test

* fix a couple of problems caught in review
2020-03-14 04:58:07 +01:00
Greg Landrum
1dc9ac3fbf adds a one-liner for getting a vector of random smiles for a molecule (#3002)
* first pass at random smiles vector; c++ version

* add python wrappers for that

* Remove accidental change

* switch to using a cross-platform reproducible RNG
2020-03-12 13:10:29 -04:00
Brian Kelley
4c1ea25fda Fix a hang when trying to read mols from a directory not a file on linux (#2983)
* Fix a hang when trying to read mols from a directory not a file on linux

* thrown an exception at construction time

* clarify the readme

* update release notes

* Refactor the stream opening and checking code to a common method

Co-authored-by: Brian Kelley <bkelley@relaytx.com>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2020-03-09 15:27:58 +01:00
Greg Landrum
a2767d9f7d Allow custom post-match filters for substructure matching (#2927)
* backup, does not work

* working on the C++ side

* backup

* fix the API

* document the new functionality

* improve that example

* final bit of cleanup

* switch to std::function
2020-02-04 11:22:38 -05: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
68e8f10b95 Fixes #2510 (#2907)
* Fixes #2510

* Changes in response to review

* Use CoordsAsDouble, rev version

* Confs->coords in documentation

* conformations->coordinate
2020-01-28 05:07:31 +01: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
Greg Landrum
ec366c1ab7 Dev/pvs studio cleanups2 (#2877)
* a round of cleanups courtesy of PVS studio

* add a test to make sure that a warning is a false alarm

* bug fix

* Fix a UFF bug

* more PVS studio cleanups

* next round of PVS studio cleanups

* completely remove the chances for that bug

* changes in response to review

* add an additional test
+ a bit of reformatting that snuck in
2020-01-22 15:10:58 +01:00
Greg Landrum
0b670d24e4 Fixes #2878 (#2880)
* cleanup and documentation

* add option to ignore CXSMILES parse failures
2020-01-20 14:38:32 +01:00
Greg Landrum
a32016d665 Fix #2848: add options to control removeHs (#2872)
* backup commit; won't even compile

* backup commit

* Fixes #2848

* A few changes
- add a bunch of tests
- some fixes
- add ROMol version to API

* add python wrapper and associated tests

* add RemoveAllHs()

* changes in response to review
- add removedMapped option
- add docstrings for options

* changes in response to review
2020-01-16 16:48:43 +01:00
Greg Landrum
a75018fe38 Cleanups and additional tests to improve test coverage (#2852)
* disable builds of the StructChecker code by default

* operator"" _smarts() doesn't need to catch sanitization errors

* remove unused function

* turn back on some tests that shouldn't have been disabled

* Remove unused code from SMARTS parser and simplify a bit

SmilesParseOps::AddFragToMol is now used only from the SMARTS parser, so we can simplify the API

* Removes obsolete special case code for SMARTS

This was relevant when organic atoms in SMARTS queries were stored as two-part queries.

* improve SMARTS testing

make sure we can generate SMARTS from all the examples and then parse that again.

* Fixes #2814

* Fixes #2815

* some additional smarts tests to improve coverage

* test copy ctor and getPos

* remove obsolete test_list files

* include tests for the morgan invariant generators

* more cleanups and coverage improvements

* remove files that were mistakenly added
2020-01-09 16:07:55 -05:00
Eisuke Kawashima
5cd27a242f Fix typo (#2862)
* Fix typo

* Reflect the comments

* Fix more typos
2019-12-31 06:43:27 +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
Eisuke Kawashima
7599b5fb14 Tidy Up (#2834)
* Replace obsolete `throw()` with `noexcept`

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0003r4.html

* Avoid deprecated tempfile.mktemp

https://docs.python.org/3/library/tempfile.html#deprecated-functions-and-variables

* Fix "warning: control reaches end of non-void function"
2019-12-18 16:44:55 +01: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
Greg Landrum
5de8007b43 Merge branch 'e-kwsm-misc' 2019-10-25 04:49:23 +02:00
Greg Landrum
e49317bfcb merge 2019-10-25 04:48:08 +02:00
Greg Landrum
c988dc4c68 Cleanup some unintended consequences of #2553 (#2735)
* backup

* output bond stereoAtoms in debugMol()

* stop removing STEREOCIS/STEREOTRANS markers in setDoubleBondNeighborDirections()

* Re-establish bond dirs in reaction products.

* test all that
(the first set of tests, should do more)

* cleanups

* add SetDoubleBondNeighborDirections() to python API and test it

* add more tests

* changes in response to review

* add another c++ test, fix the java tests
2019-10-25 04:31:06 +02:00
Eisuke Kawashima
9d10c7c4b7 Change line ending from CR+LF to LF [ci skip] 2019-10-21 11:39:25 +09:00
Greg Landrum
78ac90da3d update supplier documentation to reflect python 3 iterator syntax (#2719) 2019-10-17 12:05:36 -04:00
Eisuke Kawashima
dc7cc84a0c Fix typo [ci skip] 2019-10-17 17:45:50 +09:00
Greg Landrum
e5620e0c57 [WIP] Make StructureGroups editable from Python (#2692)
* first steps towards StructureGroups being editable in Python

* typo fix

* Add initial features to allow editing SGroups from Python.

* update test

* typo
2019-10-15 22:32:26 -04:00
Ric
d0de1298bf Fix set stereo bond labels to SMARTS mol (#2704)
* fix

* add test

* change variable names

* expose setBondStereoFromDirections() to Python

* additional testing
2019-10-14 15:57:46 +02:00
Greg Landrum
728a9e9ca0 Fixes #2639 (#2698)
Required some changes to the StereoGroups wrapper code too
2019-10-10 10:24:20 -04:00
Eisuke Kawashima
185ec927ab Unset executable flag 2019-10-10 20:18:43 +09:00
Greg Landrum
253f172353 Allow identification of chemistry problems (#2587)
* add AtomValenceException

* refactor a bit and add KekulizeException

* add copy ctor and copy() method

* add detectChemistryProblems

* add getType() method
want to be able to get the type of the exception without requiring doing a bunch of dynamic casts

* first pass at exception inheritance/translation
needs some cleanup and expansion, but this does pass all tests.

* cleanup and finish the python wrappers for the new exceptions

* make sure things are truly polymorphic

* wrap shared_ptrs of the new exception types

* expose DetectChemistryProblems()

* get the java wrappers building again

* transfer those changes to the c# wrapper

* add detectChemistryProblems()
and deal with the fun fun exception inheritance things that ensue

* response to review
2019-08-28 14:15:55 -07:00
Brian Kelley
80f3390b0b Fix/github2611 (#2612)
* Fix CanonicalRankAtomsInFragment API, adds includeChirality, includeIsotopes

* Add testGithub2611

* Update python doc string

* Ensure isotopes are being ignored when requested

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

* Need to use all atoms for test
2019-08-23 14:01:55 -07:00
Greg Landrum
8388ab7d7c raise ValueErrors when constructing streambuffs with the incorrect type. (#2592)
* First pass at enforcing streambuf types on object creation

* make this work on windows
2019-08-19 11:27:47 -04:00
Ric
06f79666c1 Use the same criteria to flip chiral atoms in SMILES parsing/writing (Fixes #1028) (#2600)
* symmetrize SMILES read/write chirality flipping

* fix bad escape

* fix test ???

* add a test

* add mol in #1028

* fix sequence test: consider imp. valence in chiral flip decision

* restore Code/GraphMol/Wrap/rough_test.py
2019-08-15 07:47:27 +02:00
Dan N
e0f6119589 Adds MolFragmentToSmarts to generate smarts for a subset of a Molecule (#2594)
We have MolFragmentToSmiles already. But I think that when talking
about a fragment or part of a molecule, maybe SMARTS makes more
sense. If I see a SMILES string, I'll definitely think that
it should be a valid molecule, but I have no such
presumption about SMARTS.

Additionally, Schrodinger software sometimes generates SMARTS
for selection using a set of atoms picked in a GUI. It will
be useful to generate these SMARTS using RDKit.
2019-08-15 05:09:56 +02:00
Greg Landrum
dd21db1b06 Integrate Unique Ring Families from RingDecomposerLib (#2558)
* add the ring decomposer lib (temporarily?)

* simplify makefile

* very basics work

* backup

* 	basics working

* builds and basic tests pass

* get this building again

* expose the ring families

* add tests on the python side

* make the pywrapper for this optional

* remove some extra bits

* cleanup

* switch to using RDL as an external project

* make sure this still works if we do not use the URF code

* remove BUILD_ALWAYS

* fix linkage of Java wrapper and cartridge (hopefully)

* fix cmake for wrappers (hopefully)

* forgot a semicolon

* try to force URF lib to build first

* improve memory management and interface

* fix dependency specifier

* make pointer initialization explicit

This may not be necessary, but it feels safer.

* not pleasing and needs to be cleaned up
but it builds

* not pleasing and needs to be cleaned up
but it builds

* cleanup in preparation for merging

* cleanup in preparation for merging

* switch to rareylab repo

* fix updated copyright date

* Fix updated copyright date

* switch to a specific library tag

Co-Authored-By: Florian Flachsenberg <flachsenberg@zbh.uni-hamburg.de>

* change in response to review
2019-07-30 06:41:55 -04:00
Paolo Tosco
f2eb894a08 - fixes ResonanceMolSupplier bug in perceiving conjugated groups (#2517)
* - fixes ResonanceMolSupplier bug in perceiving conjugated groups

* - addresses comments to PR #2517
2019-07-23 08:03:24 -04:00
Eisuke Kawashima
b2f755e64b Support XYZ format for output (#2498) 2019-07-12 05:26:42 +02:00
Peter St. John
871940fc45 fix to SDWriter docs (#2521)
The previous SDWriter docs for writing to a gzipped object throws an error in python3. From the mailing this, 'wt+' seems to work fine.
https://sourceforge.net/p/rdkit/mailman/message/36406080/
2019-07-12 05:23:12 +02:00
Dan N
378a223d66 Python wrap enhanced stereo setters (#2509)
* Allow creation of Enhanced Stereo groups from Python

This wraps creation of Enhanced Stereo groups from Python. It
also allows setting enhanced stereo groups on an RWMol from
Python.

Additionally, this provides a little function to allow C++
vectors to be wrapped for Python, but allow Python list objects
or wrapped C++ vectors to be used as arguments to functions
that take vectors as inputs. I added it only to
Wrap/StereoGroup.cpp, but I _think_ that I should add this
logic to RegisterVectorConverter in RDBoost/Wrap.h. If I
did that, I'd be able to remove a couple of lines in Wrap/Mol.cpp

* enforce atom ownership in SGroups
Some cleanups to make sure you can't add an S group with bogus atoms
to a molecule

* Remove constructor for StereoGroup.

I tried very hard to convince boost Python to allow me to use
with_custodian_and_ward_postcall on an init, and it just never
worked. I've removed the constructor - folks will need to
use the factory function "CreateStereoGroup" if they want
a StereoGroup.
2019-07-03 10:24:26 +02:00
Greg Landrum
6e838e3df3 Fixes #2479 (#2482)
* Fixes #2479

* a bit of cleanup

* catch some additional fun edge cases

* change in response to review
2019-06-07 12:44:51 -04:00
Francois Berenger
7ec8ec0bb9 Vdv radii from blue obelisk (#2154)
* updated atomic radii to follow the Blue Obelisk Data Repository

Ubuntu package bodr version 10-1; radii are from file
/usr/share/bodr/elements.xml

* typo

* use 2.0 as default VDW radius instead of 1.7

for elements missing from the Blue Obelisk Data Repository

* Document the atomic_data

* update expected test results

* update java tests

* allow a bit more slop when comparing confs

For cross-platform stability
2019-05-29 09:23:27 +02:00
Greg Landrum
bc0b177ceb Fixes #2450 (#2457)
* Fixes #2450
adds `hasOwningMol()` to the public API for Bond and Atom

* add to other classes;
add to python wrappers

* get the smiles generation partially working

* changes in response to review
2019-05-22 09:23:44 -04:00
Greg Landrum
060bc7c519 Fixes #2436
A bunch of other doc formatting tweaks are in there too
2019-05-13 11:01:59 +02:00
Greg Landrum
0ea29df940 Fixes #2441 (#2443)
* add RDProps mixin class to Conformer

* test pickling

* add the props interface to the python wrapper for Conformers
2019-05-09 11:25:40 -04:00
Greg Landrum
ec31bea97b clang-tidy-7 pass (#2408) 2019-04-16 12:05:47 -04:00
Paolo Tosco
6046bb2d03 - avoid a build failure on Windows (#2399)
* - avoid a build failure on Windows

* - fix compilation error when building compressed suppliers

* - fix accidental commit

* - proper fix
2019-04-07 11:38:26 +02:00
Brian Kelley
46d68bbe67 Add ExplicitBitVect prop and query (#2384)
* Add ExplicitBitVect prop and query

* Fix for review comments
2019-04-03 04:46:14 +02:00
Greg Landrum
5a79190261 rename SGroup -> SubstanceGroup (#2375)
We leave the names of the bit connected with Mol files as SGroups, since that is
appropriate there, but the more generic pieces are renamed
2019-03-30 14:53:24 -04:00
Dan N
10c3488441 #2329 wrap detect atom stereochemistry (#2351)
* Move DetectAtomStereoChemistry to Molops::assignChiralTypesFromBondDirs

DetectAtomStereoChemistry in MolFileStereochem is more broadly
useful. Additionally, it was not named very clearly for what
it was actually doing.

* Wraps assignChiralTypesFromBondDirs for use in Python

Makes assignChiralTypesFromBondDirs available in Python
and adds a test demonstrating that availability.
2019-03-19 10:54:28 +01:00
Greg Landrum
b739a2c208 Add a read-only Python wrapper for SGroups (#2343)
* added a set of test files for SGroups.
Many thanks to Gerd Blanke for providing these

* Partial version of the wrapper
Definitely needs more work

* add some properties

* basic SGroup property change test

* not working; backup commit

* disable writing for now

* add ClearMolSGroups() function

* review response: add a couple missing methods

* remove spaces from filenames

* update filename in test

* changes in response to review

* add operator== to SGroups

* solve lifetime problems with a vector_indexing_suite
2019-03-15 08:50:32 -04:00
Ric
6224a42516 Build warnings revisited (#2318)
* unused vars in bison parser cleanup

* initialization order in TopologicalTorsionGenerator

* unused params in SLN bison

* sln flex unused params

* throwing destructor in TDTWriter

* signed comparison in substructmethods

* unused input param in smiles/smarts bison

* unused ms param in sln bison

* signed comparison in FingerprintGenerator

* store return of fscanf in StructCheckerOptions

* unreferenced var in catch

* uninitialized value in FileParserUtils

* avoid override overload warning in MolDraw2DSVG

* non-final overrides in Validate.h

* unused static var in Avalon

* unused vars in catch blocks

* make AvalonTools avalonSimilarityBits & avalonSSSBits const int

* assert fscanf result in StructCheckerOptions
2019-03-08 16:42:54 +01:00
Dan N
3095d08cd1 Allow copying atoms in Python (#2322)
* Allow Atoms to be copyied in Python.

The dunder copy method is the idiomatic way to support
making copies in Python. Includes a test to make sure that
copied atoms are usable.

* Use RWMol in Code/GraphMol/Wrap/rough_test.py

Co-Authored-By: d-b-w <dan.nealschneider@schrodinger.com>

* Allow access to an atom's copy constructor in Python
2019-03-08 10:05:16 -05:00
greg landrum
92ca0da5f9 Merge branch 'doc-update' of https://github.com/greglandrum/rdkit into greglandrum-doc-update 2019-03-07 21:15:00 +01:00
Greg Landrum
24f1737839 Remove a bunch of Python2-related warts (#2315)
* remove all of the "from __future__" imports

* remove the first batch of rdkit.six imports/uses

* next step of rdkit.six removal

* removing xrange, range, and some maps

* next round of removals

* next round of cleanups

* fix inchi test

* last bits of "from rdkit.six" are gone

* and the last of the six stuff is gone

* strange importlib problem
2019-03-06 20:43:49 -05:00