OpenStructure
alignment_handle.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2011 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
10 // This library is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 #ifndef OST_SEQ_ALIGNMENT_HANDLE_HH
20 #define OST_SEQ_ALIGNMENT_HANDLE_HH
21 
22 /*
23  Author: Marco Biasini
24  */
25 #include <ost/seq/module_config.hh>
26 
29 #include <ost/seq/sequence_list.hh>
30 
31 namespace ost { namespace seq {
32 
33 class SequenceList;
34 class AlignedRegion;
35 class AlignedColumn;
36 class AlignedColumnIterator;
37 
54 public:
55 
58 
63  int GetPos(int seq_index, int residue_index) const;
64 
68  int GetResidueIndex(int seq_index, int pos) const;
69 
70  mol::ResidueView GetResidue(int seq_index, int pos) const;
71 
72  char GetOneLetterCode(int seq_index, int pos) const;
73 
78  void AddSequence(const ConstSequenceHandle& sequence);
79 
82  ConstSequenceHandle GetSequence(int seq_id) const;
83 
85  void RemoveSequence(int seq_index);
87  String ToString(int width=80) const;
88 
90  int GetLength() const;
91 
93  AlignmentHandle Copy() const;
94 
99  ConstSequenceHandle FindSequence(const String& name) const;
100 
103  void AttachView(int seq_index, const mol::EntityView& view);
104 
107  void AttachView(int seq_index, const mol::EntityView& view,
108  const String& chain_name);
109 
111  void SetSequenceName(int seq_index, const String& name);
112 
113  void SetSequenceOffset(int seq_index, int offset);
114  int GetSequenceOffset(int seq_index);
116  ConstSequenceList GetSequences() const;
117 
127  AlignedRegion MakeRegion(int start, int n, int master=-1) const;
128 
130  int GetCount() const;
131 
132  bool operator==(const AlignmentHandle& rhs) const;
133  bool operator!=(const AlignmentHandle& rhs) const;
134 
140  AlignedColumn operator[](int index) const;
141 
143 
145  void Cut(int start, int end);
146 
148  void Replace(const AlignedRegion& rhs, int start, int end);
153  void ShiftRegion(int start, int end, int amount, int master=-1);
154 
156  iterator begin() const;
158  iterator end() const;
159 
160  bool IsValid() const { return impl_.get()!=0; }
161 
167  Real GetCoverage(int seq_index) const;
168 
169 private:
170  void CheckValidity() const;
172 };
173 
174 AlignmentHandle DLLEXPORT_OST_SEQ CreateAlignment();
175 
182 AlignmentHandle DLLEXPORT_OST_SEQ
183 AlignmentFromSequenceList(const SequenceList& seq_list);
184 
185 typedef std::vector<AlignmentHandle> AlignmentList;
186 
187 }}
188 
189 #endif