1 // Code for the -*- C++ -*- namespace Sequence::AlignStream<T>
5 Copyright (C) 2003-2009 Kevin Thornton, krthornt[]@[]uci.edu
7 Remove the brackets to email me.
9 This file is part of libsequence.
11 libsequence is free software: you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 libsequence is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 long with libsequence. If not, see <http://www.gnu.org/licenses/>.
26 /*! \file AlignStream.tcc
27 @brief implementation of AlignStream.hpp
30 #include <Sequence/AlignStream.hpp>
35 AlignStream<T>::AlignStream(const std::vector<T> & _data)
37 data.assign(_data.begin(),_data.end());
38 if(!this->IsAlignment())
39 throw std::runtime_error("Sequence::AlignStream: construction attempted from invalid data");
43 AlignStream<T>::AlignStream( std::vector<T> && _data) : data(std::move(_data))
45 if(!this->IsAlignment())
46 throw std::runtime_error("Sequence::AlignStream: construction attempted from invalid data");
50 AlignStream<T>::AlignStream(const AlignStream<T> &a) : data( a.data )
52 if(!this->IsAlignment())
53 throw std::runtime_error("Sequence::AlignStream: construction attempted from invalid data");
57 AlignStream<T>::AlignStream( AlignStream<T> && a) : data( std::move(a.data) )
59 if(!this->IsAlignment())
60 throw std::runtime_error("Sequence::AlignStream: construction attempted from invalid data");
64 AlignStream<T>::~AlignStream(void)
68 void AlignStream<T>::assign ( const_iterator beg,
75 if (! this->IsAlignment() )
76 throw (std::runtime_error("AlignStream::assign -- data elements have different lengths"));
80 void AlignStream<T>::assign( std::vector<T> && _data )
82 Implemented via std::swap
86 std::swap(data,_data);
90 typename AlignStream<T>::iterator AlignStream<T>::begin()
96 typename AlignStream<T>::iterator AlignStream<T>::end()
102 typename AlignStream<T>::const_iterator AlignStream<T>::begin() const
108 typename AlignStream<T>::const_iterator AlignStream<T>::end() const
113 template < typename T >
114 bool AlignStream < T >::IsAlignment (void)
116 Implemented by a call to Alignment::IsAlignment
119 return Alignment::IsAlignment (data);
122 template < typename T >
123 bool AlignStream < T >::Gapped (void)
125 Implemented by a call to Alignment::Gapped
128 return Alignment::Gapped (data);
131 template < typename T >
132 unsigned AlignStream < T >::UnGappedLength (void)
134 Implemented by a call to Alignment::UnGappedLength
137 return Alignment::UnGappedLength (data);
140 template < typename T >
141 void AlignStream < T >::RemoveGaps (void)
143 Implemented by a call to Alignment::RemoveGaps
146 Alignment::RemoveGaps (data);
149 template < typename T >
150 void AlignStream < T >::RemoveTerminalGaps (void)
152 Implemented by a call to Alignment::RemoveTerminalGaps
155 Alignment::RemoveTerminalGaps (data);
158 template < typename T >
159 std::vector < T >AlignStream < T >::Trim ( std::vector <int >sites)
163 Implemented by a call to Alignment::Trim
166 return Alignment::Trim (data, sites);
169 template < typename T >
170 std::vector < T > AlignStream < T >::TrimComplement
171 (std::vector <int>sites)
174 Implemented by a call to Alignment::TrimComplement
177 return Alignment::TrimComplement (data, sites);
180 template <typename T >
181 const std::vector < T> AlignStream< T >::Data(void)
183 Returns the std::vector < T* > data