OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
sequence_list_impl.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_SEQUENCE_LIST_IMPL_HH
20 #define OST_SEQ_SEQUENCE_LIST_IMPL_HH
21 
22 /*
23  Author: Marco Biasini
24  */
25 #include <vector>
26 #include <boost/shared_ptr.hpp>
29 
30 namespace ost { namespace seq { namespace impl {
31 
34 public:
38 
40  void AddSequence(const SequenceImplPtr& sequence);
42  int GetCount() const { return list_.size(); }
43 
45  unsigned int index = static_cast<unsigned int>(i);
46  if (index<list_.size()) {
47  return list_[index];
48  }
49  throw std::out_of_range("Index not covered SequenceList");
50  }
51 
52  const SequenceImplPtr& GetSequence(unsigned int i) const {
53  unsigned int index = static_cast<unsigned int>(i);
54  if (index<list_.size()) {
55  return list_[index];
56  }
57  throw std::out_of_range("Index not covered SequenceList");
58  }
59 
60 
61  void RemoveSequence(int index);
62  int GetPos(int seq_index, int residue_index) const;
63 
64  int GetResidueIndex(int seq_index, int pos) const;
65 
66  SequenceImplPtr FindSequence(const String& name) const;
67 
68  int FindSequenceIndex(const String& name) const;
69 
70  String ToString(int width=80) const;
71 
72  SequenceListImplPtr Slice(int first, int n) const;
73  int GetMinLength() const;
74 
75 
76  int GetMaxLength() const;
77 
79  {
80  return this->GetMaxLength()==this->GetMinLength();
81  }
82 
83  Real GetCoverage(int seq_index) const;
84 
85  SequenceListImplPtr Copy() const;
86 
87  Iterator Begin() { return list_.begin(); }
88  Iterator End() { return list_.end(); }
89  ConstIterator Begin() const { return list_.begin(); }
90  ConstIterator End() const { return list_.end(); }
91 
92 
93 private:
94  std::vector<SequenceImplPtr> list_;
95 };
96 
97 #if(OST_INFO_ENABLED)
101 SequenceListImplToInfo(const SequenceListImplPtr& seq_list,
102  info::InfoGroup& group);
103 
107 SequenceListImplFromInfo(info::InfoGroup& group);
108 #endif
109 
110 }}}
111 
112 #endif
#define DLLEXPORT_OST_SEQ
SequenceListImplVector::iterator SequenceImplListIterator
boost::shared_ptr< SequenceListImpl > SequenceListImplPtr
std::string String
Definition: base.hh:54
float Real
Definition: base.hh:44
SequenceImplListConstIterator ConstIterator
SequenceImplListIterator Iterator
SequenceImplPtr & GetSequence(int i)
boost::shared_ptr< SequenceImpl > SequenceImplPtr
int GetCount() const
get number of sequences in list
SequenceListImplVector::const_iterator SequenceImplListConstIterator
const SequenceImplPtr & GetSequence(unsigned int i) const