OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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-2020 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 
101  int FindSequenceIndex(const String& name) const;
102 
105  void AttachView(int seq_index, const mol::EntityView& view);
106 
109  void AttachView(int seq_index, const mol::EntityView& view,
110  const String& chain_name);
111 
112 
113  mol::EntityViewPair GetMatchingBackboneViews(int idx0=0, int idx1=1) const;
115  void SetSequenceName(int seq_index, const String& name);
116 
117  void SetSequenceOffset(int seq_index, int offset);
118  int GetSequenceOffset(int seq_index);
120  ConstSequenceList GetSequences() const;
121 
131  AlignedRegion MakeRegion(int start, int n, int master=-1) const;
132 
134  int GetCount() const;
135 
136  bool operator==(const AlignmentHandle& rhs) const;
137  bool operator!=(const AlignmentHandle& rhs) const;
138 
144  AlignedColumn operator[](int index) const;
145 
147 
149  void Cut(int start, int end);
150 
152  void Replace(const AlignedRegion& rhs, int start, int end);
157  void ShiftRegion(int start, int end, int amount, int master=-1);
158 
160  iterator begin() const;
162  iterator end() const;
163 
164  bool IsValid() const { return impl_.get()!=0; }
165 
171  Real GetCoverage(int seq_index) const;
172 
173 
174  const String& GetSequenceRole(int seq_index);
175 
176  void SetSequenceRole(int seq_index, const String& role);
177 private:
178  void CheckValidity() const;
180 };
181 
182 AlignmentHandle DLLEXPORT_OST_SEQ CreateAlignment();
183 
190 AlignmentHandle DLLEXPORT_OST_SEQ
191 AlignmentFromSequenceList(const SequenceList& seq_list);
192 
193 typedef std::vector<AlignmentHandle> AlignmentList;
194 
195 }}
196 
197 #endif
#define DLLEXPORT_OST_SEQ
boost::shared_ptr< SequenceListImpl > SequenceListImplPtr
std::string String
Definition: base.hh:54
float Real
Definition: base.hh:44
AlignmentHandle DLLEXPORT_OST_SEQ AlignmentFromSequenceList(const SequenceList &seq_list)
convert alignment from sequence list
pointer_it< T > end(const std::vector< T > &values)
bool DLLEXPORT_OST_GEOM operator==(const Line2 &l1, const Line2 &l2)
list of immutable sequences.
DLLEXPORT_OST_IMG_BASE bool operator!=(const ImageHandle &lhs, const ConstImageHandle &rhs)
represents a region in a sequence alignment
std::vector< AlignmentHandle > AlignmentList
std::vector< SequenceImplPtr > SequenceList
pointer_it< T > begin(const std::vector< T > &values)
Provides access to a column in a aligned region or a sequence alignment.
AlignedColumnIterator iterator
std::pair< EntityView, EntityView > EntityViewPair
Definition: entity_view.hh:349
AlignmentHandle DLLEXPORT_OST_SEQ CreateAlignment()
definition of EntityView
Definition: entity_view.hh:86
representation of a multiple sequence alignemnt consisting of two or more sequences ...