Commit Graph

98 Commits

Author SHA1 Message Date
Greg Landrum
094f65f5f4 Fix #2148 and #2244 (#2275)
* not quite done yet

* Fixes #2244

* Fixes #2148

This fixes a few of the knock-on effects of the actual fix.

* Test that we still write SMILES properly

* Fixes #2266 (#2269)

* Fixes #2268 (#2270)

* Improve interactivity of output SVG (#2253)

* Add clickable atoms when tagAtoms() is called

* add python tests

* add class tags for atoms and bonds

* add marker to allow easy insertion of extra text
2019-02-21 08:03:28 -07:00
Greg Landrum
0360a9de84 Fixes #2268 (#2270) 2019-02-15 10:35:35 -05:00
Greg Landrum
98abd6f16f Fixes #2266 (#2269) 2019-02-15 10:35:09 -05:00
Greg Landrum
b917fd4159 Fixes #1850 (#2087)
* Fixes #1850

* docstring update in response to review

* return immediately if the conformer isn't 3D
also header update
2018-10-04 08:29:50 -04:00
Dan N
8bed437c5f Addresses several minor warning messages during the build (#1935)
* Address minor compilation warning messages

Addresses trivial compilation warning messages:

    [ 11%] Building CXX object Code/GraphMol/CMakeFiles/GraphMol.dir/AddHs.cpp.o
    rdkit/Code/GraphMol/AddHs.cpp:497:9: warning: unused variable 'dblBond' [-Wunused-variable]
      Bond *dblBond = nullptr;
            ^
    1 warning generated.

    [ 11%] Building CXX object Code/GraphMol/CMakeFiles/GraphMol.dir/Chirality.cpp.o
    rdkit/Code/GraphMol/Chirality.cpp:1738:62: warning: unused parameter 'mol' [-Wunused-parameter]
    bool isBondCandidateForStereo(const Bond *bond, const ROMol &mol) {
                                                                 ^
    1 warning generated.

    [ 44%] Building CXX object Code/GraphMol/CMakeFiles/graphmolMolOpsTest.dir/molopstest.cpp.o
    rdkit/Code/GraphMol/molopstest.cpp:4694:12: warning: unused variable 'nm' [-Wunused-variable]
        ROMol *nm = MolOps::renumberAtoms(*m, nVect);
               ^
    rdkit/Code/GraphMol/molopstest.cpp:6941:16: warning: unused variable 'm' [-Wunused-variable]
            RWMol *m = SmilesToMol(smiles);
                   ^
    2 warnings generated.

    [ 42%] Building CXX object Code/GraphMol/CMakeFiles/graphmoltestPicklerGlobalSetting.dir/testPicklerGlobalSettings.cpp.o
    rdkit/Code/GraphMol/testPicklerGlobalSettings.cpp:257:14: warning: unused parameter 'argc' [-Wunused-parameter]
    int main(int argc, char *argv[]) {
                 ^
    rdkit/Code/GraphMol/testPicklerGlobalSettings.cpp:257:26: warning: unused parameter 'argv' [-Wunused-parameter]
    int main(int argc, char *argv[]) {
                             ^
    2 warnings generated.

    [ 55%] Building CXX object Code/GraphMol/FilterCatalog/CMakeFiles/FilterCatalog.dir/FunctionalGroupHierarchy.cpp.o
    rdkit/Code/GraphMol/FilterCatalog/FunctionalGroupHierarchy.cpp:176:20: warning: unused variable 'NUM_FUNCS' [-Wunused-const-variable]
    const unsigned int NUM_FUNCS =
                       ^
    1 warning generated.

    [ 84%] Building CXX object Code/GraphMol/StructChecker/CMakeFiles/StructChecker.dir/ReCharge.cpp.o
    rdkit/Code/GraphMol/StructChecker/ReCharge.cpp:405:17: warning: unused variable 'atom' [-Wunused-variable]
        const Atom &atom = *Mol.getAtomWithIdx(i);
                    ^
    1 warning generated.

    [ 84%] Building CXX object Code/GraphMol/StructChecker/CMakeFiles/StructChecker.dir/Tautomer.cpp.o
    rdkit/Code/GraphMol/StructChecker/Tautomer.cpp:61:12: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare]
        if (-1 == ti || -1 == tj) continue;
            ~~ ^  ~~
    rdkit/Code/GraphMol/StructChecker/Tautomer.cpp:61:24: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare]
        if (-1 == ti || -1 == tj) continue;
                        ~~ ^  ~~
    2 warnings generated.

    [ 88%] Building CXX object Code/GraphMol/RGroupDecomposition/CMakeFiles/testRGroupDecomp.dir/testRGroupDecomp.cpp.o
    rdkit/Code/GraphMol/RGroupDecomposition/testRGroupDecomp.cpp:428:9: warning: unused variable 'res' [-Wunused-variable]
        int res = decomp.add(*mol);
            ^
    1 warning generated.

    [ 96%] Building CXX object Code/SimDivPickers/CMakeFiles/testSimDivPickers.dir/testPickers.cpp.o
    rdkit/Code/SimDivPickers/testPickers.cpp:19:10: warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
      return abs((double)i - (double)j);
             ^
    rdkit/Code/SimDivPickers/testPickers.cpp:19:10: note: use function 'std::abs' instead
      return abs((double)i - (double)j);
             ^~~
             std::abs
    1 warning generated.

* Close open file handles during build set-up

Under Python3, the update_pains.py file generated warning
messages like:

    == Done updating pains files
    /Code/GraphMol/FilterCatalog/update_pains.py:140: ResourceWarning:
unclosed file <_io.TextIOWrapper
name='/Code/GraphMol/FilterCatalog/../../../Data/Pains/wehi_pains.csv'
mode='r' encoding='UTF-8'>
      for smiles, name in csv.reader(open(PAINS_CSV)):
    /Code/GraphMol/FilterCatalog/update_pains.py:169: ResourceWarning:
unclosed file <_io.TextIOWrapper
name='/Code/GraphMol/FilterCatalog/pains_a.in' mode='r'
encoding='UTF-8'>
      t = open(filename).read()
    /Code/GraphMol/FilterCatalog/update_pains.py:169: ResourceWarning:
unclosed file <_io.TextIOWrapper
name='/Code/GraphMol/FilterCatalog/pains_b.in' mode='r'
encoding='UTF-8'>
      t = open(filename).read()
    /Code/GraphMol/FilterCatalog/update_pains.py:169: ResourceWarning:
unclosed file <_io.TextIOWrapper
name='/Code/GraphMol/FilterCatalog/pains_c.in' mode='r'
encoding='UTF-8'>
      t = open(filename).read()
2018-06-26 13:57:22 -07: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
3637cd4d75 Fixes Issue 1614 (#1781)
* This makes assignStereochemistry cleanIt=True not remove CIS/TRANS
bond stereo chemistry that was manually added as described in issue #1614.

Incorrect CIS/TRANS stereochemistry will still be removed by
'cleanIt=true' if symmetry is detected. However, this symmetry
detection doesn't work in more complex pseudo-stereo chemistry cases:
bond stereo that depends on other bond stereo to break symmetry; and
bond stereo that depends on other atom stereo centers to break
symmetry. Test cases for these cases have been added ifdef'd in based
on USE_NEW_STEREOCHEMISTRY.

However, getting USE_NEW_STEREOCHEMISTRY to work in a copacetic way is
not trivial, I tried a little bit here to no avail. I'm leaving the
test cases checked in as they should be useful when we decide to make
the plunge into using Canon::chiralRankMolAtoms for symmetry detection
instead of the CIP ranks.

So this fixes at least the glaring issue of STEREOCIS and STEREOTRANS
being incorrectly removed by 'cleanIt=true' when it is indeed valid
stereo. The checks made for symmetry are rudimentary, but don't feel
complete.

* add another test; make what's being tested explicit

* test smiles generation and function when Hs have been added

* add a test that fails

* I think that it's ok to remove this

* backup

* At this point all tests pass.
Bond wedging is now handled even if sanitization is turned off when mol files are read

* adjust to code changes

* fix a couple problems caused by rebase

* update docs
2018-04-01 17:48:36 +02:00
Paolo Tosco
503b84995c - make bond stereo detection in rings consistent (#1727) 2018-02-01 04:28:10 +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
1efa8e696e another clang-format run 2017-10-12 06:42:15 +02:00
Greg Landrum
f94e277856 another pass of clang modernize 2017-10-12 06:35:51 +02:00
Greg Landrum
87786c08b5 Merge branch 'master' into modern_cxx
# Conflicts:
#	.travis.yml
#	Code/GraphMol/FileParsers/MolFileParser.cpp
#	Code/GraphMol/FileParsers/MolFileStereochem.cpp
#	Code/GraphMol/ForceFieldHelpers/UFF/testUFFHelpers.cpp
#	Code/GraphMol/MolAlign/testMolAlign.cpp
#	Code/GraphMol/MolDraw2D/MolDraw2D.cpp
#	Code/GraphMol/MolDraw2D/Wrap/rdMolDraw2D.cpp
#	Code/GraphMol/QueryOps.cpp
#	Code/GraphMol/ROMol.cpp
#	Code/GraphMol/SmilesParse/test.cpp
#	Code/GraphMol/Trajectory/Trajectory.cpp
#	Code/GraphMol/Wrap/Atom.cpp
#	Code/GraphMol/Wrap/Bond.cpp
#	Code/GraphMol/new_canon.cpp
#	Code/RDGeneral/testDict.cpp
#	Code/SimDivPickers/Wrap/MaxMinPicker.cpp
2017-10-05 05:58:38 +02:00
Greg Landrum
64399a46f0 Fixes github1497 (#1555)
* move detectBondStereoChemistry() into MolOps

* switch more code over to using the new function

* add an addStereoChemistryFrom3D() function. Needs testing still.

* add some tests

* cleanups and rename
2017-09-11 08:37:32 -04:00
Greg Landrum
f7de91db05 Fixes #1423 (#1424)
* Fixes #1423

* hanoTest fails; otherwise ok

* remove a redundant dir spec on input

* address comments from review

* typo

* typo (sigh)
2017-07-02 10:27:45 +02:00
Greg Landrum
d5fd08369b Fixes #1423 (#1424)
* Fixes #1423

* hanoTest fails; otherwise ok

* remove a redundant dir spec on input

* address comments from review

* typo

* typo (sigh)
2017-06-03 09:32:07 -04:00
Greg Landrum
f6ced134f0 a number of other small changes from manually reviewing the PR 2017-04-22 17:24:57 +02:00
Greg Landrum
915cf08faa run clang-format with c++-11 style over that 2017-04-22 17:19:10 +02:00
Greg Landrum
7c0bb0b743 clang-tidy output 2017-04-22 17:09:24 +02:00
Greg Landrum
f2c1a95c6e Fixes #1294 (#1302)
* Fixes #1294
There was no reason to require only two ring bonds.

* code now matches the docs
2017-02-10 08:50:28 -05:00
Greg Landrum
6509e52611 Fixes #1230 (#1231)
* Fixes #1230

* add a test for cleanIt = False
2016-12-23 13:02:15 -05:00
Brian Cole
9ed4250067 Find potential stereo bonds should return any (#1202)
* Wrap Chem.FindPotentialStereoBonds into Python.

* findPotentialStereoBonds now sets the Bond.GetStereo property of the double bond to Bond::STEREOANY.

Some of the doc strings indicated this as the desired behavior, but
some others also indicated otherwise. So I've cleaned up and
refactored those doc strings as well to be consistent. Pulled all the
doc string comments from the .cpp file up to the .h file and merged
all the necessary prose, including adding some about the fact rings
are ignored.

Previously, users would have to test the size of the GetStereoAtoms
vector to determine whether this function found potential double bond
stereo. Testing for Bond::STEREOANY instead is way more straight
forward.
2016-12-17 05:37:30 +01:00
Greg Landrum
9dcef9ac57 Fixes #607 (#1075) 2016-09-23 04:57:07 +02:00
Greg Landrum
91674e6482 Fixes issue #1021 (#1026)
* Fixes #1021, kind of.
The test for the bug passes, but there are other failures

* all tests except hanoi pass

* passes all tests

* remove some vestigial code

* remove debug-droppings

* minor documentation
2016-08-30 18:59:10 +02:00
Greg Landrum
8009b867b5 Fixes #1034: squiggle bonds are now preserved if no sanitization is done (#1043)
* backup commit

* typo

* forgot the test file

* also test that atom chirality is handled properly
2016-08-30 16:02:31 +02:00
Greg Landrum
d0ed0e900c Fixes #803 2016-03-09 05:05:33 +01:00
Greg Landrum
e104ef7ff2 drop the explicit "false" in setProp 2016-01-06 04:55:50 +01:00
Greg Landrum
70c2995cf8 Fixes #717
This changes the CIPCode and CIPRank atom properties to no longer be computed properties.
Note: under linux I was unable to actually get the bug to manifest (converting the uint property to an int didn't cause problems), but that doesn't mean it shouldn't still be fixed.
2016-01-06 03:45:14 +01:00
kelley
5dbec2fe85 Adds rdcasts where appropriate 2015-11-29 17:52:27 -05:00
Greg Landrum
e08e0d16d8 first pass, using google style 2015-11-14 14:58:11 +01:00
Brian Kelley
daa7e62258 Fixes signed conversion issues (use rdcast) 2015-10-18 15:16:38 -04:00
Greg Landrum
acf69ea1b8 Fixes #553 2015-08-09 07:19:46 +02:00
Greg Landrum
3077ea75dc an optimization for when molecules have no stereochemistry indicated 2015-04-12 06:44:45 +02:00
Greg Landrum
97d70dd306 add compile-time option to use new sterochem 2015-04-10 09:47:17 +02:00
Greg Landrum
a66662b2a2 switch back to using the previous stereochemistry code for now 2015-04-10 09:47:17 +02:00
Nadine Schneider
7ddff9c71c Some performance fixes 2015-03-20 18:19:08 +01:00
Greg Landrum
6d7b2b0914 merge with master 2015-01-22 06:30:51 -05:00
Brian Kelley
95a92282d1 Dictionary access is saniztized and optimized.
o rdkit gains a RDKit::common_properties namespace that contains common string value properties

 o Dict.h and below gain getPropIfPresent that attempts to retrieve a property and returns
  true/false on success or failure.  This is used to optimize access.

 o rdkit learns how to pass property keys by reference, not value.

A new namespace has been added to RDKit, common_properties
that contains the std::string values for commonly used
properties.  This helps to avoid typos in string values
but also avoids a creation of std::strings from character
values.  All accessors (has/get/clear and getPropIfPresent) now pass
the key by reference.

Additionally, getPropIfPresent removes the double lookup
of hasProp/getProp which can be a significant speedup
in the smiles and smarts parsers (10-20%)
2015-01-15 12:23:29 -05:00
Greg Landrum
52d44a1e47 At this point all C++ tests pass except the two postponed smiles tests dealing with fragment-smiles creation and the smiles test for issue 1844617 (this still needs to be tracked down and fixed).
The commit is just from an untabify run
2014-12-31 07:12:33 +00:00
Greg Landrum
ab0f1dcf60 rename to new_canon (probably should come up with a better name, but this will do for now) 2014-12-22 07:56:26 +00:00
Greg Landrum
cad05ca184 get rid of RankAtoms.cpp and
move the remaining functionality from RankAtoms.h into the new file
RDGeneral/Ranking.h
2014-12-22 07:35:58 +00:00
Greg Landrum
0d21cdc7c9 backup commit 2014-08-24 16:24:31 +02:00
Greg Landrum
6f909ed449 switch chirality to using unsigned ints 2014-07-27 08:09:00 +02:00
Greg Landrum
f5cf3322fe code cleanup: removing compiler warnings 2014-05-08 06:06:07 +02:00
Greg Landrum
0839cf41ad Fixes #210 2014-02-03 05:25:27 +01:00
Greg Landrum
deed4a9acf Merge branch 'Issue194_V3000MolWriter'
Conflicts:
	Code/GraphMol/Chirality.cpp
	Code/GraphMol/FileParsers/test1.cpp
2014-01-22 07:07:27 +01:00
Greg Landrum
c13a643e06 Fixes #191 2014-01-12 05:42:50 +01:00
Greg Landrum
11af614ebc more cleanups of this stuff 2014-01-01 17:35:35 +01:00
Greg Landrum
64366007e1 more C++ style cleanups 2014-01-01 17:16:25 +01:00
Greg Landrum
d779c850c9 further stereochemistry speedupb 2013-12-18 05:12:32 +01:00
Greg Landrum
4d47482f0f speed-up the stereochemistry cleanup 2013-12-18 04:59:30 +01:00