Commit Graph

70 Commits

Author SHA1 Message Date
Greg Landrum
26c07e67d6 fixes #908 (#2328)
Code is a mess and really should be refactored
2019-03-10 21:43:20 -04:00
Greg Landrum
069e920645 Fixes #2224 (#2234)
* Fixes #2224

* test the basics
2019-01-21 11:31:02 -05:00
Greg Landrum
17323d11bf Modify removeHs so that it does not remove degree 0 atoms (#2089)
* Modify removeHs so that it does not remove degree 0 atoms
Update the docs at the same time.

* include a warning when not removing some Hs

* clear up a problem with the warning log
2018-10-05 13:43:09 -04:00
Greg Landrum
ffc123a665 Fixes #2062 (#2079) 2018-10-02 11:41:22 -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
Greg Landrum
2174465536 minor oversight in fix for #1810 (#1816) 2018-04-11 09:42:11 +02:00
Greg Landrum
e8c46ca2a9 Fix/github1810 (#1811)
* Fixes #1810
There's still a problem with stereo atoms (see the commented out test),
but this takes care of the basics and that's up next.

* clean up that last problematic bit.
Still needs all tests to run

* this seems to be a necessary workaround for problems with VS2017.
It's a bit ugly, but shouldn't have any performance impact, so I'm not
going to get too worked up.

* This set of changes alters what we get for some of the InChI test cases.
Adjust for that.
2018-04-11 04:48:16 +02:00
Maciej Wójcikowski
bfb3559e07 Improve AddHs for molecules read from PDB (#1647)
* Add AtomPDBResidueInfo during molops::addhs

* Test addhs and AtomPDBResidueInfo

* Little cleanup

* Fix serial

* Refactor code, add unique Hs labels

* Move code to separate function + bugfix.

* Make function optional (AddHs residueInfo param)

* Rename argument
2018-01-20 05:27:30 +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
Brian Kelley
0a871bd72e Dev/modern cxx ranges (#1701)
Enable range-based for loops for molecules
2018-01-05 06:09:51 +00:00
Greg Landrum
67bc7a647c merge on master; modernization needs to be repeated 2017-09-05 17:09:50 +02:00
Greg Landrum
960c539995 Fixes #1439 (#1530) 2017-08-23 17:24:47 -04: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
339fa081e5 Merge fix/github908 branch 2016-07-27 04:49:55 +02:00
Greg Landrum
e846a96123 Fix github #868 (#925)
* fix an incorrect status message

* Fixes #868

Switch the warning to only occur if we have a non-negated atomic number query with value=1
2016-05-31 13:23:21 -04:00
Greg Landrum
f4265f3d75 doc clarification 2016-02-17 06:08:43 +01:00
Greg Landrum
38f8a92d2b Fixes #754 2016-02-17 05:15:53 +01:00
Greg Landrum
4f2aa0f51e Fixes #758 2016-02-08 16:11:22 +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
Greg Landrum
23d7df99f0 Fixes #678 2015-12-17 04:11:21 +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
Greg Landrum
e37296d7c7 post review 2015-11-14 08:08:14 +01:00
Brian Kelley
a146c3826a Remove unused variables/functions and register keyword 2015-10-18 10:01:00 -04:00
Greg Landrum
33306bc2bb fix the chiral volume flag 2015-08-14 16:07:21 +02:00
Greg Landrum
076550908d fix another merge Hs bug 2015-08-03 12:23:54 +02:00
Greg Landrum
b89b3a8831 Fixes #544
hopefully for real this time
2015-07-31 10:30:18 +02:00
Greg Landrum
f6f6313ab1 fix removal of negated H queries 2015-07-24 17:20:39 -04:00
Greg Landrum
b051a842cc another patch for #544 2015-07-23 11:05:30 -04:00
Greg Landrum
2821907842 Fixes #544 2015-07-23 08:36:16 -04:00
Brian Kelley
020a9a8f36 Change merge_unmappped_only to more consistent mergeUnmappedOnly 2015-04-26 09:03:28 -04:00
Brian Kelley
61dd0b16a5 Add merge_unmapped_only option to MergeQueryHs
By default all atoms are merged, however when
this flag is true, any mapped atom will convert
explicit Hs to implicit.  This is due to not
wanting to convert mapped hydrogens taking
part in reactions.
2015-04-23 09:54:23 -04: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
d2504ddb0a Fixes #190 2014-03-01 06:37:33 +01:00
Greg Landrum
9f4471f872 more on #204
A few other cleanups
2014-02-06 06:43:28 +01:00
ptosco
8b17ef13fd - modified Code/GraphMol/AddHs.cpp so that hydrogens are not
removed when the heavy atom they are connected to is not
  in its default valence state, while it has one of the
  acceptable valence states (otherwise it still has to be
  removed for sanitization purposes)
- updated the MMFF validation suite SMILES accordingly
2014-02-01 13:05:10 +01:00
Greg Landrum
02027ad0bd passes all tests 2014-01-28 09:26:23 +01:00
ptosco
dded46bf0d - removed a spurious #ifdef [...] #endif from
Code/ForceField/MMFF/testMMFFForceField.h
- re-prepared the SDF files from their MOL2 counterparts present in the
  original  MMFF validation suites. For this purpose a C++ program was
  written which only uses information in MOL2 files and in .fc files
  provided by Halgren. The C++ program does not depend on RDKit.
- re-prepared the SMILES files from their SDF counterparts using
  a Python script which calls MolToSmiles()
- found an issue which affects 2 files in the test suite, namely
  ERULE_05 and PO02A (only the hypervalent notation). The issue is
  connected with removal of hydrogens bonded to phosphorous and
  appears to be fixed by the modifications in Code/GraphMol/AddHs.cpp
  and Code/GraphMol/SmilesParse/SmilesWrite.cpp. This issue is
  independent of the changes ini the SDF files; indeed, it has
  always been present, and had been previously addressed by
  manual correction of the two SMILES strings
2014-01-27 19:05:49 +01:00
Greg Landrum
c13a643e06 Fixes #191 2014-01-12 05:42:50 +01:00
Greg Landrum
b45423be3e rename makeAtomNumEqualsQuery() to makeAtomNumQuery() 2013-12-14 09:14:57 +01:00
Greg Landrum
2e1bb83ea0 add in-place form of mergeQueryHs() 2013-10-04 08:56:38 +02:00
Greg Landrum
c95d57aa54 add in-place form of addHs() 2013-10-04 07:58:53 +02:00
Greg Landrum
937ee9f60a add in-place form of removeHs() 2013-10-04 07:19:01 +02:00
Greg Landrum
a4734bbd43 start using the alternate getProp form 2013-07-20 07:26:06 -04:00
Greg Landrum
61f333db07 a couple copyright cleanups 2013-07-04 09:21:03 +02:00
Greg Landrum
326007754b this was broken by the fix for #42 2013-07-04 08:19:51 +02:00
Greg Landrum
0b45f3c320 fix GitHub issue 8
This breaks the InChI python unit tests, so those need to be cleaned up.
2013-03-01 06:54:33 +00:00
Greg Landrum
5324c9c783 fix and test sf.net issue 272 2012-12-12 04:39:55 +00:00
Greg Landrum
e7d25d7973 tests passing except reactions 2012-04-21 04:40:55 +00:00