BALL  1.5.0
residue.h
Go to the documentation of this file.
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4 
5 #ifndef BALL_KERNEL_RESIDUE_H
6 #define BALL_KERNEL_RESIDUE_H
7 
8 #ifndef BALL_KERNEL_FRAGMENT_H
9 # include <BALL/KERNEL/fragment.h>
10 #endif
11 
12 #ifndef BALL_KERNEL_PDBATOMITERATOR_H
14 #endif
15 
16 #ifndef BALL_KERNEL_RESIDUEITERATOR_H
18 #endif
19 
20 
21 #define BALL_RESIDUE_DEFAULT_ID ""
22 #define BALL_RESIDUE_DEFAULT_INSERTION_CODE ' '
23 
24 namespace BALL
25 {
26  class Chain;
27  class Protein;
28  class SecondaryStructure;
29 
37  : public Fragment
38  {
39  public:
40 
42 
43 
46 
48  enum Property
49  {
51  PROPERTY__NON_STANDARD = Fragment::NUMBER_OF_PROPERTIES + 1,
68 
70  NUMBER_OF_PROPERTIES
71  };
72 
77  {
82  // Add the residue ID separated by a colon
84  // Add the residue ID and the residue extension
85  ADD_VARIANT_EXTENSIONS_AND_ID
86  };
87 
89 
90 
94 
97 
99  Residue(const Residue& residue, bool deep = true);
100 
103  (const String& name,
104  const String& id = BALL_RESIDUE_DEFAULT_ID,
105  char insertion_code = BALL_RESIDUE_DEFAULT_INSERTION_CODE);
106 
108  virtual ~Residue();
109 
111  virtual void clear();
112 
114  virtual void destroy();
115 
117 
120 
124  void persistentWrite(PersistenceManager& pm, const char* name = 0) const;
125 
130 
132 
135 
141  void set(const Residue& residue, bool deep = true);
142 
145  Residue& operator = (const Residue& residue);
146 
149  void get(Residue& residue, bool deep = true) const;
150 
153  void swap(Residue& residue);
154 
156 
161  bool operator == (const Residue& residue) const;
162 
166  bool operator != (const Residue& residue) const;
167 
168 
172 
185  String getFullName(FullNameType type = ADD_VARIANT_EXTENSIONS) const;
186 
190  bool hasTorsionPhi() const;
191 
196 
200  bool hasTorsionPsi() const;
201 
206 
210  bool hasTorsionOmega() const;
211 
216 
222 
227  const Protein* getProtein() const;
228 
234 
239  const Chain* getChain() const;
240 
246 
252 
259 
265  const PDBAtom* getPDBAtom(Position position) const;
266 
270  void setID(const String& id);
271 
275  const String& getID() const;
276 
286  void setInsertionCode(char insertion_code);
287 
294 
298  char getInsertionCode() const;
299 
304 
308  void prepend(PDBAtom& atom);
309 
313  void append(PDBAtom& atom);
314 
318  void insert(PDBAtom& atom);
319 
324  void insertBefore(PDBAtom& atom, Composite& before);
325 
330  void insertAfter(PDBAtom& atom, Composite& after);
331 
335  bool remove(PDBAtom& atom);
336 
340  void spliceBefore(Residue& residue);
341 
345  void spliceAfter(Residue& residue);
346 
350  void splice(Residue& residue);
351 
353 
356 
361  bool isAminoAcid() const;
362 
368  bool isTerminal() const;
369 
375  bool isNTerminal() const;
376 
382  bool isCTerminal() const;
383 
385 
388  virtual bool isResidue() const { return true; }
391 
395 
400  virtual bool isValid() const;
401 
408  virtual void dump(std::ostream& s = std::cout, Size depth = 0) const;
409 
411 
412  // --- EXTERNAL ITERATORS
413 
416 
417 
418  private:
419 
420  AtomContainer* getAtomContainer(Position position);
421 
422  const AtomContainer* getAtomContainer(Position position) const;
423 
424  Size countAtomContainers() const;
425 
426  void prepend(AtomContainer& atom_container);
427 
428  void append(AtomContainer& atom_container);
429 
430  void insert(AtomContainer& atom_container);
431 
432  void insertBefore(AtomContainer& atom_container, Composite& composite);
433 
434  void insertAfter(AtomContainer& atom_container, Composite& composite);
435 
436  void spliceBefore(AtomContainer& atom_container);
437 
438  void spliceAfter(AtomContainer& base_ragment);
439 
440  void splice(AtomContainer& AtomContainer);
441 
442  bool remove(AtomContainer& AtomContainer);
443 
444  bool isSuperAtomContainerOf(const AtomContainer& atom_container) const;
445 
448 
449  // --- ATTRIBUTES
450 
451  String id_;
452 
453  char insertion_code_;
454  };
455 
456  template <class ResidueContainerType>
457  const Residue* getNTerminal(const ResidueContainerType& residue_container)
458  {
459  ResidueConstIterator res_it(residue_container.beginResidue());
460  for (; res_it != residue_container.endResidue(); ++res_it)
461  {
462  if (res_it->isAminoAcid() == true)
463  {
464  return &(*res_it);
465  }
466  }
467 
468  return 0;
469  }
470 
471  template <class ResidueContainerType>
472  const Residue* getCTerminal(const ResidueContainerType& residue_container)
473  {
474  ResidueConstReverseIterator res_it(residue_container.rbeginResidue());
475  for (; res_it != residue_container.rendResidue(); ++res_it)
476  {
477  // Look for the last residue marked as amino acid
478  if (res_it->isAminoAcid() == true)
479  {
480  return &(*res_it);
481  }
482  }
483 
484  return 0;
485  }
486 
487 } // namespace BALL
488 
489 #endif // BALL_KERNEL_RESIDUE_H
BALL::Residue::append
void append(PDBAtom &atom)
BALL_EXPORT
#define BALL_EXPORT
Definition: COMMON/global.h:50
BALL_RESIDUE_DEFAULT_INSERTION_CODE
#define BALL_RESIDUE_DEFAULT_INSERTION_CODE
Definition: residue.h:22
BALL::TAngle< float >
BALL::Residue::getChain
Chain * getChain()
BALL::Residue::getSecondaryStructure
SecondaryStructure * getSecondaryStructure()
BALL::Chain
Definition: chain.h:32
BALL::Residue::clear
virtual void clear()
Clears the contents of this instance.
BALL::Residue::spliceBefore
void spliceBefore(Residue &residue)
BALL::Residue::insert
void insert(PDBAtom &atom)
residueIterator.h
BALL::Residue::getChain
const Chain * getChain() const
BALL::Residue::swap
void swap(Residue &residue)
fragment.h
BALL::operator!=
BALL_EXPORT bool operator!=(const String &s1, const String &s2)
BALL::Residue::getTorsionPhi
Angle getTorsionPhi() const
BALL::Residue::get
void get(Residue &residue, bool deep=true) const
BALL::Residue::ADD_RESIDUE_ID
@ ADD_RESIDUE_ID
Definition: residue.h:83
BALL::AtomContainer
Definition: atomContainer.h:32
BALL::SecondaryStructure
Definition: secondaryStructure.h:31
BALL::Residue::prepend
void prepend(PDBAtom &atom)
BALL_RESIDUE_DEFAULT_ID
#define BALL_RESIDUE_DEFAULT_ID
Definition: residue.h:21
BALL_DECLARE_STD_ITERATOR_WRAPPER
#define BALL_DECLARE_STD_ITERATOR_WRAPPER(container, type, method_name)
Definition: stdIteratorWrapper.h:30
BALL_KERNEL_DEFINE_ITERATOR_CREATORS
#define BALL_KERNEL_DEFINE_ITERATOR_CREATORS(Type)
Definition: iterator.h:25
BALL::Residue::isTerminal
bool isTerminal() const
BALL::ConstBidirectionalIterator
Definition: bidirectionalIterator.h:25
BALL::Residue::unsetInsertionCode
void unsetInsertionCode()
BALL::Residue::getInsertionCode
char getInsertionCode() const
BALL_CREATE_DEEP
#define BALL_CREATE_DEEP(name)
Definition: create.h:26
BALL::PersistenceManager
Definition: persistenceManager.h:73
BALL::PDBAtom
Definition: PDBAtom.h:40
BALL::Residue::isCTerminal
bool isCTerminal() const
BALL::Residue
Definition: residue.h:38
BALL::Residue::PROPERTY__CYCLIC
@ PROPERTY__CYCLIC
Definition: residue.h:67
BALL::Residue::insertBefore
void insertBefore(PDBAtom &atom, Composite &before)
BALL::Residue::NO_VARIANT_EXTENSIONS
@ NO_VARIANT_EXTENSIONS
This returns the unmodified residue name only.
Definition: residue.h:79
BALL::Residue::FullNameType
FullNameType
Definition: residue.h:77
BALL::Residue::persistentRead
void persistentRead(PersistenceManager &pm)
BALL::Residue::getProtein
Protein * getProtein()
BALL::Residue::getPDBAtom
PDBAtom * getPDBAtom(Position position)
BALL::String
Definition: string.h:57
BALL::getNTerminal
const Residue * getNTerminal(const ResidueContainerType &residue_container)
Definition: residue.h:457
BALL::Residue::remove
bool remove(PDBAtom &atom)
BALL::Residue::hasTorsionOmega
bool hasTorsionOmega() const
BALL::Residue::getPDBAtom
const PDBAtom * getPDBAtom(Position position) const
BALL::Protein
Definition: protein.h:30
BALL::Residue::dump
virtual void dump(std::ostream &s=std::cout, Size depth=0) const
BALL
Definition: constants.h:13
BALL::Residue::PROPERTY__HAS_SSBOND
@ PROPERTY__HAS_SSBOND
Definition: residue.h:57
BALL::Residue::PROPERTY__C_TERMINAL
@ PROPERTY__C_TERMINAL
Definition: residue.h:59
BALL::Residue::countPDBAtoms
Size countPDBAtoms() const
BALL::Residue::insertAfter
void insertAfter(PDBAtom &atom, Composite &after)
BALL::Residue::~Residue
virtual ~Residue()
Destructor.
BALL::Residue::destroy
virtual void destroy()
Clears the contents of this instance and removes it from all composite structures.
BALL::Residue::spliceAfter
void spliceAfter(Residue &residue)
BALL::Residue::Residue
Residue(const String &name, const String &id=BALL_RESIDUE_DEFAULT_ID, char insertion_code=BALL_RESIDUE_DEFAULT_INSERTION_CODE)
Detailled constructor.
BALL::Residue::isNTerminal
bool isNTerminal() const
BALL::Residue::PROPERTY__N_TERMINAL
@ PROPERTY__N_TERMINAL
Definition: residue.h:61
BALL::Residue::hasTorsionPhi
bool hasTorsionPhi() const
BALL::Residue::Residue
Residue()
Default constructor.
BALL::Residue::hasTorsionPsi
bool hasTorsionPsi() const
BALL::atomContainers
BALL_EXPORT AtomContainerList atomContainers(const AtomContainer &fragment, bool selected_only=false)
BALL::Residue::setID
void setID(const String &id)
BALL::Composite
Definition: composite.h:74
BALL_SIZE_TYPE
BALL::Residue::PROPERTY__WATER
@ PROPERTY__WATER
Definition: residue.h:55
BALL::Residue::getTorsionOmega
Angle getTorsionOmega() const
BALL::Fragment
Definition: fragment.h:22
BALL::Residue::getSecondaryStructure
const SecondaryStructure * getSecondaryStructure() const
BALL::operator==
BALL_EXPORT bool operator==(const String &s1, const String &s2)
BALL::Residue::getID
const String & getID() const
BALL::Residue::Residue
Residue(const Residue &residue, bool deep=true)
Copy constructor.
PDBAtomIterator.h
BALL::Residue::isAminoAcid
bool isAminoAcid() const
BALL::Fragment::NUMBER_OF_PROPERTIES
@ NUMBER_OF_PROPERTIES
Definition: fragment.h:35
BALL::Residue::isValid
virtual bool isValid() const
BALL::AtomContainer::Property
Property
The number of predefined properties for AtomContainer.
Definition: atomContainer.h:43
BALL::Residue::splice
void splice(Residue &residue)
BALL::Residue::PROPERTY__AMINO_ACID
@ PROPERTY__AMINO_ACID
Definition: residue.h:53
BALL::getCTerminal
const Residue * getCTerminal(const ResidueContainerType &residue_container)
Definition: residue.h:472
BALL::Residue::getFullName
String getFullName(FullNameType type=ADD_VARIANT_EXTENSIONS) const
BALL::Residue::setInsertionCode
void setInsertionCode(char insertion_code)
BALL::Residue::ADD_VARIANT_EXTENSIONS
@ ADD_VARIANT_EXTENSIONS
Add the residue variant extensions (e.g. '-C' for C-terminal residues)
Definition: residue.h:81
BALL::ResidueConstReverseIterator
std::reverse_iterator< ResidueConstIterator > ResidueConstReverseIterator
Definition: residueIterator.h:73
BALL::Residue::getTorsionPsi
Angle getTorsionPsi() const
BALL::Residue::persistentWrite
void persistentWrite(PersistenceManager &pm, const char *name=0) const
BALL::Residue::getProtein
const Protein * getProtein() const
BALL::Residue::set
void set(const Residue &residue, bool deep=true)