00001 //------------------------------------------------------------------------------ 00002 // This file is part of the OpenStructure project <www.openstructure.org> 00003 // 00004 // Copyright (C) 2008-2017 by the OpenStructure authors 00005 // 00006 // This library is free software; you can redistribute it and/or modify it under 00007 // the terms of the GNU Lesser General Public License as published by the Free 00008 // Software Foundation; either version 3.0 of the License, or (at your option) 00009 // any later version. 00010 // This library is distributed in the hope that it will be useful, but WITHOUT 00011 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00012 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00013 // details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public License 00016 // along with this library; if not, write to the Free Software Foundation, Inc., 00017 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00018 //------------------------------------------------------------------------------ 00019 #ifndef OST_SEC_STRUCT_HH 00020 #define OST_SEC_STRUCT_HH 00021 00022 #include <vector> 00023 00024 #include <ost/base.hh> 00025 #include <ost/geom/geom.hh> 00026 #include <ost/message.hh> 00027 #include <ost/mol/mol.hh> 00028 00029 namespace ost { namespace mol{ namespace alg{ 00030 00031 inline Real DSSPHBondEnergy(const geom::Vec3& h_pos, const geom::Vec3& n_pos, 00032 const geom::Vec3& c_pos, const geom::Vec3& o_pos) { 00033 Real on = 1.0/geom::Distance(o_pos,n_pos); 00034 Real ch = 1.0/geom::Distance(c_pos,h_pos); 00035 Real oh = 1.0/geom::Distance(o_pos,h_pos); 00036 Real cn = 1.0/geom::Distance(c_pos,n_pos); 00037 return 27.888 * (on+ch-oh-cn); 00038 } 00039 00040 // Raw estimation of secondary structure 00041 // 00042 // This function is not intended for Python export, since the input has to be 00043 // prepared carefully. It basically estimates the secondary structure of a 00044 // stretch of amino acids based on the hydrogen bond pattern as described for 00045 // the dssp tool. 00046 // 00047 // To define the hydrogen bonds you need to provide the vectors donor_for_one 00048 // and donor_for two. The index of an acceptor residue appears in one of the 00049 // two vectors if the corresponding hbond energy is < -0.5 00050 // (be aware of prolines that can't be donors!). 00051 // There are two of those vectors, because for every residue we store the two 00052 // lowest energy acceptors. If there is no acceptor available, the value 00053 // at this position must be -1. 00054 // The connected_to_next contains zeros and ones that defines, whether there 00055 // is a peptide bond towards the next residue and the ca_positions vector 00056 // is self explaining. 00057 // As an additional feature you can also provide the according data for the 00058 // full structure but only estimate the secondary structure for a small 00059 // stretch, that gets defined by start_idx and size. 00060 // For an example usage have a look at the AssignSecStruct functions. 00061 00062 String RawEstimateSS(const std::vector<geom::Vec3>& ca_positions, 00063 int start_idx, int size, 00064 const std::vector<int>& donor_for_one, 00065 const std::vector<int>& donor_for_two, 00066 const std::vector<int>& connected_to_next); 00067 00068 void PrepareSSData(const ost::mol::ResidueViewList& res_list, 00069 std::vector<int>& res_indices, 00070 std::vector<geom::Vec3>& ca_positions, 00071 std::vector<int>& donor_for_one, 00072 std::vector<int>& donor_for_two, 00073 std::vector<int>& connected_to_next); 00074 00075 void AssignSecStruct(ost::mol::EntityView& ent); 00076 00077 void AssignSecStruct(ost::mol::EntityHandle& ent); 00078 00079 }}} //ns 00080 00081 #endif