1 // Copyright (c) 2016, Novartis Institutes for BioMedical Research Inc. 2 // All rights reserved. 3 // 4 // Redistribution and use in source and binary forms, with or without 5 // modification, are permitted provided that the following conditions are 6 // met: 7 // 8 // * Redistributions of source code must retain the above copyright 9 // notice, this list of conditions and the following disclaimer. 10 // * Redistributions in binary form must reproduce the above 11 // copyright notice, this list of conditions and the following 12 // disclaimer in the documentation and/or other materials provided 13 // with the distribution. 14 // * Neither the name of Novartis Institutes for BioMedical Research Inc. 15 // nor the names of its contributors may be used to endorse or promote 16 // products derived from this software without specific prior written 17 // permission. 18 // 19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 // 31 32 #ifndef RDKIT_FREESASA_H 33 #define RDKIT_FREESASA_H 34 35 #include <RDGeneral/export.h> 36 #include <GraphMol/RDKitBase.h> 37 38 namespace RDKit { 39 namespace common_properties { 40 namespace Atom { 41 RDKIT_FREESASALIB_EXPORT extern const std::string 42 SASA; // Solvent Accessible Surface Area for atom- double 43 RDKIT_FREESASALIB_EXPORT extern const std::string 44 SASAClass; // Class type, 0,1,2... etc 45 RDKIT_FREESASALIB_EXPORT extern const std::string 46 SASAClassName; // Class name, Polar, APolar etc... 47 } // namespace Atom 48 namespace Molecule { 49 RDKIT_FREESASALIB_EXPORT extern const std::string 50 SASA; // Total Solvent Accessible Surface area for molecule; 51 } 52 } // namespace common_properties 53 } // namespace RDKit 54 55 namespace FreeSASA { 56 struct RDKIT_FREESASALIB_EXPORT SASAOpts { 57 enum Algorithm { LeeRichards = 0, ShrakeRupley = 1 }; 58 enum Classifier { Protor = 0, NACCESS = 1, OONS = 2 }; 59 enum Classes { Unclassified = 0, APolar = 1, Polar = 2 }; 60 61 Algorithm algorithm; 62 Classifier classifier; 63 double probeRadius; 64 SASAOpts(); 65 SASAOpts(Algorithm alg, Classifier cls); 66 SASAOpts(Algorithm alg, Classifier cls, double pr); 67 }; 68 69 //! Classify atoms using standard freesaa classifiers 70 /*! 71 Note: 72 73 FreeSASA identified Classes end up in 74 atom.getProp<int>(common_properties::Atom::SASAClassName) 75 FreeSASA Class names end up in 76 atom.getProp<string>(common_properties::Atom::SASAClassName) 77 78 \param mol: Molecule to analyze 79 \param radii output vector of radii where radii[idx] is the radius for 80 atom with index idx 81 \return false if no atoms could be classified 82 */ 83 RDKIT_FREESASALIB_EXPORT bool classifyAtoms( 84 RDKit::ROMol &mol, std::vector<double> &radii, 85 const FreeSASA::SASAOpts &opts = SASAOpts()); 86 87 //! calculate the Solvent Accessible Surface Area using the FreeSASA library. 88 /*! 89 SASA atom contribution data is stored in 90 atom.getProp(common_properites::Atom::SASA); 91 92 \param mol: Molecule to analyze 93 \param radii vector of radii where radii[idx] is the radius for atom with 94 index idx 95 These can be passed in or calculated with classifyAtoms for 96 some proteins. 97 \param confIdx specify the conformation [default -1] 98 \param query query atom to limit the number of atoms to the ones matching 99 the query 100 precanned query atoms can be made with 101 makeFreeSasaPolarAtomQuery and 102 makeFreeSasaAPolarAtomQuery for classified polar and apolar 103 atoms respectively. 104 105 \param opts SASAOpts class specifying options. 106 \return the requested solvent accessible surface area 107 */ 108 RDKIT_FREESASALIB_EXPORT double calcSASA(const RDKit::ROMol &mol, 109 const std::vector<double> &radii, 110 int confIdx = -1, 111 const RDKit::QueryAtom *query = NULL, 112 const SASAOpts &opts = SASAOpts()); 113 114 //! Make a query atom returning the FreeSASA supplied apolar atom classification 115 /*! 116 These are atoms that have the "SASAClassName" property set to "Apolar" 117 after calling classifyAtoms. 118 119 \return QueryAtom pointer 120 */ 121 RDKIT_FREESASALIB_EXPORT const RDKit::QueryAtom *makeFreeSasaAPolarAtomQuery(); 122 //! Make a query atom returning the FreeSASA supplied polar atom classification 123 /*! 124 These are atoms that have the "SASAClassName" property set to "Polar" 125 after calling classifyAtoms. 126 \return QueryAtom pointer 127 */ 128 RDKIT_FREESASALIB_EXPORT const RDKit::QueryAtom *makeFreeSasaPolarAtomQuery(); 129 } // namespace FreeSASA 130 131 #endif 132