Commit Graph

494 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
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
3160c46af4 Fixes #2929 (#2934) 2020-02-05 16:51:51 +01:00
Ric
9188c70a64 Override what() in exceptions (Addresses #2920) (#2928)
* add overrides for what()

* translation fot KeyErrorException; update tests

* Switch all exceptions to `const char *` as a return type from message() (#4)

* switch return type of message() from std::string to const char *

* adjust one test to the new return type from message()
remove unnecessary verbosity from some tests

* fix cartridge build: update call to message().c_str()

* rebase agains master; fix another issue in cartridge build

* add deprecation note for message() and getMessage()

* amend Release notes

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2020-02-05 08:20:17 +01:00
Greg Landrum
a7874672bc Merge branch 'feat/github2829' of https://github.com/greglandrum/rdkit into greglandrum-feat/github2829
# Conflicts:
#	Code/GraphMol/AdjustQuery.cpp
#	Code/GraphMol/FileParsers/file_parsers_catch.cpp
#	Code/GraphMol/MolOps.h
#	Code/GraphMol/catch_graphmol.cpp
2020-02-04 02:42:31 +01:00
Greg Landrum
abadada1a2 Parse and handle the stereoCare or STBOX flags in CTABs (#2917)
* get fileparsers catch tests building faster
should use this same approach across all of the catch2 tests

* Fixes #2916

* support parsing of STBOX for atoms and bonds in v3K mol files
add molStereoCare to common_properties

STBOX is translated to the molStereoCare property

* add stereocare support to adjustQueryProperties
make building the catch2 tests faster for the GraphMol package

* copy in AdjustQueryParameters JSON parsing from adapter.cpp
(That still needs to be ported to use the new code)

* get the cartridge using the new parsing code

* update test to reflect new parser behavior

* add a v2000 test

* changes in response to review
2020-02-03 15:55:57 -05:00
Greg Landrum
a0dd56ddee remove the MRV_IMPLICIT_H groups after processing them 2020-02-02 06:12:40 +01:00
Greg Landrum
1cea3800c4 Fixes #2829 2020-01-30 16:56:18 +01:00
Greg Landrum
b2e8cad444 Merge remote-tracking branch 'origin' into feat/github2829 2020-01-30 15:23:01 +01: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
Greg Landrum
c873ce9535 support parsing of STBOX for atoms and bonds in v3K mol files
add molStereoCare to common_properties

STBOX is translated to the molStereoCare property
2020-01-29 09:51:23 +01:00
Greg Landrum
a1e9a4528d Fixes #2916 2020-01-29 08:54:05 +01:00
Greg Landrum
098a41fd29 get fileparsers catch tests building faster
should use this same approach across all of the catch2 tests
2020-01-29 08:22:19 +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
9bc0f02b20 Fixes #2881 (#2882)
* Fixes #2881

* changes in response to review
2020-01-20 14:38:58 +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
Greg Landrum
ab061d532f fix start/end atoms when wedging bonds (#2861) 2019-12-27 07:21:49 -05:00
Paolo Tosco
4e2b5e3095 - fixes #2822 (#2850) 2019-12-17 11:47:31 +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
e49317bfcb merge 2019-10-25 04:48:08 +02:00
Eisuke Kawashima
9d10c7c4b7 Change line ending from CR+LF to LF [ci skip] 2019-10-21 11:39:25 +09:00
Eisuke Kawashima
dc7cc84a0c Fix typo [ci skip] 2019-10-17 17:45:50 +09:00
Greg Landrum
cd7771858f Fixes #2695 (#2696) 2019-10-12 17:30:51 -04:00
Eisuke Kawashima
185ec927ab Unset executable flag 2019-10-10 20:18:43 +09:00
Greg Landrum
fc374a9622 Fixes: Atoms in non-standard valences not being properly written to mol blocks (#2646)
* Fixes a molblock writing problem
with undervalent atoms from the organic subset

* Fixes #2649

Also ensures that allenes are not written as crossed bonds
(which does not make sense at the moment anyway)

* clang-format run
2019-09-20 09:13:19 -04: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
Dan N
d0d9742a71 Add RDKIT_FILEPARSERS_EXPORT to finishMolProcessing (#2551)
This addresses a linking error when using dynamic libraries on Windows:

    MDLParser.cpp.obj : error LNK2019: unresolved external symbol "void __cdecl RDKit::FileParserUtils::finishMolProcessing(class RDKit::RWMol *,bool,bool,bool)" (?finishMolProcessing@FileParserUtils@RDKit@@YAXPEAVRWMol@2@_N11@Z) referenced in function "void __cdecl RDKit::`anonymous namespace'::ParseV3000RxnBlock(class std::basic_istream<char,struct std::char_traits<char> > &,unsigned int &,class RDKit::ChemicalReaction * &)" (?ParseV3000RxnBlock@?A0xcb91cdb2@RDKit@@YAXAEAV?$basic_istream@DU?$char_traits@D@std@@@std@@AEAIAEAPEAVChemicalReaction@2@@Z)
    ..\..\..\bin\RDKitChemReactions.dll : fatal error LNK1120: 1 unresolved externals

We may want to set default visibility on Linux to hidden, too, so that we can catch linking errors like this more easily.
2019-07-28 06:26:25 +02:00
Greg Landrum
e948a06dad make "R" in CTABs an AtomNull query (#2528)
This comes out of the discussion around #2527
2019-07-15 19:53:53 -04:00
Greg Landrum
d8c49e6dab Code cleanups from PVS/Studio (#2531)
* first round of cleanups based on PVS-studio suggestions

* a couple more

* a few more cleanups

* another round of cleanups

* undo one of those cleanups
we want the integer rounding behavior here

* add a comment to make that clear

* Fix for filter catalog PRECONDITION redundancy
2019-07-13 07:25:37 +02:00
Brian Kelley
3b4326c1c7 Add tests for #1868 (#2497)
* Add tests for #1868

* Fix github bug number

* Fix #2 for correcting issue number

* Fixes #1868

The primary problem here was that when v3K reactions were being processed,
a bunch of "finalization" steps were being skipped for the reactants and products.
This remedies that.

* update the python test so that it tests the actual problem
2019-07-12 05:51:16 +02:00
Eisuke Kawashima
b2f755e64b Support XYZ format for output (#2498) 2019-07-12 05:26:42 +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
Greg Landrum
c9b8f6dd91 make this work when iostreams is being used 2019-05-09 08:12:19 +02:00
Greg Landrum
17828cc2c9 make iostreams optional 2019-05-08 17:33:17 +02:00
Greg Landrum
ec31bea97b clang-tidy-7 pass (#2408) 2019-04-16 12:05:47 -04:00
Greg Landrum
531d3a2b7e Fixes for zlib and windows builds (#2390)
This now builds on windows both with a local normal boost install and the boost install that's currently provided by conda.
2019-04-02 08:51:12 -04: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
Brian Kelley
d2f716a2e4 Adds gzstream stream, exposes to swig (#2314)
* Move RDBoostStreams to RDStreams

* RDBoostStreams->RDStreams

* RDBoostStreams->RDStreams

* Wrap SWIG (with Java test)

* Fix missing declaration

* Use the file that already exists

* Revert to original version

* Revert to CXSMiles version

* Update boost version

* Remove redundant code

* Add zlib

* check for win32

* FileParsers now builds static on windows
2019-03-18 05:32:42 +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
Ric
be3170d0d5 Mem errors clean up (#2305)
* fix test leaks

* fix "invalid read" when casting Query to EqualityQuery

* fix error cleanup in SMILES/SMARTS parsers

* SMILES/SMARTS parser fix updated *.cmake

* fix error cleanup in SLN parser

* SLN parser updated *.cmake

* updated suppressions

* update loop in sln bison
2019-03-08 05:39:59 +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
Greg Landrum
84c1ea5e7a some much-needed optimization work on the new property lists (#2317) 2019-03-06 16:06:32 -05:00
Ric
a611e7f917 Update maeparser & coordgen libraries (#2302)
* update maeparser & coordgen

* fix iostreams linking

* add shared_ptr constructor
2019-03-06 08:26:39 +01:00
Greg Landrum
180c15fe0e support reading/writing atom props from SD files (#2297)
* first crude pass

* fix a deprecation

* change naming scheme, support bools

* add standalone function

* add a default value for missings

* support long lines

* stupid typo

* make operator[] work

* revisit missing value handling

* modify missing value handling

* switch to an alternate scheme for specifying missing values

* clang-format

* First pass at property list parser
still needs more tests

* add test for processMolPropertyLists

* get this working as part of the ForwardSDMolSupplier

* first pass at python wrappers and tests

* clang-format run

* add creation of property lists at the mol level

* wrap long lines on output

* remove PoC implementation

* fix python wrappers

* remove out-of-date reference to the Python PoC

* changes in response to review
2019-03-03 13:17:13 -05:00
Brian Kelley
fa61fa717d Add test for issue #2285, fix molbundle test (#2301) 2019-02-28 13:47:03 -05:00
Greg Landrum
b52ad644b2 Robustify parsing of CTABs and SGROUPs (#2283)
* Fixes #2277

* changes in response to review
the big one is to move the PXA parser into the normal mol file parsing

* move the PXA changes to the writer as well

* SCN actually only needs 7 characters

* add test

* fixes in response to review

* handle blanks (instead of zeros) in the counts line.
The ctfile.pdf doc says we should do this

* Make the SGroup reader more robust w.r.t. bad data
The current behavior leads to uncaught exceptions when a line is too short.
This should clear that up so that we always throw the usual FileParseException

* make error messages a bit easier to read
2019-02-21 17:39:39 +01:00