Commit Graph

402 Commits

Author SHA1 Message Date
Greg Landrum
4d747d5945 Allow three-coordinate bridgehead N to be chiral. (#3958)
This is a followup from #3632
2021-03-22 19:27:55 +01:00
Zhijiang Yang
f65947de2f appended a new project depend on RDKit (#3955)
* appended a new project depended on RDKit

* moved scopy to beginning of the lists of projects
2021-03-21 04:43:58 +01:00
greg landrum
09a68bf1fc getting ready for the beta 2021-03-19 08:24:55 +01:00
Greg Landrum
5167c99fa3 Documentation cleanup and update (#3922)
* include info about query rendering

* Fixes #3897

* update images

* better documentation for the conformer generator

* conformer not conformation

* switch to using context managers and make sure we add hs before generating conformers

* yay more docs

* Finishing #3917

* more documentation of backwards-incompatible changes
2021-03-17 09:02:12 +01:00
Vincent F. Scalfani
bac9ebbdf2 Cookbook edits to fix rdkit#3917 (#3925) 2021-03-15 15:48:28 +01:00
Gareth Jones
81d3705358 R group match any issue (#3767)
* RGD modifications for any atom and index labels

* Continued development

* All tests working

* Added comment

* CR changes suggested by PTosco

* Fix catch_rgd for autocrlf

* Core dummy matches on output. RGroups on heavy atom. Dummy atoms User rgroups only when they are degree 1.

* Start work on test fixes

* testRGroupDecomp test working

* CPP and Python tests working

* Removed options for matching core query atoms on sidechains

* Windows build fix

* R groups off ring. User group matches single heavy substituent. Remove extraneous hydrogens

* Updated fingerprint variance score and tie selection

* Refactor fingerprint variance score functions to class

* Removed fingerprint distance score

* Boost::trim fix

* Updated RGD test notebook

* Fixed AddHs.cpp

* - fixes the kekulization issue
- avoids that empty R-group labels are included in cores
- makes sure that SMILES cores are always canonical
- adds a few missing const declarations and avoids unintentional copying

* Support for allowNonTerminalRGroups parameter. Remove R groups that contain H or Nothing.  Ignore R group labels on non-dummy atoms

* Fixed tests for Paolo's changes. Rebuilt test notebook.  Increased weighting of rgroup penalty in fingerprint variance score

* remove some debug output

Co-authored-by: Brian Kelley <fustigator@gmail.com>
Co-authored-by: greg landrum <greg.landrum@gmail.com>
2021-03-10 12:56:42 +01:00
Greg Landrum
1fe204841f Add Kier Phi descriptor (#3864)
* Add Kier Phi descriptor along with tests

* warn about hybridization
2021-03-06 09:40:27 -05:00
Paolo Tosco
19c9a3905c Enhanced generateDepictionMatching2DStructure functionality (#3811)
* - generateDepictionMatching2DStructure can be used with referencePattern smaller than reference
  to only use part of a scaffold
- adds generateDepictionMatching2DStructure overload to pass a matchVect instead of doing a substructure match
- adds allowRGroups parameter to enable using a scaffold bearing R groups as reference

* changes in response to review

* added comments

* fixes failing doctest

* - reverted change committed accidentally
- fixed get_sss_json for the case where R groups are not included in the match
- added tests for the return value of generate_aligned_coords

* Documented the value returned by GenerateDepictionMatching2DStructure (Python)

* changes in response to review

* - changes in response to review
- fixed sortMatchesByDegreeOfCoreSubstitution that was not working
- added Python wrappers for sortMatchesByDegreeOfCoreSubstitution and getMostSubstitutedCoreMatch
- added C++ and Pyhon unit tests for the above

* added missing variable initialization

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2021-02-24 05:37:31 +01:00
Vincent F. Scalfani
5d91e91c03 Added draw with abbreviations example and reproducible SMILES (#3831) 2021-02-22 08:36:06 +01:00
Eisuke Kawashima
ee31ec96be Replace − (U+2212, MINUS SIGN) with -- (#3777)
Fix #3738
2021-02-04 10:03:21 +01:00
Gareth Jones
ec5a172886 R group symmetry (#3565)
* Exploration

* Initial work on GA fro Rgroup Symmetry

* GA for rgroup decomp and fingerprint rgroup symmetry scoring

* Continuing development

* Exploration

* Initial work on GA fro Rgroup Symmetry

* GA for rgroup decomp and fingerprint rgroup symmetry scoring

* Continuing development

* Further development

* Continued tweaks

* Function rename

* Continued tweaks

* Bug fix for variance calculation

* Copyright notices. Remove Eigen dependency. RdKit logging.  Clock fix.

* Changes to fix build failures

* Fixes for Windows dynamic DLL build

* Included GA export.h file

* Fixed RGroupDecomp CMakeLists.txt

* Notebooks working, GGroup labelling bug fixed

* Fix windows build.  More options for example GA program

* More bugs found and tests adjusted

* Fixed Python rgroup test

* Trivial change to trigger CI

* OSX java and windows build fixes

* Windows DLL fix

* Fix segmentation error

* proposed change

* Possible fix for segmentation fault

* CR fixes

* CR fixes

* CR fixes

* Recreates molecules from rgroups where possible

Co-authored-by: greg landrum <greg.landrum@gmail.com>
Co-authored-by: Brian Kelley <fustigator@gmail.com>
2021-01-05 09:27:33 -05:00
Maximilian Greil
f6c23dc0bd Fix for Github issue 2530 (#3657)
* Github issue 2530

* Fix unittests

* Fix unittests 2

* Fix doctests

* Change name of default method back
2020-12-19 05:49:11 +01:00
Vincent F. Scalfani
c6cdbdd513 update Cookbook stereochemistry examples (#3604)
* update cookbook stereochemistry examples with new code.

* simplified double bond stereo example.
2020-12-02 06:57:48 +01:00
Eisuke Kawashima
e0b665bfe1 Clean up CMake files (#3417)
* Clean up CMake files

* bump CMake minimum required version to 3.7 to utilize
  [`VERSION_GREATER_EQUAL`](https://cmake.org/cmake/help/v3.7/release/3.7.html#index-0-command:if)
* improve catch-dependency
* fix conditionals
* use early return
* properly use CMake commands

* Apply suggestions from code review

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2020-11-28 08:00:39 +01:00
slchan3
22a49fc760 Update Install.md (#3589)
* Update Install.md

conda install instructions now point to the conda-forge instead of rdkit channel.

* Update Install.md
2020-11-27 05:41:10 +01:00
greg landrum
b5e23dcd4e prep for next release cycle 2020-10-20 06:06:14 +02:00
greg landrum
500e633c76 minor docs correction 2020-10-20 05:44:07 +02:00
Greg Landrum
170796a175 Fixes some problems with findPotentialStereo() (#3499)
* backup, definitely does not work

* remove obsolete test
(not even really sure anymore that's a bug)

* remove code from a false path

* at this point the code passes all tests

* backup

* handle isotopes and h counts properly

* remove some compiler warnings

* all tests passing

* Use InChI minimimum ring size for bonds

* Fixes edge-case bug in canonicalization when bond labels are provided

* cleanup, no substance here

* fixes the last set of problems I've seen

* document that this is still experimental

* remove obsolete/testing comments

* stop considering charge and H count in chirality
2020-10-17 04:35:58 +02:00
greg landrum
7eda4708c1 update backwards incompatibility docs 2020-10-16 17:05:14 +02:00
Greg Landrum
b510e06720 Documentation update (#3488)
* remove a bad documentation file
add new documentation module stubs

* tweak docs
2020-10-13 04:45:44 +02:00
Vincent F. Scalfani
abe1741f02 Add nocharge algorithm example to cookbook (#3467)
* Add nocharge algorithm to cookbook

* clarified difference with Uncharger

* slight clarification to description.
2020-10-12 04:46:17 +02:00
shrey183
8ea1ac6112 [GSoC-2020] Generalized and Multithreaded File Reader (#3363)
* fixed issue #2965

* added test case for issue #2965

* fixed formatting and added comment.

* update

* General Reader files

* removed dependency on boost filesystems

* removed class

* clang-format

* added-comments

* further-cleanup

* added clang-formatting

* braces-for-if-else

* changed error messages, added option for windows file path

* fixed getFileName function

* cleanup

* option for filename without path

* further-cleanup

* added tests for determineFileFormat

* cleanup, const arguments for validate function

* init

* cleanup

* cleanup

* clang-format does not work for CMake

* added RDK_TEST_MULTITHREADED option

* add-flag

* cleanup

* Delete ConcurrentQueue.h

This PR deals with the Generalized File Reader.

* Delete testConcurrentQueue.cpp

This PR deals with the Generalized File Reader.

* no change

* concurrent queue

* print values

* Single Producer Multiple Consumer works

* cleanup

* Producer Consumer Example

* update queue methods and tests

* cleanup

* test

* fixed tests

* cleanup, updated tests

* Delete ProducerConsumer.h

* Delete testProducerConsumer.cpp

* cleanup

* futher cleanup

* changes based on feedback

* make queue non copyable

* psuedocode

* possible implementation

* untested implementation

* change class to typename

* basic-setup

* need to fix segfault

* need to fix blocking

* need to fix blocking

* need to fix blocking

* fix indentation

* one possibility

* without lambda function

* possible fix with some test cases

* performance tests

* added support for record id and item text

* cleanup

* cleanup

* fixed memory leak and added methods with tests for getting last id and item text

* cleanup

* added more test cases with different smi files

* cleanup

* SD mol supplier

* modified the parsing for SDMolSupplier

* cleanup

* cleanup

* new file for testing

* added support for reading molecule properties with tests

* thread-safe logging and exception handling

* cleanup

* without thread safe logging

* cleanup

* cleanup, modified MultithreadedSmilesMolSupplier

* cleanup, made reader and writer functions private

* move O2.sdf

* basic python wrapper with tests

* cleanup, added new methods for python wrappers

* made changes suggested by Andrew

* file and compression formats are case-insensitive

* cannot open files with gzstream

* cleanup

* possible fix for opening compressed streams (SMILES)

* removed seekg() and tellg() methods from multithreadeded suppliers

* cleanup

* test cases for python wrappers

* some wrapper cleanup

* cleanup, removed unused functions

* update the MT tests so that they actually do some work
also includes some cleanup here

* cleanup

* remove iterator_next header include

* added support for multithreaded readers

* use getNumThreadsToUse for multithreaded suppliers

* fixed documentation for multithreaded python wrappers

* commented performance test

* first draft of final evaluation report

* removed inline variables

* first draft getting started in python

* fixed typos in getting started in python

* fixed typos

* fix documentation tests

* fixed documentation tests

* added links to important files and PR

* added perfomance results

* first version of wrappers with compressed streams

* getting rid of streambuf stream method

* modified General File Reader

* make this work when building in non-threads mode

* rename a test

* rename a function in the python API

* rearrange the python test a bit

* disable the stream-based constructors in Python

* mark the multithreaded classes as experimental

Co-authored-by: greg landrum <greg.landrum@gmail.com>
2020-10-09 04:31:05 +02:00
Vincent F. Scalfani
d04bebb593 Add 3 new examples to cookbook (#3459) 2020-10-06 08:49:47 +02:00
Greg Landrum
717c62d9de fix documentation typo 2020-10-02 06:43:57 +02:00
Greg Landrum
d2d87909de Add support for abbreviations (#3406)
* support read-only access to cstates from python

* expose GetBrackets

* expose getAttachPoints too

remove vestigial SubstanceGroupCState_VECT

* backup

* backup

* basics working

* backup

* add label_mol_abbreviations

* fix a bug in the chirality handling

* add linkers, needs more testing

* add another peptide test

* sanitize results by default

* just need rings

* getting started with the C++ form of abbreviations

* a bit of error handling

* add findApplicableMatches

* actually apply the abbreviations

* make the getDefault functions more efficient

* add labeling (creating s groups)

* docs

* basic python wrappers (maybe this is enough?)

* add _displayLabel and _displayLabelW support to MolDraw2D
update the docs for that

* use displayLabel props

* add more default abbrevs

* change default linker defns
add parseLinkers convenience function

* make sure attachment point atoms aren't aromatic

* change the color of dummies to be darker gray

* remove python implementation

* support abbreviations in the java wrappers

* add abbreviations to the csharp wrappers

* add abbreviations to the js wrappers

* add molParity to the list of atom props not written to CXSMILES

* support condensing SUP substance groups

* add that to the python wrappers

* Update testAbbreviations.py

* clear ring info if we added it

* document that the molecules with abbreviations removed have not been sanitized
2020-09-28 17:09:46 -04:00
Greg Landrum
9a04aea918 Improvements to reaction chirality handling (#3412)
* add tests for the problem

* more testing (still no fix)

* Fixes #2891

Try to be more robust w.r.t. atom reordering in input SMILES

* better handling of differing numbers of bonds between reactants and products

all tests now passing

* update the rdkit book with more details about chirality in reactions

* changes in response to review
2020-09-18 09:33:26 +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
1a3ce773cf Molecule metadata in PNGs (#3316)
* reader stub. Navigates the file successfullly

* works

* works

* read out all metadata, not just ours

* first pass at reading out molecules

* support mol blocks too

* add python wrapper for parser

* add direct writer

* get rid of multiple definitions in PNParser.h

* update from code review

* robustification

* handle reading compressed metadata

* support compressing metadata too

* reorder arguments to make this more consistent

* add writers to python wrappers

* forgotten file

* add pickle support

* explicit zlib dependency

* get windows builds working
at least with conda boost+zlib

* switch to using boost::iostreams to do the compression/decompression

* switch to using a vector of string pairs to store the metadata

need this so that we can contain "duplicate" keys

* add metadata output to MolDraw2DCairo
still need python test

* add a python test

* initial work at reading/writing reactions from PNGs

refactor the ReactionParser.h header a bit

* cleanup debug messages

* reaction PNG support -> python

* ReactionPickler no longer includes all ProductTemplate props

* handle metadata at the MolDraw2D level
Currently only supported by MolDraw2DCairo, it's worth extending this to SVG too

* support reading multiple molecules from a png

* support multiple molecules from files and in python

* stop duplicating tags with multiple molecules

* update to get windll builds working
this change should be propagated to more cmakelists.txt files

* make sure the metadata ends up in the notebook

* make sure PNGs in the notebook also have metadata

efficiency improvements for some notebook bits (i.e stop going PNG->Image->PNG)

* no need to pretend that we might be using PIL anymore

* documentation

* update docs to show new functionality

* not sure why the doctests failed on linux

* still trying to diagnose those failures

* protect doctests in case python interpreters are being re-used

* switch tags

* the wrapped functions to read png data from files weren't working

* <sigh>... windows dlls
2020-08-25 07:51:18 +02:00
Vincent F. Scalfani
ac396df23a Fix Cookbook formatting and added 4 new examples (#3345)
* add new images for CB examples 28 and 29

* formatting fixes and add 4 new examples

* clarified variables in sidechain-core enumeration example
2020-08-24 05:31:04 +02:00
Greg Landrum
7f1b6aed0c Remove deprecated Sphinx options (#3335)
* remove the deprecated options

* cleanup
2020-08-14 03:57:36 +02:00
Greg Landrum
e95b2b2e82 lock sphinx version in CI due to problem with v3.2.0 (#3332)
* lock sphinx version due to problem with 3.2.0

the problem was fixed here: https://github.com/sphinx-doc/sphinx/issues/8084
but that is not yet released

* forgot one

* fix bad doc formatting
2020-08-12 14:42:42 +02:00
Greg Landrum
f14f8a60de Expanded support for CXSMILES features (#3292)
* move replaceAtomWithQueryAtom() and completeMolQueries() to QueryOps namespace

* support ring bonds from cxsmiles

* add a test that is still failing

* update nonHydrogenDegree query, add SMARTS extension for that

* some cleanup

* unsaturation and substitution count

* fix typo in test

* update expected result

* add linknodes

* add variable attachment points

* improve documentation of supported cxsmiles features

* clarifying the docs

* support leaving out the outer atoms in LN specs
2020-07-25 05:06:08 +02:00
Ric
d54e77e375 Add new CIP labelling algorithm (#3234)
* add port of centres

* Several changes:
    - Added a test based on RDKit issue 2984
        (default RDKit fails it, this gets it right)
    - Use bond directions for bond stereo (label is no longer required)
    - Fix bugs in rules 4b and 5new
    - Fix some mem errors
    - clang-formatted
    - some other minor cleanups

* Several changes and some improvements:
    - Added LGPL license, as well as a mention in the doc.
    - Fix/update/add some comments
    - Fix typo/bug in Mancude calculation
    - Fix bug in rules 4b, 5New
    - Fix Sp2 Bond dir reference
    - Re clang-format
    - other minor changes suggested by Dan

* Another bunch of changes:
  - require integer-order bonds; kekulize when required
  - fix fraction comparison
  - rename sq Cis/Trans e/z
  - replace queues with vectors
  - update copyright notices
  - revert LGPL changes
  - fix Asymmetric typo

* move to separate lib/mod, add python validation test

* Moving away from the original implementation:
    - Rename to CIPLabeler
    - Remove the abstraction layer
    - Remove some stats stuff
    - Push some CIPMol functions down to Node
    - Use RDKit's isotope info

* Another bundle of changes. The most relevant ones:
    - fix parity translation
    - use cis trans as bond reference -- breaks #2984 test
    - kill a lot of unused code
    - use lists for queues
    - store nodes and edges in digraph
    - add prefixes to class data member names
    - update changeRoot() test
    - use fastFindRings() for mancude rings
    - update docs
    - add references to the scientific paper
    - Document the Mancude functions
    - Fix Mancude atom types and their comments
    - remove mol data member from SequenceRule
    - replace Fraction with boost::rational
    - update comments, docstrings and the doc

* fix building the test

* Changes here include:
    - adding bitset overload for the labeling function
    - python wrap of the overload
    - handling trigonal pyramids with implicit H
    - setting bond labels sets stereo atoms, cis/trans
    - nix LEFT/RIGHT/TOGETHER/OPPOSITE constants
    - don't use GLOB in cmake
    - a decent amount of refactoring

* Minor edits to new_CIP_labeling (#6)

* Some changes for clarity

Added some documentation and changed some variable names to match
my understanding. Also a ran clang-tidy to ensure that all blocks
were brace-enclosed.

* Return a reference instead of a copy for performance

This is called many times and showed up after some light
profiling. This change bumped throughput by about 20%

* move out of Graphmol

* move .hpp headers to .h

* update documentation; add label set of atoms test

* Address comments:
    - Added references to centres to CIPLabeler.h and Python Wrap.
    - Update validation test to skip sanitization.
    - Document mancude fractional atomic number calculation.
    - Use unittest assertions in python test.
    - Update mancude docstrings to 'resonance' instad of 'tautomers'.
    - Rename prioritise() to prioritize().
    - Add postcondition to check carriers size in Tetrahedral.cpp.
    - Use getNeighbors() in Tetrahedral.cpp.
    - Move findStereoAtoms to Chirality namespace.
    - Move code back into GraphMol.
    - Fix typos and reformat doc.

* More comments:
    - Mention why we use boost's unordered map rather than the std one.
    - Fix include in Python wrapper.

* Addressed second batch of comments:
    - fix the bug in rule 4b
    - fix docstring for rule 2
    - move atomic mass calculation from rule 2 to node
    - addressed some build warnings
    - simplify sp2bond::label(comp)
    - add start/end atoms to Sp2Bond constructor
    - update system/local includes

Co-authored-by: Dan N <dan.nealschneider@schrodinger.com>
2020-07-07 20:34:33 +02:00
Greg Landrum
1630540ef0 Add cxsmiles query atoms to CTAB parsers and writers (#3261)
* allow CXSMILES generic query atoms to be parsed from mol;
need more tests here

* remove vestigial directory

* Add d_queryType to Query
This opens up additional flexibility with customizing the way queries are handled
Also includes some assorted cleanups in the Query directory

* remove the MolFileSymbol hack added in #3235
We don't need it anymore

* Add support for additional ChemAxon extensions and document them

Signed-off-by: greg landrum <greg.landrum@gmail.com>

* bump pickle version

* add an additional test
2020-07-03 12:51:19 -04:00
Paolo Tosco
3d831d8809 Fixes #3095 (single-atom MCSs are not captured) (#3109)
* - fixes #3095 (single-atom MCSs are not captured)

* - fixed doctest

* - changes in response to review

* - fixed typos

* - fix Windows compiler error
2020-05-05 13:58:33 +02:00
hjuinj
6117222ff3 Cookbook entry for ETKDG with rings (#3129)
* cookbook entry for etkdg with rings

* cookbook entry for etkdg with rings

Co-authored-by: Shuzhe Wang <shuwang@eu-login-27.euler.ethz.ch>
Co-authored-by: Shuzhe Wang <shuwang@eu-login-29.euler.ethz.ch>
2020-05-05 04:38:23 +02:00
Greg Landrum
28e190a988 Update old windows install instructions (#3125)
These were vestigial and were causing problems for some people.
2020-05-04 10:28:53 +02:00
Greg Landrum
45bf58754a Cleanup some cmake dependencies (#3077)
* change minimal cmake version to a consistent 3.5

* progress towards a cleanup

* get the basic python deps working

* two more libs

* another round of changes
all tests pass at this point

* next round of changes
all tests pass at this point

* close to done
all tests pass

* very close

* almost done

* shift the RDBoost dependencies around a bit

* remove an extraneous python linkage
this is trying to get the mac builds working again

* Only link to python if it was built shared (#3091)

* change in response to review

Co-Authored-By: Ric <ricrogz@users.noreply.github.com>

* move that suppression of the maybe-uninitialized warning to BoostStartInclude.h

Co-authored-by: Brian Kelley <fustigator@gmail.com>
Co-authored-by: Ric <ricrogz@users.noreply.github.com>
2020-04-17 14:34:23 +02:00
greg landrum
2d604ac8ac get ready for next release cycle 2020-03-30 07:04:48 +02:00
David Cosgrove
6d1266615b Updatecppdocs (#3039)
* Updated CMakeLists.txx

* Updated all examples, extended some.

* Added info about highlighting atoms.

* Added info about annotation to python getting started.

* Minor tweaks.

* Minor tweaks.  Can only examine the rst in GitHub.

* Minor tweaks.  Can only examine the rst in GitHub.

* get doctests working

* update an example image

* Include the GettingStartedInC++ doc in the standard docs build

* move the C++ docs after the python docs

* update backwards incompatible changes doc

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
Co-authored-by: greg landrum <greg.landrum@gmail.com>
2020-03-27 14:19:17 +01:00
Greg Landrum
80cc117b4b update docs for 2020.03 (#3028)
* update release notes

* more doc updates

* meta!

* last minute

* version bump in CMakeLists.txt for beta
add an additional doc template
2020-03-23 15:25:07 +01:00
Greg Landrum
9f90a24f41 add random seed to docs to get reproducible conformations (#3026) 2020-03-23 06:13:24 +01:00
greg landrum
209d6f7e11 Merge branch 'master' of https://github.com/daenuprobst/rdkit into daenuprobst-master 2020-03-21 14:11:22 +01:00
Vincent F. Scalfani
66354d9d51 Add 5 new recipes to Cookbook (#3014)
* Add 5 new recipes to Cookbook and associated images.

* fixed the requested changes.
2020-03-21 14:03:26 +01:00
Dan N
3dc1a220b7 Allow enhanced stereo to be used in substructure search (#3003)
* Test only commit for using enhanced stereo in substructure search

Adds some test cases to demonstrate what I'm planning.

When the test cases fail, the messages look like this:

    -------------------------------------------------------------------------------
    Enhanced stereochemistry
    AND and OR match their enantiomer
    -------------------------------------------------------------------------------
    /Users/wandschn/Documents/src/rdkit/Code/GraphMol/Substruct/catch_tests.cpp:216
    ...............................................................................

    /Users/wandschn/Documents/src/rdkit/Code/GraphMol/Substruct/catch_tests.cpp:218: FAILED:
    CHECK_THAT( *opposite_mol, IsSubstructOf(*mol_and, ps) )
    with expansion:
    CC[C@@H](F)[C@@H](C)O is not a substructure of CC[C@H](F)[C@H](C)O |&1:2,4|

    /Users/wandschn/Documents/src/rdkit/Code/GraphMol/Substruct/catch_tests.cpp:219: FAILED:
    CHECK_THAT( *opposite_mol, IsSubstructOf(*mol_or, ps) )
    with expansion:
    CC[C@@H](F)[C@@H](C)O is not a substructure of CC[C@H](F)[C@H](C)O |o1:2,4|

* rename parameter to include q and m to reduce my confusion

* Don't keep recreating a map

This map is the same in every loop. And actually, the desired
information is slightly different than what was formerly stored
in the map.

* Fix tests after our discussion.

Also adds more exciting tests of disastereomers and structures
with multiple stereo groups.

* Use enhanced stereochemistry in substructure searching

Allows use of enhaced stereochemistry in substructure searching
if `SubstructMatchParameters.useEnhancedStereo` is set.

The matching rules are pretty obnoxious, but a synopsis is:

* An achiral query/substructure matches everything, because it
  means "ignore chirality".
* An absolute query matches AND or OR, because they both include
  the molecule with an absolute center
* An query with an OR matches either an OR or an AND, because
  AND is more molecules.

* add info about matching to the documentation

* expose extended stereo matching option to python

* Some updates/tweaks to the documentation of enhanced stereochemistry

especially about searching.

* Code review comments.

Co-authored-by: greg landrum <greg.landrum@gmail.com>
2020-03-21 05:12:40 +01:00
David Cosgrove
774892a9ab 2ddrawenhancements2931 (#2979)
* First pass of fixing layout of OH/NH type drawing.

* Fixed scale for N/S NH type groups.

* Fixed bond end points with new display of heteroatoms.

* Fixed case where it drew aromatic dashed bonds in wrong ring for morphine.

* Minor edit.

* Fixed non-drawing of chiral bonds.

* Removed use of boost for_each.

* Modern atom traversal.

* Put in fixed scale for drawings.
Made drawMolecule() take note of prepareMolsBeforeDrawing.
Updated more iterators to modern idiom.

* Added fixed bond length for drawing.

* Fixed drawing of CH4, NH3 etc.

* Stash of working but ugly, prior to re-work.

* Better, simpler splitting of atom symbols.

* Took clang-tidy's advice about use of override.

* Tidied up drawing of text strings.

* Tweaked what is classed as vertical bond in drawing.

* fixedBondLength now down-scales if it would overflow the draw window.

* Some tidying.

* Tests for new parameters in JSON.
Fixed some existing tests where, for example, scale on picture is now different.

* Added option to rotate 2D draw coords before drawing.

* First pass at highlighting atoms in multiple colours.  Circles only at the moment.

* Line width scales if big enough.

* Tweaked SVG text drawing.

* Added highlighting with more than 1 colour on an atom.  C++ only.

* Fixed some issues with widths of highlights in a frustrating game of whackamole.
Updated some tests accordingly.

* Added Python wrapper for new drawing code.

* Removed debugging writes.

* Added C++ test for multi-coloured highlights.

* Added python test for multi-coloured highlights.

* Attempt to show radicals.

* Tidied up radicals in drawing, including a bullet instead of full stop in SVG.

* Fixed catch_tests.cpp for MolDraw2D.

* Fixed crash in Python wrappers on OSX.

* Fixed test5_2.svg bug (trailing </tspan>).
Made wavy line width scale as other lines do.

* Improved placing of charges.

* We're already in the future.

* Fixed a number of bugs that made drawMolecules not set the scales properly.

* Fixed Cairo wavy line width.

* Fixed non-closure of collision boxes.

* Added maximum font size for text, with tests.

* Addressed all Greg's first PR change requests.

* Fixed crash in extractAtomsymbols.

* stop using coordgen and adjust tests to reflect that
there's a bit of reformatting in here too

* Fixed layout of reactions.

* Fiddled with moldraw2DTest1 tests again.

* Fiddled with catch test.

* Fixed istope postion in W atom labels.

* Minor tweak to cairo,

* update expected results

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2020-03-10 17:33:59 +01:00
Dan N
3b6dfb0343 Enable larger ring matches in SMARTS expressions (#2981)
Although these are probably nonsense, I've seen some pretty
big [r#] expressions in SMARTS expressions. In particular, for
SMARTS generated for toolkits that don't have the range
extension, people do this to mean "in rings bigger than 6" or
whatever:

   [r7,r8,r9,r10
2020-03-07 15:09:38 +01:00
Zhenting Gao
ae8e2a11ae Description for the data files. (#2975)
* Create README.md

Description of solubility data is added by Zhenting Gao

* Update README.md
2020-02-28 09:28:56 -05:00
Greg Landrum
eb846091cc Include running the documentation tests as part of the CI runs (#2932)
* initial attempt to run doctests in CI

* add cairo support; disable other builds until we are done with this

* we don't actually need cairo
Adds cleanup code to cookbook

* be explicit about SVG
it does not seem like this should be necessary, but...

* turn the other tests back on now that the doctests work

* try enabling the doc tests for mac and win too

* remove mac tests again, fix problem with windows

* trying to get tests working on windows

* stop requesting PNGs in the cookbook

* skip calls to molstogridimage too

* remove vestigial doctest directive
2020-02-13 15:23:48 +01:00
Greg Landrum
f3587ea4d0 Add a scaffold network implementation (#2911)
* backup

* backup

* backup

* getting close to v0.1

* switch to using node indices

* add pruning and flattening

* support multiple mols

* example notebook

* backup

* initial commit
Just includes the basic API and flatten

* add the pruning step

* add removeAttachmentPoints()

* add makeScaffoldGeneric()

* improve compilation speed by adding catch_main.cpp

* add getMolFragments()

* doc cleanup

* actually add the network building code

* first pass at python wrapper

* allow edges to be nicely converted to strings

* get node counts working

* backup python notebook

* switch example notebook to use wrapped C++ code

* add BRICS fragmentation option

* fix a bug with removing attachment points to aromatic heteroatoms

* add provisional attachment point merger to notebook

* fix a bug with includeScaffoldsWithAttachments=false

* backup of efforts to get this working on windows

* backup of efforts to get this working on windows

* does not work. backup

* Fix a substructure crash on Windows

* re-enable tests

* adjust to the new BRICS form

* in-code documentation

* more doc updates

* reformat

* change the string output format for edges

* remove old python implementation

* remove obsolete test

* include a generic scaffold for the pruned structure too

* default to keepOnlyFirstFragment=false with BRICS params

* bug in removal of attachment points from generic scaffolds

* more testing

* support working from std::shared_ptr as well as boost::shared_ptr

* more testing

* disable debug printing

* use memo-ization in getMolFragments() to avoid duplicate work

* add SWIG wrapper and basic testing

* add define for RDK_USE_BOOST_SERIALIZATION

* add serialization at the C++ level

* add a string ctor for a scaffold networks

* add pickle support on the python side

* formatting

* remove old notebook

* move the fantastically useful iterable_convertor to RDBoost/Wrap.h

* expose parameter constructor with std::vector<std::string>

* add scaffoldnetwork to documentation
2020-02-11 08:21:01 -05:00