From 4dc3d63fcdcbdb64a6e48da2780025b99ba88481 Mon Sep 17 00:00:00 2001 From: Greg Landrum Date: Tue, 19 Aug 2008 03:05:58 +0000 Subject: [PATCH] Update requirements. Minor cleanups in some cpps Finish the changes so that fileparsers don't throw exceptions unless the file is not found. --- .../PartialCharges/GasteigerCharges.cpp | 2 +- Code/GraphMol/ROMol.h | 1 + Code/GraphMol/Wrap/rdmolfiles.cpp | 34 ++++++------------- Code/RDBoost/Wrap/RDBase.cpp | 4 ++- Docs/SoftwareRequirements.txt | 6 ++-- 5 files changed, 19 insertions(+), 28 deletions(-) diff --git a/Code/GraphMol/PartialCharges/GasteigerCharges.cpp b/Code/GraphMol/PartialCharges/GasteigerCharges.cpp index e38fd2aac..342c9c35b 100755 --- a/Code/GraphMol/PartialCharges/GasteigerCharges.cpp +++ b/Code/GraphMol/PartialCharges/GasteigerCharges.cpp @@ -76,7 +76,7 @@ namespace Gasteiger { namespace RDKit { /*! \brief compute the gaseiger partial charges and return a new molecule with the charges set * - * Ref : J.Gasteiger, M. Marseli, "Iterative Equalization of Oribital Electronegatiity + * Ref : J.Gasteiger, M. Marsili, "Iterative Equalization of Oribital Electronegatiity * A Rapid Access to Atomic Charges", Tetrahedron Vol 36 p3219 1980 */ void computeGasteigerCharges(const ROMol *mol, int nIter, bool throwOnParamFailure) { diff --git a/Code/GraphMol/ROMol.h b/Code/GraphMol/ROMol.h index e2d4f21cd..3addb383d 100755 --- a/Code/GraphMol/ROMol.h +++ b/Code/GraphMol/ROMol.h @@ -295,6 +295,7 @@ namespace RDKit{ //@{ //! returns a pointer to our RingInfo structure + //! Note: the client should not delete this. RingInfo *getRingInfo() const { return dp_ringInfo; }; //! provides access to all neighbors around an Atom diff --git a/Code/GraphMol/Wrap/rdmolfiles.cpp b/Code/GraphMol/Wrap/rdmolfiles.cpp index 8b9807dfb..12f9bef94 100644 --- a/Code/GraphMol/Wrap/rdmolfiles.cpp +++ b/Code/GraphMol/Wrap/rdmolfiles.cpp @@ -43,10 +43,8 @@ namespace RDKit{ } catch (...) { newM=0; } + return static_cast(newM); if(!newM) return 0; - ROMol *res =new ROMol(*newM); - delete newM; - return res; } ROMol *MolFromSmarts(const char *smarts,bool mergeHs=false){ @@ -56,10 +54,7 @@ namespace RDKit{ } catch (...) { newM=0; } - if(!newM) return 0; - ROMol *res =new ROMol(*newM); - delete newM; - return res; + return static_cast(newM); } ROMol *MolFromTPLFile(const char *filename, bool sanitize=true, @@ -67,13 +62,13 @@ namespace RDKit{ RWMol *newM; try { newM = TPLFileToMol(filename,sanitize,skipFirstConf); + } catch (RDKit::BadFileException &e) { + PyErr_SetString(PyExc_IOError,e.message()); + throw python::error_already_set(); } catch (...) { newM=0; } - if(!newM) return 0; - ROMol *res =new ROMol(*newM); - delete newM; - return res; + return static_cast(newM); } ROMol *MolFromTPLBlock(std::string tplBlock, bool sanitize=true, @@ -86,10 +81,7 @@ namespace RDKit{ } catch (...) { newM=0; } - if(!newM) return 0; - ROMol *res =new ROMol(*newM); - delete newM; - return res; + return static_cast(newM); } ROMol *MolFromMolFile(const char *molFilename, bool sanitize=true, bool removeHs=true) { @@ -99,11 +91,10 @@ namespace RDKit{ } catch (RDKit::BadFileException &e) { PyErr_SetString(PyExc_IOError,e.message()); throw python::error_already_set(); + } catch (...) { + newM=0; } - if(!newM) return 0; - ROMol *res =new ROMol(*newM); - delete newM; - return res; + return static_cast(newM); } ROMol *MolFromMolBlock(std::string molBlock, bool sanitize=true, bool removeHs=true) { @@ -115,10 +106,7 @@ namespace RDKit{ } catch (...) { newM=0; } - if(!newM) return 0; - ROMol *res =new ROMol(*newM); - delete newM; - return res; + return static_cast(newM); } } diff --git a/Code/RDBoost/Wrap/RDBase.cpp b/Code/RDBoost/Wrap/RDBase.cpp index f0bdc937d..2d1e4a864 100755 --- a/Code/RDBoost/Wrap/RDBase.cpp +++ b/Code/RDBoost/Wrap/RDBase.cpp @@ -1,11 +1,13 @@ // $Id$ // -// Copyright (c) 2004-2006 greg Landrum and Rational Discovery LLC +// Copyright (c) 2004-2008 greg Landrum and Rational Discovery LLC // // @@ All Rights Reserved @@ // #include #define PY_ARRAY_UNIQUE_SYMBOL rdbase_array_API +#include +#include #include #include "numpy/oldnumeric.h" diff --git a/Docs/SoftwareRequirements.txt b/Docs/SoftwareRequirements.txt index 49cff4318..cdb014604 100755 --- a/Docs/SoftwareRequirements.txt +++ b/Docs/SoftwareRequirements.txt @@ -4,9 +4,9 @@ By: Greg Landrum A. Required Python and the like: 1) Python 2.3 or later - 2) Numeric Python (numpy.sourceforge.net) - binary versions for windows can be downloaded here: - http://biopython.org/DIST/Numeric-24.2.win32-py2.5.exe + 2) NumPy (http://numpy.scipy.org/) + binary versions can be downloaded here: + http://sourceforge.net/project/showfiles.php?group_id=1369&package_id=175103 3) [not required with Python2.5 and later] A database wrapper, one of: - pyPgSQL (http://pypgsql.sourceforge.net/) - pysqlite2 (http://www.initd.org/tracker/pysqlite/wiki/pysqlite)