Avogadro  1.1.0
/home/kitware/dashboards/avogadro/libavogadro/src/protein.h
00001 /**********************************************************************
00002   Protein - Protein class
00003 
00004   Copyright (C) 2009 Tim Vandermeersch
00005 
00006   This file is part of the Avogadro molecular editor project.
00007   For more information, see <http://avogadro.openmolecules.net/>
00008 
00009   Avogadro is free software; you can redistribute it and/or modify
00010   it under the terms of the GNU General Public License as published by
00011   the Free Software Foundation; either version 2 of the License, or
00012   (at your option) any later version.
00013 
00014   Avogadro is distributed in the hope that it will be useful,
00015   but WITHOUT ANY WARRANTY; without even the implied warranty of
00016   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017   GNU General Public License for more details.
00018 
00019   You should have received a copy of the GNU General Public License
00020   along with this program; if not, write to the Free Software
00021   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00022   02110-1301, USA.
00023  **********************************************************************/
00024 
00025 #ifndef PROTEIN_H
00026 #define PROTEIN_H
00027 
00028 #include <avogadro/global.h>
00029 
00030 #include <QObject>
00031 #include <QVector>
00032 
00033 namespace Avogadro {
00034 
00035   class Atom;
00036   class Residue;
00037   class Molecule;
00038 
00039   class ProteinPrivate;
00072   class A_EXPORT Protein : public QObject
00073   {
00074     Q_OBJECT
00075 
00076     public:
00081       Protein(Molecule *molecule);
00085       virtual ~Protein();
00086 
00088 
00089 
00092       const QVector<QVector<Residue*> >& chains() const;
00096       int numChains() const;
00100       QList<unsigned long> chainAtoms(int index) const;
00104       QList<unsigned long> chainResidues(int index) const;
00106 
00108 
00109 
00112       QByteArray secondaryStructure() const;
00116       bool isHelix(Residue *residue) const;
00120       bool isSheet(Residue *residue) const;
00122 
00123     private:
00124       bool extractFromPDB();
00125       
00126       void sortResiduesByChain();
00127       void iterateForward(Atom *prevCA, Atom *currN, QVector<bool> &visited);
00128       void iterateBackward(Atom *prevN, Atom *currCA, QVector<bool> &visited);
00129 
00130       void detectHBonds();
00131 
00132       void detectStructure();
00133       void extendHelix(char c, int turn, Residue *residue, const QVector<Residue*> &residues);
00134       void extendSheet(int delta, Residue *residue, const QVector<Residue*> &residues);
00135       void clearShortPatterns();
00136       void clearShortPatterns(char c, int min);
00137 
00138       int residueIndex(Residue *residue) const;
00139 
00140       int numHelixes(char c) const;
00141       QList<unsigned long> helixBackboneAtoms(char c, int index);
00142 
00143       ProteinPrivate * const d;
00144   };
00145 
00146 } // End namespace Avogadro
00147 
00148 #endif