secondaryStructure.h

Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 //
00004 // $Id: secondaryStructure.h,v 1.42 2005/10/23 12:02:20 oliver Exp $
00005 //
00006 
00007 #ifndef BALL_KERNEL_SECONDARYSTRUCTURE_H
00008 #define BALL_KERNEL_SECONDARYSTRUCTURE_H
00009 
00010 #ifndef BALL_KERNEL_RESIDUE_H
00011 # include <BALL/KERNEL/residue.h>
00012 #endif
00013 
00014 #ifndef BALL_KERNEL_RESIDUEITERATOR_H
00015 # include <BALL/KERNEL/residueIterator.h>
00016 #endif
00017 
00018 #ifndef BALL_KERNEL_ATOMCONTAINER_H
00019 # include <BALL/KERNEL/atomContainer.h>
00020 #endif
00021 
00022 namespace BALL 
00023 {
00031   class BALL_EXPORT SecondaryStructure
00032     : public AtomContainer
00033   {
00034     public:
00035 
00036     BALL_CREATE_DEEP(SecondaryStructure)
00037 
00038     
00041 
00044     enum Type
00045     {
00047       HELIX,
00049       COIL,
00051       STRAND,
00053       TURN,
00055       UNKNOWN,
00057       NUMBER_OF_TYPES
00058     };
00059 
00061 
00062 
00066 
00068     SecondaryStructure();
00069   
00071     SecondaryStructure(const SecondaryStructure& secondary_structure, bool deep = true);
00072   
00074     SecondaryStructure(const String& name);
00075 
00077     virtual ~SecondaryStructure();
00078 
00080     virtual void clear();
00081   
00083     virtual void destroy();
00085 
00093     bool operator == (const SecondaryStructure& secondary_structure) const;
00094 
00098     bool operator != (const SecondaryStructure& secondary_structure) const;
00100 
00104 
00106     void persistentWrite(PersistenceManager& pm, const char* name = 0) const
00107       throw(Exception::GeneralException);
00108 
00110     void persistentRead(PersistenceManager& pm)
00111       throw(Exception::GeneralException);
00113 
00117 
00123     void set(const SecondaryStructure& secondary_structure, bool deep = true);
00124 
00130     SecondaryStructure& operator = (const SecondaryStructure& secondary_structure);
00131 
00137     void get(SecondaryStructure& secondary_structure, bool deep = true) const;
00138 
00142     void swap(SecondaryStructure& secondary_structure);
00144 
00148 
00150     Type getType() const { return type_; }
00151 
00153     void setType(Type type) { type_ = type; }
00154       
00159     Protein* getProtein();
00160 
00165     const Protein* getProtein() const;
00166 
00171     Chain* getChain();
00172 
00177     const Chain* getChain() const;
00178 
00184     Residue* getResidue(Position position);
00185   
00191     const Residue* getResidue(Position position) const;
00192 
00198     Residue* getNTerminal();
00199   
00205     const Residue* getNTerminal() const;
00206 
00212     Residue* getCTerminal();
00213   
00219     const Residue* getCTerminal() const;
00220 
00226     PDBAtom* getPDBAtom(Position position);
00227   
00233     const PDBAtom* getPDBAtom(Position position) const;
00234   
00238     Size countResidues() const;
00239 
00243     Size countPDBAtoms() const;
00244 
00248     void prepend(Residue& residue);
00249 
00253     void append(Residue& residue);
00254 
00258     void insert(Residue& residue);
00259 
00264     void insertBefore(Residue& residue, Composite& before);
00265 
00270     void insertAfter(Residue& residue, Composite& after);
00271 
00275     bool remove(Residue& residue);
00276 
00281     void spliceBefore(SecondaryStructure& secondary_structure);
00282 
00287     void spliceAfter(SecondaryStructure& secondary_structure);
00288 
00292     void splice(SecondaryStructure& secondary_structure);
00294 
00298   
00303     virtual bool isValid() const;
00304 
00311     virtual void dump(std::ostream& s = std::cout, Size depth = 0) const;
00312 
00314       
00315     // --- EXTERNAL ITERATORS
00316 
00317     BALL_KERNEL_DEFINE_ITERATOR_CREATORS(Residue)
00318     BALL_KERNEL_DEFINE_ITERATOR_CREATORS(PDBAtom)
00319 
00320     protected:
00321     
00323     Type type_;
00324 
00325     private:
00326 
00327     Fragment* getFragment(Position position);
00328   
00329     const Fragment* getFragment(Position position) const;
00330   
00331     Atom* getAtom(Position position);
00332   
00333     const Atom* getAtom(Position position) const;
00334 
00335     void prepend(Atom& atom);
00336 
00337     void append(Atom& atom);
00338 
00339     void insert(Atom& atom);
00340 
00341     void insertBefore(Atom& atom, Composite& before);
00342 
00343     void insertAfter(Atom& atom, Composite& after);
00344 
00345     bool remove(Atom& atom);
00346 
00347     void prepend(AtomContainer& atom_container);
00348 
00349     void append(AtomContainer& atom_container);
00350 
00351     void insert(AtomContainer& atom_container);
00352       
00353     void insertBefore(AtomContainer& atom_container, Composite& before);
00354 
00355     void insertAfter(AtomContainer& atom_container, Composite& after);
00356 
00357     void spliceBefore(AtomContainer& atom_container);
00358 
00359     void spliceAfter(AtomContainer& atom_container);
00360 
00361     void splice(AtomContainer& atom_container);
00362 
00363     bool remove(AtomContainer& atom_container);
00364 
00365     BALL_KERNEL_DEFINE_ITERATOR_CREATORS(AtomContainer)
00366 
00367   };
00368 
00369 } // namespace BALL
00370 
00371 #endif // BALL_KERNEL_SECONDARYSTRUCTURE_H