BALL 1.5.0
nucleotide.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_NUCLEOTIDE_H
6#define BALL_KERNEL_NUCLEOTIDE_H
7
8#ifndef BALL_KERNEL_FRAGMENT_H
10#endif
11
12#ifndef BALL_KERNEL_RESIDUE_H
13# include <BALL/KERNEL/residue.h>
14#endif
15
16#ifndef BALL_KERNEL_NUCLEOTIDEITERATOR_H
18#endif
19
20
21#define BALL_NUCLEOTIDE_DEFAULT_ID ""
22#define BALL_NUCLEOTIDE_DEFAULT_INSERTION_CODE ' '
23
24namespace BALL
25{
26 class NucleicAcid;
27
36 : public Fragment
37 {
38 public:
39
41
42
45
46
48 {
50 PROPERTY__5_PRIME = Residue::NUMBER_OF_PROPERTIES + 1,
55
57 NUMBER_OF_PROPERTIES
58 };
59
61
64
67
69 Nucleotide(const Nucleotide& nucleotide, bool deep = true);
70
73 (const String& name,
75 char insertion_code = BALL_NUCLEOTIDE_DEFAULT_INSERTION_CODE);
76
78 virtual ~Nucleotide();
79
81 virtual void clear();
82
84 virtual void destroy();
85
87
90
94 void persistentWrite(PersistenceManager& pm, const char* name = 0) const;
95
100
102
105
111 void set(const Nucleotide& nucleotide, bool deep = true);
112
119 Nucleotide& operator = (const Nucleotide& nucleotide);
120
126 void get(Nucleotide& nucleotide, bool deep = true) const;
127
131 void swap(Nucleotide& nucleotide);
132
134
139 bool operator == (const Nucleotide& nucleotide) const;
140
144 bool operator != (const Nucleotide& nucleotide) const;
145
148
154
160
164 void setID(const String& id);
165
169 const String& getID() const;
170
180 void setInsertionCode(char insertion_code);
181
188
192 char getInsertionCode() const;
193
197 void prepend(Atom& atom);
198
202 void append(Atom& atom);
203
207 void insert(Atom& atom);
208
213 void insertBefore(Atom& atom, Composite& before);
214
219 void insertAfter(Atom& atom, Composite& after);
220
224 bool remove(Atom& atom);
225
229 void spliceBefore(Nucleotide& nucleotide);
230
234 void spliceAfter(Nucleotide& nucleotide);
235
239 void splice(Nucleotide& nucleotide);
240
242
245
251 bool isTerminal() const;
252
257 bool is3Prime() const;
258
263 bool is5Prime() const;
264
266
269
274 virtual bool isValid() const;
275
282 virtual void dump(std::ostream& s = std::cout, Size depth = 0) const;
283
285
286 private:
287
288 AtomContainer* getAtomContainer(Position position);
289
290 const AtomContainer* getAtomContainer(Position position) const;
291
292 Size countAtomContainers() const;
293
294 void prepend(AtomContainer& atom_container);
295
296 void append(AtomContainer& atom_container);
297
298 void insert(AtomContainer& atom_container);
299
300 void insertBefore(AtomContainer& atom_container, Composite& composite);
301
302 void insertAfter(AtomContainer& atom_container, Composite& composite);
303
304 void spliceBefore(AtomContainer& atom_container);
305
306 void spliceAfter(AtomContainer& base_ragment);
307
308 void splice(AtomContainer& AtomContainer);
309
310 bool remove(AtomContainer& AtomContainer);
311
312 bool isSuperAtomContainerOf(const AtomContainer& atom_container) const;
313
316
317 // --- ATTRIBUTES
318
319 String id_;
320
321 char insertion_code_;
322 };
323
324
325 template <class NucleotideContainerType>
326 const Nucleotide* get5Prime(const NucleotideContainerType& nucleotide_container)
327 {
329 for ( res_it = nucleotide_container.beginNucleotide(); !res_it.isEnd(); ++res_it)
330 {
331 return &(*res_it);
332 }
333
334 return 0;
335 }
336
337 template <class NucleotideContainerType>
338 const Nucleotide* get3Prime(const NucleotideContainerType& nucleotide_container)
339 {
340 for (NucleotideConstIterator res_it = nucleotide_container.rbeginNucleotide(); !res_it.isREnd(); ++res_it)
341 {
342 return &(*res_it);
343 }
344
345 return 0;
346 }
347
348} // namespace BALL
349
350#endif // BALL_KERNEL_NUCLEOTIDE_H
#define BALL_NUCLEOTIDE_DEFAULT_INSERTION_CODE
Definition: nucleotide.h:22
#define BALL_NUCLEOTIDE_DEFAULT_ID
Definition: nucleotide.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
Definition: constants.h:13
BALL_EXPORT AtomContainerList atomContainers(const AtomContainer &fragment, bool selected_only=false)
const Nucleotide * get5Prime(const NucleotideContainerType &nucleotide_container)
Definition: nucleotide.h:326
BALL_EXPORT bool operator==(const String &s1, const String &s2)
BALL_EXPORT bool operator!=(const String &s1, const String &s2)
const Nucleotide * get3Prime(const NucleotideContainerType &nucleotide_container)
Definition: nucleotide.h:338
BALL_INLINE bool isEnd() const
Check whether the iterator points to the position after the last item of the container.
BALL_INLINE bool isREnd() const
Test wheter the iterator points to the position before the first element.
Property
The number of predefined properties for AtomContainer.
Definition: atomContainer.h:43
void persistentWrite(PersistenceManager &pm, const char *name=0) const
virtual void clear()
Clears the nucleotides contents.
void persistentRead(PersistenceManager &pm)
void append(Atom &atom)
virtual void dump(std::ostream &s=std::cout, Size depth=0) const
void set(const Nucleotide &nucleotide, bool deep=true)
void insert(Atom &atom)
virtual bool isValid() const
void setInsertionCode(char insertion_code)
NucleicAcid * getNucleicAcid()
bool is5Prime() const
const String & getID() const
void splice(Nucleotide &nucleotide)
bool isTerminal() const
void swap(Nucleotide &nucleotide)
virtual void destroy()
Clears the nucleotides contents and removes it from all composite structures.
void insertAfter(Atom &atom, Composite &after)
void get(Nucleotide &nucleotide, bool deep=true) const
void spliceAfter(Nucleotide &nucleotide)
void setID(const String &id)
bool remove(Atom &atom)
Nucleotide()
Default constructor.
bool is3Prime() const
void insertBefore(Atom &atom, Composite &before)
Nucleotide(const Nucleotide &nucleotide, bool deep=true)
Copy constructor.
void spliceBefore(Nucleotide &nucleotide)
Nucleotide(const String &name, const String &id=BALL_NUCLEOTIDE_DEFAULT_ID, char insertion_code=BALL_NUCLEOTIDE_DEFAULT_INSERTION_CODE)
Detailled constructor.
virtual ~Nucleotide()
Destructor.
const NucleicAcid * getNucleicAcid() const
void unsetInsertionCode()
void prepend(Atom &atom)
char getInsertionCode() const
@ NUMBER_OF_PROPERTIES
Definition: residue.h:70
#define BALL_EXPORT
Definition: COMMON/global.h:50