Commit Graph

110 Commits

Author SHA1 Message Date
Brian Kelley
287b3a1b36 Fix/rogers fixes (#1293)
* Fixes older apple/gcc builds spewing too many warning

* Fixes typo

* Removes  -Wno-unused-local-typedef from CMakeLists.txt
2017-02-27 16:28:12 +01:00
Greg Landrum
270f7b76e5 Partial support for reading CXSMILES (#1237)
* add a SmilesParserParams object to prepare for this

* add a SmilesParserParams object to prepare for this

* add tests for the SmilesParseParmas

* support name parsing, should it be the default?

* rename CXNSmiles to CXSmiles;
add a spirit parser for CXSmiles coordinate that is at least syntax correct

* abandon boost::spirit for now; crude atom token parser

* support params in smiles parser (not tested, may not build)

* can read coords and atom labels along with mol names; crude, but works

* read coordinate bonds

* remove some compiler warnings with VS2015

* remove a bunch of compiler warnings on windows

* remove more warnings on windows

* remove more warnings on windows

* backup commit: first pass at parsing query features

* radical spec parsing

* handle attachment points using atom mapping

* switch to a named property for atom labels

* fix handling of the "A" atom query

* add functions to construct A and Q queries (needs more work)

* fix a problem created while cleaning up warnings earlier

* add some additional convenience functions for making generic atoms.
Still need M and to recognize these while writing CXSMILES

* add M queries; update some tests

* fix a linux compile problem

* get the cxsmiles stuff working in python; basic testing

* support "M" in CXSMILES
2017-01-31 13:50:36 -05:00
Jan Holst Jensen
5616dc2597 Add support for dative bonds. (#1190)
* Add support for dative bonds to molfile reader plus writer and to SMILES reader (SMILES writer already supports it).
Initial V3000 molfile reader and writer dative bond support by Esben Jannik Bjerrum.

* first pass at adding -> as dative bond in smiles/smarts
more testing required

* all tests pass

* update .cmake files for lex
2016-12-14 09:44:18 +01:00
Greg Landrum
f0bb85dfdb Fixes #1049 (#1050)
* fixes #1049
That was almost too easy

* elaborate the test a bit
2016-09-01 09:22:17 +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
Brian Kelley
900fc391aa Fixes middle-justified symbols in sd files, adds M_CHG tests (#1002)
* Adds boost::trim, M  CHG tests

* stoi is a c++11 feature

* Actually test charges
2016-08-02 14:41:08 +02:00
Paolo Tosco
63b6bdef46 - RCSB SDF files which feature right-justified element names can now be parsed (#994)
- added a relevant test
2016-07-27 14:49:52 +02:00
Brian Kelley
552a78ed3a Dev/moldescriptors callables (#944)
* Adds a generic Property Calculation API

     Property mw(Property::MW);
     Property logp(Property::ALOGP);

     // User based function
     struct MyPropertyFunction : public PropertyFxn {
       double compute(const ROMol &mol) const {
         return rdcast<double>(mol.getNumAtoms());
       }
       bool isAdditive() const { return true; }
     }

     // Make the a num atom property
     boost::shared_ptr<PropertyFxn> atomfxn(new MyPropertyFxn);
     Property numAtoms("NumAtoms", atomfxn);

     double alogp = logp.computeProperty(mol);
     double nAtoms = numAtoms.computeProperty(mol);

And a ProperFilter API

     // Molecular weight filter 0 ... 500.
     PropertyFilter mw(PropertyFilter::MW, 0., 500.);
     
     // log p Filter -5 ... 5
     PropertyFilter logp(PropertyFilter::ALOGP, -5.0, 5.0);

     // User based function
     struct MyPropertyFunction : public PropertyFxn {
       double compute(const ROMol &mol) const {
         return rdcast<double>(mol.getNumAtoms());
       }
     }

     // add num atom property 0. ... 50.
     boost::shared_ptr<PropertyFxn> atomfxn(new MyPropertyFxn);
     PropertyFilter natoms("NumAtoms", 0., 50., atomfxn);

     if (natoms.accepts(mol)) {
      // molecule is ok
     } else {
      // molecules is bad
     }

* Adds missing includes

* Fixes g++ access to class based enums

* Updates to new API, adds better property registry

* Adds a generic Property Calculation API

     Property mw(Property::MW);
     Property logp(Property::ALOGP);

     // User based function
     struct MyPropertyFunction : public PropertyFxn {
       double compute(const ROMol &mol) const {
         return rdcast<double>(mol.getNumAtoms());
       }
       bool isAdditive() const { return true; }
     }

     // Make the a num atom property
     boost::shared_ptr<PropertyFxn> atomfxn(new MyPropertyFxn);
     Property numAtoms("NumAtoms", atomfxn);

     double alogp = logp.computeProperty(mol);
     double nAtoms = numAtoms.computeProperty(mol);

And a ProperFilter API

     // Molecular weight filter 0 ... 500.
     PropertyFilter mw(PropertyFilter::MW, 0., 500.);
     
     // log p Filter -5 ... 5
     PropertyFilter logp(PropertyFilter::ALOGP, -5.0, 5.0);

     // User based function
     struct MyPropertyFunction : public PropertyFxn {
       double compute(const ROMol &mol) const {
         return rdcast<double>(mol.getNumAtoms());
       }
     }

     // add num atom property 0. ... 50.
     boost::shared_ptr<PropertyFxn> atomfxn(new MyPropertyFxn);
     PropertyFilter natoms("NumAtoms", 0., 50., atomfxn);

     if (natoms.accepts(mol)) {
      // molecule is ok
     } else {
      // molecules is bad
     }

* Adds missing includes

* Fixes g++ access to class based enums

* Updates to new API, adds better property registry

* Fixes merge error

* Removes unused unordered_map include

* Adds calcClogP calcMR as functions.

* PropertyFxn ->PropertyFunctor, adds Queries::Query based queries.

* Adds Python PropertyFunctors (can’t be used as queries yet)

* Exposes PropertyRangeQueries

* Adds doc strings

* Throws error if stereo is not assigned.

* Adds molecule annotation.
2016-06-22 08:07:56 +02:00
Greg Landrum
2ca85c775f Fixes #741 2016-02-13 05:38:03 +01:00
Greg Landrum
e08e0d16d8 first pass, using google style 2015-11-14 14:58:11 +01:00
Brian Kelley
fb84c9f0b7 Switches to URANGE_CHECK when appropriate 2015-10-18 21:14:02 -04:00
Brian Kelley
5f59333a56 Silences unused parameters 2015-10-18 14:02:29 -04:00
Brian Kelley
6ebbeb3bd3 Major conversion of std::string API to const std::string & 2015-09-25 15:15:59 -04:00
Greg Landrum
797db2fa82 remove Atom::setMass() 2015-03-22 17:57:04 +01: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
cd03d877fb Fixes #337 2014-10-04 14:44:42 +02:00
Greg Landrum
c0bf384832 Fixes #290 2014-07-12 08:20:31 +02:00
Greg Landrum
6b26036f6a Fixes #269 2014-05-23 08:26:26 +02:00
Greg Landrum
f5cf3322fe code cleanup: removing compiler warnings 2014-05-08 06:06:07 +02:00
Greg Landrum
601c21f19d Fixes #189 2014-03-13 05:23:56 +01:00
Greg Landrum
75be63fd6b merge with trunk 2014-02-09 05:00:18 +01: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
aab11535e8 Fixes #196 2014-01-16 02:07:03 -05:00
Greg Landrum
f653e9e961 more isotope fixing 2014-01-08 06:51:48 +01:00
Greg Landrum
4b72d1b153 add (non-standard) handling of R groups to v3k mol parser 2014-01-08 05:22:15 +01:00
Greg Landrum
3fe2e13afd support forcing V3000 writing and kekulization in the SDWriter
Fixes #174
2013-12-30 06:58:48 +01:00
Greg Landrum
0b8bd3079d fix isotope handling in V3K 2013-12-28 07:37:52 +01:00
Greg Landrum
9e91538d64 get rgroups working 2013-12-25 08:18:44 +01:00
Greg Landrum
b45423be3e rename makeAtomNumEqualsQuery() to makeAtomNumQuery() 2013-12-14 09:14:57 +01:00
Greg Landrum
ae14fa3bd9 add support for the ZCH and HYD elements in mol files 2013-12-07 17:40:04 +01:00
Greg Landrum
12ecae962e merge 2013-12-07 10:51:19 +01:00
Greg Landrum
60a68669da remove more clang warnings 2013-12-02 04:46:46 +01:00
Greg Landrum
3b0c72c4bf initial pass at ZBO support.
does not yet handle the HYD and ZCH lines
2013-11-30 06:58:03 +01:00
Greg Landrum
1acae67cba Merge branch 'master' into PDB_29September2013 2013-10-08 05:51:57 +02:00
Greg Landrum
e51d2c1020 Fixes #118 2013-10-05 16:19:02 +02:00
Greg Landrum
937ee9f60a add in-place form of removeHs() 2013-10-04 07:19:01 +02:00
Greg Landrum
2546ea0d7a Fixes #82 2013-08-23 09:18:04 +02:00
Greg Landrum
8c70417690 Fixes #88 2013-08-21 20:45:54 +02:00
Greg Landrum
d80ab78f70 initial pass at this 2013-07-15 17:04:15 +02:00
Greg Landrum
c36547010a Fix #64 2013-07-09 05:40:55 +02:00
Greg Landrum
581695da0f support R values greater than 9 in ctabs 2013-07-04 08:21:13 +02:00
Greg Landrum
8ac59a261a continuation of cleanup from issue 279 [follow up from rev2355] 2013-01-09 04:11:15 +00:00
Greg Landrum
b82a6b29a6 another swing at sf.net issue 279. This one is somewhat more efficient 2013-01-08 05:35:03 +00:00
Greg Landrum
b6a26aca44 fix and test sf.net issue273 2012-12-12 09:10:05 +00:00
Greg Landrum
a5baf0239b more on the locale problem; this still needs testing on non-linux 2012-12-12 04:20:14 +00:00
Greg Landrum
33d571850d support skip lines in ctabs;
get sdf property lines that contain only white space working
2012-10-10 10:16:13 +00:00
Greg Landrum
4a3933ed00 fix and test Issue 3557675 2012-08-15 04:21:33 +00:00
Greg Landrum
e16b345d8b fix and test issue 3525673 2012-05-12 05:31:54 +00:00
Greg Landrum
e7d25d7973 tests passing except reactions 2012-04-21 04:40:55 +00:00