BALL 1.5.0
Loading...
Searching...
No Matches
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
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
24namespace BALL
25{
26 class Chain;
27 class Protein;
28 class SecondaryStructure;
29
37 : public Fragment
38 {
39 public:
40
42
43
46
47
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,
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
389 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
#define BALL_RESIDUE_DEFAULT_INSERTION_CODE
Definition residue.h:22
#define BALL_RESIDUE_DEFAULT_ID
Definition residue.h:21
#define BALL_KERNEL_DEFINE_ITERATOR_CREATORS(Type)
Definition iterator.h:25
#define BALL_DECLARE_STD_ITERATOR_WRAPPER(container, type, method_name)
#define BALL_CREATE_DEEP(name)
Definition create.h:26
const Residue * getCTerminal(const ResidueContainerType &residue_container)
Definition residue.h:472
std::reverse_iterator< ResidueConstIterator > ResidueConstReverseIterator
const Residue * getNTerminal(const ResidueContainerType &residue_container)
Definition residue.h:457
ConstBidirectionalIterator< Composite, Residue, Composite::CompositeIterator, ResidueIteratorTraits > ResidueConstIterator
Residue(const Residue &residue, bool deep=true)
Copy constructor.
void unsetInsertionCode()
void swap(Residue &residue)
bool isCTerminal() const
bool isAminoAcid() const
Angle getTorsionPhi() const
Angle getTorsionPsi() const
const String & getID() const
virtual void destroy()
Clears the contents of this instance and removes it from all composite structures.
const Chain * getChain() const
SecondaryStructure * getSecondaryStructure()
virtual void dump(std::ostream &s=std::cout, Size depth=0) const
void persistentWrite(PersistenceManager &pm, const char *name=0) const
void set(const Residue &residue, bool deep=true)
const PDBAtom * getPDBAtom(Position position) const
void insertAfter(PDBAtom &atom, Composite &after)
bool isNTerminal() const
void persistentRead(PersistenceManager &pm)
Protein * getProtein()
void insert(PDBAtom &atom)
bool remove(PDBAtom &atom)
void get(Residue &residue, bool deep=true) const
Angle getTorsionOmega() const
void setInsertionCode(char insertion_code)
virtual ~Residue()
Destructor.
Size countPDBAtoms() const
PDBAtom * getPDBAtom(Position position)
char getInsertionCode() const
virtual bool isResidue() const
Definition residue.h:389
bool isTerminal() const
String getFullName(FullNameType type=ADD_VARIANT_EXTENSIONS) const
virtual void clear()
Clears the contents of this instance.
Residue()
Default constructor.
Chain * getChain()
virtual bool isValid() const
void insertBefore(PDBAtom &atom, Composite &before)
bool hasTorsionPhi() const
void spliceBefore(Residue &residue)
bool hasTorsionOmega() const
const SecondaryStructure * getSecondaryStructure() const
void spliceAfter(Residue &residue)
Residue(const String &name, const String &id=BALL_RESIDUE_DEFAULT_ID, char insertion_code=BALL_RESIDUE_DEFAULT_INSERTION_CODE)
Detailled constructor.
@ ADD_VARIANT_EXTENSIONS
Add the residue variant extensions (e.g. '-C' for C-terminal residues)
Definition residue.h:81
@ NO_VARIANT_EXTENSIONS
This returns the unmodified residue name only.
Definition residue.h:79
void splice(Residue &residue)
void setID(const String &id)
@ PROPERTY__HAS_SSBOND
Definition residue.h:57
@ PROPERTY__WATER
Definition residue.h:55
@ PROPERTY__N_TERMINAL
Definition residue.h:61
@ PROPERTY__CYCLIC
Definition residue.h:67
@ PROPERTY__C_TERMINAL
Definition residue.h:59
@ PROPERTY__AMINO_ACID
Definition residue.h:53
bool hasTorsionPsi() const
void prepend(PDBAtom &atom)
const Protein * getProtein() const
void append(PDBAtom &atom)
#define BALL_EXPORT