Commit Graph

2794 Commits

Author SHA1 Message Date
Greg Landrum
7e6600f3be Fixes #2516 (#2519)
* RDStreams now installed properly

* skip Wrap directories if RDK_BUILD_PYTHON_WRAPPERS is not set

Fixes #2516
2019-06-28 09:57:00 -04:00
Greg Landrum
3ce2016039 Fixes #2452 (#2507) 2019-06-24 23:07:19 -04:00
Greg Landrum
2b98b36184 Fixes #2501 (#2502) 2019-06-24 23:05:56 -04:00
Greg Landrum
320fa22ead SanitizeRxn code and docstring cleanup (#2491)
* Fix the docstring for SanitizeRxn()
Code cleanups in SanitizeRxn.cpp

* expand new docs
improve formatting of other doc strings
2019-06-14 16:39:40 -04:00
David Cosgrove
8cde9c994e Fix 2d depict (#2487)
* Changed calculateScale to take account of highlighted atoms.

* Changed calculateScale to take account of highlighted atoms.
2019-06-11 16:19:52 +02:00
Greg Landrum
ea0e8f674e Preserve bond direction in fragmentOnBonds (#2484)
* Sketch of a solution to preserve bond direction in fragmentOnBonds

* A bit of cleanup work based on Andrew's original commit for #1039
Add a couple of tests too

* forgot to save a file before the commit
2019-06-10 13:08:50 -04: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
Brian Kelley
dfc79c98fa Fix/rgroup multiple labels (#2481)
* Fix core labelling and multi-core hydrogen removals

* Add comment that explains confusing bit about indexlabels for multicores

* Multi core fixes:  hydrogens properly removed, fixed labelling

* clang-format
2019-06-07 04:43:20 +02: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
Greg Landrum
980f955271 Fixes #2466 and #2465 (#2467)
* Fixes #2466

* Fixes #2465

* remove obsolete test

* remove redundancy

response to review
2019-05-30 18:45:57 +02: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
Brian Kelley
25b7cf74fa Merge pull request #2455 from greglandrum/feat/preparemols_optional
add prepareMolsBeforeDrawing option for drawMols
2019-05-21 10:32:56 -04:00
Brian Kelley
53d537736e Merge pull request #2445 from greglandrum/fix/github2436
Fixes #2436
2019-05-21 10:31:30 -04:00
Paolo Tosco
ec74cd3761 Added OptimizeMoleculeConfs with pre-generated force-field (#2401)
* - added two convenience functions to allow miniming all molecule confs with a pre-generated force-field (e.g., to use constraints)
- removed a lot of code duplication between Code/GraphMol/ForceFieldHelpers/MMFF/MMFF.h Code/GraphMol/ForceFieldHelpers/UFF/UFF.h
- homogenized the nonBondedThreshold to 100.0 across all MMFF functions

* - avoided code duplication
- added tests
- added PRECONDITION clauses
2019-05-19 15:34:06 +02:00
Greg Landrum
05e5e54a50 make preparing molecules optional 2019-05-15 18:37:07 +02:00
Greg Landrum
5c6706cc50 Fixes #2427 (#2429) 2019-05-15 04:46:06 +02: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
ecf5a67acc Fixes #2437 (#2438)
* Fixes #2437

getting the canonical atom ranking no longer results in molecules have a
RingInfo structure that's been initialized but contains nothing.

* update expected results for the MMPA tests
2019-05-10 08:25:31 +02:00
Brian Kelley
f47cfd36dd Merge pull request #2421 from greglandrum/fix/github945
Fixes #945 and #2420
2019-05-09 11:31:19 -04:00
Brian Kelley
2f5e70dd17 Merge pull request #2426 from greglandrum/fix/github2422
Fixes #2422
2019-05-09 11:30:54 -04:00
Brian Kelley
1b43c9f888 make boost::iostreams optional (#2440)
* make iostreams optional

* make this work when iostreams is being used
2019-05-09 11:29:02 -04: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
8d72034367 Add an allowed valence of 3 for Al (#2425)
Fixes #2423
2019-05-09 10:49:14 -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
494faf119a Fixes #2422 2019-04-26 16:43:35 +02:00
Greg Landrum
2602ea6de8 A bit of not-particularly-related cleanup 2019-04-24 14:30:54 +02:00
Greg Landrum
4db0bade46 Fixes $945
Fixes #2420

Tests updated to reflect changes.

The existing CompleteRingsOnly code wasn't actually guaranteeing CompleteRingsOnly at all, it was just causing #2420.
The updated code actually makes sure that bonds that were ring bonds in one of the queries are ring bonds in the final MCS.
This is done via a relatively simple DFS.
2019-04-24 14:30:38 +02:00
Greg Landrum
1d47049f2a add test for #945 2019-04-23 17:32:57 +02:00
Greg Landrum
d0c8c3cf8f Fixes #2411 and #2414 (#2412)
* clang-tidy-7 pass

* Fixes #2411

* Fixes #2414
2019-04-19 21:51:41 -04:00
Dan N
47acdc8b73 Issue #2403: Speed up SSSR symmetrization (#2410)
* Issue #2403: Speed up SSSR symmetrization

For my horrible example molecule (a highly symmetric
nanotube with 2400 atoms and > 1000 rings), this speeds up
symmetrizeSSSR() from 5s to about 0.002s. findSSSR() takes
another .4s or so.

* Refactor after Ricardo's suggestions

* Greg's review comments. use std::vector
2019-04-18 07:11:15 +02:00
Greg Landrum
ec31bea97b clang-tidy-7 pass (#2408) 2019-04-16 12:05:47 -04:00
Ric
d0520ef2a6 fix (#2406) 2019-04-15 14:15:51 +01: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
Greg Landrum
09325d32ff Speed up some of the tests (#2398)
This removes some redundancy from some of the test code in order to bring
the runtime down. This does not affect test coverage and shouldn't do
anything bad to the overall test quality.
2019-04-07 06:06:51 +02:00
Dan N
2bcb7ea692 I2366 Preserve enhanced stereo in reactions (#2377)
* Potential implementation of copying enhanced stereo groups

Copies the enhanced stereo if all atoms in the reactant
end up in the same molecule of the product with valid
ChiralTags.

Current implementation: Only copy StereoGroup if all atoms are "valid" in the product.
Possible implementation: Copy StereoGroup for all atoms that are "valid" in the product.

Details:
Uses ChiralTag invalidation to decide whether StereoGroup should be copied. If
the product atoms have valid ChiralTag, then the reaction was able to
meaningfully propogate chirality from the reactant to the product. This means
that it is also meaningful to propogate the StereoGroup from the reactant to
the product.

The only exception to this is if the product template defines a specific
absolute configuration for an atom. This means that the reaction defines the
stereochemistry for the atom, so the stereochemistry of that atom is no longer
relative.

If an atom from a reactant StereoGroup appears multiple times in the product,
all copies of that atom are put in the same product StereoGroup.

Still developing test cases.

    from rdkit import Chem
    from rdkit.Chem import AllChem

    # Duplicate a molecule example:
    mol1 = Chem.MolFromSmiles('Cl[C@@H](Br)C[C@H](Br)CCO |&1:1,4|')
    mol2 = Chem.MolFromSmiles('CC(=O)C')
    rxn = AllChem.ReactionFromSmarts('[O:1].[C:2]=O>>[O:1][C:2][O:1]')
    for prods in rxn.RunReactants([mol1, mol2]):
        for p in prods:
            for a in p.GetAtoms():
                for k in a.GetPropsAsDict():
                    a.ClearProp(k)
            print(Chem.MolToCXSmiles(p))

Output:

[21:26:08] product atom-mapping number 1 found multiple times.
CC(C)(OCC[C@@H](Br)C[C@@H](Cl)Br)OCC[C@@H](Br)C[C@@H](Cl)Br |&1:6,9,15,18

* Issue 2366: Documentation and fix stereo group invalidation

Adds some documentation to EnhancedStereo.md

Also invalidates StereoGroup if a reaction specifies the
stereochemistry of a center. This destroys the relative
relationship of the center to other centers.

* Demo python file examples for Enhanced Stereochemistry in reactions

This is not intended to be pushed. These probably will become test
cases. For the output looks like this:

    0a. Reaction preserves stereo:
      [C@:1]>>[C@:1]
        F[C@H](Cl)Br |o1:1|
          >>
          F[C@H](Cl)Br |o1:1|

    0b. Reaction preserves stereo:
      [C@:1]>>[C@:1]
        F[C@@H](Cl)Br |&1:1|
          >>
          F[C@@H](Cl)Br |&1:1|

    0c. Reaction preserves stereo:
      [C@:1]>>[C@:1]
        FC(Cl)Br
          >>
          FC(Cl)Br

    1a. Reaction ignores stereo:
      [C:1]>>[C:1]
        F[C@H](Cl)Br |a:1|
          >>
          F[C@H](Cl)Br |a:1|

    1b. Reaction ignores stereo:
      [C:1]>>[C:1]
        F[C@@H](Cl)Br |&1:1|
          >>
          F[C@@H](Cl)Br |&1:1|

    1c. Reaction ignores stereo:
      [C:1]>>[C:1]
        FC(Cl)Br
          >>
          FC(Cl)Br

    2a. Reaction inverts stereo:
      [C@:1]>>[C@@:1]
        F[C@H](Cl)Br |o1:1|
          >>
          F[C@@H](Cl)Br |o1:1|

    2b. Reaction inverts stereo:
      [C@:1]>>[C@@:1]
        F[C@@H](Cl)Br |&1:1|
          >>
          F[C@H](Cl)Br |&1:1|

    2c. Reaction inverts stereo:
      [C@:1]>>[C@@:1]
        FC(Cl)Br
          >>
          FC(Cl)Br

    3a. Reaction destroys stereo:
      [C@:1]>>[C:1]
        F[C@H](Cl)Br |o1:1|
          >>
          FC(Cl)Br

    3b. Reaction destroys stereo:
      [C@:1]>>[C:1]
        F[C@@H](Cl)Br |&1:1|
          >>
          FC(Cl)Br

    3c. Reaction destroys stereo:
      [C@:1]>>[C:1]
        FC(Cl)Br
          >>
          FC(Cl)Br

    3d. Reaction destroys stereo (but preserves unaffected group):
      [C@:1]F>>[C:1]F
        F[C@H](Cl)[C@@H](Cl)Br |o1:1,&2:3|
          >>
          FC(Cl)[C@@H](Cl)Br |&1:3|

    3e. Reaction destroys stereo:
      [C@:1]F>>[C:1]F
        F[C@H](Cl)[C@@H](Cl)Br |&1:1,3|
          >>
          FC(Cl)[C@@H](Cl)Br

    4a. Reaction creates stereo:
      [C:1]>>[C@@:1]
        F[C@H](Cl)Br |o1:1|
          >>
          F[C@@H](Cl)Br

    4b. Reaction creates stereo:
      [C:1]>>[C@@:1]
        F[C@@H](Cl)Br |&1:1|
          >>
          F[C@@H](Cl)Br

    4c. Reaction creates stereo:
      [C:1]>>[C@@:1]
        FC(Cl)Br
          >>
          F[C@@H](Cl)Br

    4d. Reaction creates stereo (preserve unaffected group):
      [C:1]F>>[C@@:1]F
        F[C@H](Cl)[C@@H](Cl)Br |o1:1,&2:3|
          >>
          F[C@@H](Cl)[C@@H](Cl)Br |&1:3|

    4e. Reaction creates stereo:
      [C:1]F>>[C@@:1]F
        F[C@H](Cl)[C@@H](Cl)Br |o1:1,3|
          >>
          F[C@@H](Cl)[C@@H](Cl)Br

    5a. Reaction preserves unrelated stereo:
      [C@:1]F>>[C@:1]F
        F[C@H](Cl)[C@@H](Cl)Br |o1:3|
          >>
          F[C@H](Cl)[C@@H](Cl)Br |o1:3|

    5b. Reaction ignores unrelated stereo:
      [C:1]F>>[C:1]F
        F[C@H](Cl)[C@@H](Cl)Br |o1:3|
          >>
          F[C@H](Cl)[C@@H](Cl)Br |o1:3|

    5c. Reaction inverts unrelated stereo:
      [C@:1]F>>[C@@:1]F
        F[C@H](Cl)[C@@H](Cl)Br |o1:3|
          >>
          F[C@@H](Cl)[C@@H](Cl)Br |o1:3|

    5d. Reaction destroys unrelated stereo:
      [C@:1]F>>[C:1]F
        F[C@H](Cl)[C@@H](Cl)Br |o1:3|
          >>
          FC(Cl)[C@@H](Cl)Br |o1:3|

    5e. Reaction creates unrelated stereo:
      [C:1]F>>[C@@:1]F
        F[C@H](Cl)[C@@H](Cl)Br |o1:3|
          >>
          F[C@@H](Cl)[C@@H](Cl)Br |o1:3|

    6e. Reaction splits StereoGroup atoms into two Mols:
      [C:1]OO[C:2]>>[C:2]O.O[C:1]
        F[C@H](Cl)OO[C@@H](Cl)Br |o1:1,5|
          >>
          O[C@@H](Cl)Br + O[C@H](F)Cl
          >>
          O[C@H](F)Cl + O[C@@H](Cl)Br

    7. Add two copies:
      [O:1].[C:2]=O>>[O:1][C:2][O:1]
        Cl[C@@H](Br)C[C@H](Br)CCO |&1:1,4| + CC(=O)C
    [17:15:38] product atom-mapping number 1 found multiple times.
          >>
          CC(C)(OCC[C@@H](Br)C[C@@H](Cl)Br)OCC[C@@H](Br)C[C@@H](Cl)Br |&1:6,9,15,18|

    8. Add two copies:
      [O:1].[C:2]=O>>[O:1][C:2][O:1]
        Cl[C@@H](Br)C[C@H](Br)CCO |&1:1,4| + CC(=O)C
    [17:15:38] product atom-mapping number 1 found multiple times.
          >>
          CC(C)(OCC[C@@H](Br)C[C@@H](Cl)Br)OCC[C@@H](Br)C[C@@H](Cl)Br |&1:6,9,15,18|

* Updates StereoGroup strategy in reactions to copy all possible atoms.

Copy all atoms for which the stereochemistry was not created or destroyed
in the reaction. Any StereoGroup which has at least one atom will appear
in the product.

Also updates the documentation to match this description, and adds C++
and Python tests which fail before this PR and pass after. The Python
tests are more extensive.

Test output was validated by hand (especially the stereo groups
generated. I'm less confident in the reaction processing in my head,
but I truested the existing validation there.)

For future diagnosis: Python unittest failures will look like:

    AssertionError: 'F[C@H](Cl)Br' != 'F[C@H](Cl)Br |&1:1|'
    - F[C@H](Cl)Br
    + F[C@H](Cl)Br |&1:1|
    ?             +++++++

For future diagnosis: C++ Catch2 failures will look like:

      CHECK( MolToCXSmiles(*p) == "F[C@H](Cl)Br |o1:1|" )
    with expansion:
      "FC(Cl)[C@@H](Cl)Br |&1:3|"
      ==
      "F[C@H](Cl)Br |o1:1|"

* Add a couple of new tests.

* rename "relative" to "enhanced"
some reformatting

* Factor out test helper function.

* Actually, enhanced stereo groups are exposed ot Python

* Added discussion of enhanced stereochemistry in reactions to docs

* Fix new test
2019-04-07 06:06:28 +02:00
Greg Landrum
941d7abb5f Fixes #2392 (#2393)
* Fixes #2392

* update release notes
2019-04-06 07:16:55 -04:00
Ric
27f50e332d ignore HTML char codes (#2395) 2019-04-06 05:36:56 +02:00
Greg Landrum
b337415094 Fix github #2311 (#2394)
* Fixes #2311
at least I hope it does

* Stop using deprecated boost functionality

* allow the Murtagh module to import even if the code isn't built
update the associated tests

* update release notes

* typo

* fix integer division
2019-04-04 10:20:56 +02:00
Greg Landrum
9f103a9913 Allow components of the MolStandardize code to be initialized from streams (#2385)
* Fixes #2383 (tests coming in the next commit)
Minor typo fix
Fixes a "bug" in one of the default transforms

* Adds support for directly providing normalization parameter data
instead of requiring the use of a text file.

* allow fragment removers to be initialized with string data

* remove unicode

* allow the reionizer to be initialized from a stream
2019-04-03 04:48:05 +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
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
Greg Landrum
255b254690 Fixes #2332 (#2378) 2019-03-30 08:43:07 -04:00
Greg Landrum
b0617ebc17 Fixes: #2368 (#2373)
* Fixes #2368 (#2369)

* Another use of potentially null environment variables
2019-03-29 21:03:21 -04:00
Greg Landrum
1d01874678 improvements to the Uncharge functionality (#2374)
* modify the uncharger to be use a canonical atom ordering

* add doCanonical cleanup parameter
make canonical ordering the default
document the change

* Add neutralization of additonal negative groups (not just acids).
This may not be the right thing to do.

* expose the new parameter to python

* changes in response to review
2019-03-29 21:02:55 -04:00
Brian Kelley
75096ac33c [WIP] property custom handlers (#2293)
Allow custom type-handlers in the RDProps interface
2019-03-28 17:21:00 +01:00
Dan N
f730d38ceb Removes an extra debugging cerr statment (#2360)
This will show up in every 2D SD file read... Whoops!
2019-03-22 15:50:04 +01: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