00001 // 00002 // Copyright (c) 2007, Novartis Institutes for BioMedical Research Inc. 00003 // All rights reserved. 00004 // 00005 // Redistribution and use in source and binary forms, with or without 00006 // modification, are permitted provided that the following conditions are 00007 // met: 00008 // 00009 // * Redistributions of source code must retain the above copyright 00010 // notice, this list of conditions and the following disclaimer. 00011 // * Redistributions in binary form must reproduce the above 00012 // copyright notice, this list of conditions and the following 00013 // disclaimer in the documentation and/or other materials provided 00014 // with the distribution. 00015 // * Neither the name of Novartis Institutes for BioMedical Research Inc. 00016 // nor the names of its contributors may be used to endorse or promote 00017 // products derived from this software without specific prior written permission. 00018 // 00019 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00020 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00021 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00022 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00023 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00024 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00025 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00026 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00027 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00028 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00029 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00030 // 00031 00032 #ifndef __RD_REACTIONPARSER_H_21Aug2006__ 00033 #define __RD_REACTIONPARSER_H_21Aug2006__ 00034 00035 #include <string> 00036 #include <iostream> 00037 00038 namespace RDKit{ 00039 class ChemicalReaction; 00040 00041 //! used to indicate an error in parsing reaction data 00042 class ChemicalReactionParserException : public std::exception { 00043 public: 00044 //! construct with an error message 00045 explicit ChemicalReactionParserException(const char *msg) : _msg(msg) {}; 00046 //! construct with an error message 00047 explicit ChemicalReactionParserException(const std::string msg) : _msg(msg) {}; 00048 //! get the error message 00049 const char *message () const { return _msg.c_str(); }; 00050 ~ChemicalReactionParserException () throw () {}; 00051 private: 00052 std::string _msg; 00053 }; 00054 00055 00056 00057 //! Parse a text block in MDL rxn format into a ChemicalReaction 00058 ChemicalReaction * RxnBlockToChemicalReaction(const std::string &rxnBlock); 00059 //! Parse a file in MDL rxn format into a ChemicalReaction 00060 ChemicalReaction * RxnFileToChemicalReaction(const std::string &fileName); 00061 //! Parse a text stream in MDL rxn format into a ChemicalReaction 00062 ChemicalReaction * RxnDataStreamToChemicalReaction(std::istream &rxnStream, 00063 unsigned int &line); 00064 00065 //! Parse a string containing "Reaction SMARTS" into a ChemicalReaction 00066 /*! 00067 * Our definition of Reaction SMARTS is something that looks a lot like 00068 * reaction SMILES, except that SMARTS queries are allowed on the reactant 00069 * side and that atom-map numbers are required (at least for now) 00070 */ 00071 ChemicalReaction * RxnSmartsToChemicalReaction(const std::string &text); 00072 00073 00074 00075 }; // end of RDKit namespace 00076 00077 #endif
1.5.5