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
9 # include <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 
24 namespace BALL
25 {
26  class NucleicAcid;
27 
36  : public Fragment
37  {
38  public:
39 
41 
42 
45 
47  enum Property
48  {
50  PROPERTY__5_PRIME = Residue::NUMBER_OF_PROPERTIES + 1,
55 
57  NUMBER_OF_PROPERTIES
58  };
59 
61 
64 
66  Nucleotide();
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 
99  void persistentRead(PersistenceManager& pm);
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 
153  NucleicAcid* getNucleicAcid();
154 
159  const NucleicAcid* getNucleicAcid() const;
160 
164  void setID(const String& id);
165 
169  const String& getID() const;
170 
180  void setInsertionCode(char insertion_code);
181 
187  void unsetInsertionCode();
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
BALL::get5Prime
const Nucleotide * get5Prime(const NucleotideContainerType &nucleotide_container)
Definition: nucleotide.h:326
BALL::Nucleotide
Definition: nucleotide.h:35
BALL_EXPORT
#define BALL_EXPORT
Definition: COMMON/global.h:50
BALL_NUCLEOTIDE_DEFAULT_INSERTION_CODE
#define BALL_NUCLEOTIDE_DEFAULT_INSERTION_CODE
Definition: nucleotide.h:22
BALL::Nucleotide::PROPERTY__NUCLEOTIDE
Definition: nucleotide.h:54
fragment.h
BALL::operator!=
BALL_EXPORT bool operator!=(const String &s1, const String &s2)
BALL::NucleicAcid
Definition: nucleicAcid.h:27
BALL::ConstBidirectionalIterator
Definition: bidirectionalIterator.h:23
BALL::AtomContainer::Property
Property
The number of predefined properties for AtomContainer.
Definition: atomContainer.h:42
BALL::Nucleotide::PROPERTY__3_PRIME
Definition: nucleotide.h:52
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_CREATE_DEEP
#define BALL_CREATE_DEEP(name)
Definition: create.h:26
BALL_NUCLEOTIDE_DEFAULT_ID
#define BALL_NUCLEOTIDE_DEFAULT_ID
Definition: nucleotide.h:21
BALL::AtomContainer
Definition: atomContainer.h:29
BALL_SIZE_TYPE
nucleotideIterator.h
BALL::ConstBidirectionalIterator::isREnd
BALL_INLINE bool isREnd() const
Test wheter the iterator points to the position before the first element.
Definition: bidirectionalIterator.h:89
BALL::Atom
Definition: atom.h:87
BALL
Definition: constants.h:12
BALL::String
Definition: string.h:56
BALL::PersistenceManager
Definition: persistenceManager.h:72
BALL::atomContainers
BALL_EXPORT AtomContainerList atomContainers(const AtomContainer &fragment, bool selected_only=false)
BALL::operator==
BALL_EXPORT bool operator==(const String &s1, const String &s2)
BALL::ConstBidirectionalIterator::isEnd
BALL_INLINE bool isEnd() const
Check whether the iterator points to the position after the last item of the container.
Definition: bidirectionalIterator.h:73
residue.h
BALL::Composite
Definition: composite.h:71
BALL::Fragment
Definition: fragment.h:20
BALL::get3Prime
const Nucleotide * get3Prime(const NucleotideContainerType &nucleotide_container)
Definition: nucleotide.h:338
BALL::Residue::NUMBER_OF_PROPERTIES
Definition: residue.h:70