00001 /* 00002 00003 Copyright (C) 2003-2009 Kevin Thornton, krthornt[]@[]uci.edu 00004 00005 Remove the brackets to email me. 00006 00007 This file is part of libsequence. 00008 00009 libsequence is free software: you can redistribute it and/or modify 00010 it under the terms of the GNU General Public License as published by 00011 the Free Software Foundation, either version 3 of the License, or 00012 (at your option) any later version. 00013 00014 libsequence is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 GNU General Public License for more details. 00018 00019 You should have received a copy of the GNU General Public License 00020 long with libsequence. If not, see <http://www.gnu.org/licenses/>. 00021 00022 */ 00023 00024 // Code for the -*- C++ -*- namespace Sequence::AlignStream<T> 00025 00030 #include <Sequence/AlignStream.hpp> 00031 00032 namespace Sequence 00033 { 00034 template<typename T> 00035 AlignStream<T>::AlignStream(const std::vector<T> & _data) 00036 { 00037 data.assign(_data.begin(),_data.end()); 00038 } 00039 00040 template<typename T> 00041 AlignStream<T>::~AlignStream(void) 00042 {} 00043 00044 template<typename T> 00045 void AlignStream<T>::assign ( const_iterator beg, 00046 const_iterator end ) throw (Sequence::SeqException) 00050 { 00051 data.assign(beg,end); 00052 size_t len = beg->second.length(); 00053 for (typename AlignStream<T>::const_iterator itr = beg+1 ; 00054 itr != end ; 00055 ++itr) 00056 { 00057 if (itr->second.length() != len) 00058 { 00059 throw (SeqException("AlignStream::assign -- data elements have different lengths")); 00060 } 00061 } 00062 } 00063 00064 template<typename T> 00065 typename AlignStream<T>::iterator AlignStream<T>::begin() 00066 { 00067 return data.begin(); 00068 } 00069 00070 template<typename T> 00071 typename AlignStream<T>::iterator AlignStream<T>::end() 00072 { 00073 return data.end(); 00074 } 00075 00076 template<typename T> 00077 typename AlignStream<T>::const_iterator AlignStream<T>::begin() const 00078 { 00079 return data.begin(); 00080 } 00081 00082 template<typename T> 00083 typename AlignStream<T>::const_iterator AlignStream<T>::end() const 00084 { 00085 return data.end(); 00086 } 00087 00088 template < typename T > 00089 bool AlignStream < T >::IsAlignment (void) 00093 { 00094 return Alignment::IsAlignment (data); 00095 } 00096 00097 template < typename T > 00098 bool AlignStream < T >::Gapped (void) 00102 { 00103 return Alignment::Gapped (data); 00104 } 00105 00106 template < typename T > 00107 unsigned AlignStream < T >::UnGappedLength (void) 00111 { 00112 return Alignment::UnGappedLength (data); 00113 } 00114 00115 template < typename T > 00116 void AlignStream < T >::RemoveGaps (void) 00120 { 00121 Alignment::RemoveGaps (data); 00122 } 00123 00124 template < typename T > 00125 void AlignStream < T >::RemoveTerminalGaps (void) 00129 { 00130 Alignment::RemoveTerminalGaps (data); 00131 } 00132 00133 template < typename T > 00134 std::vector < T >AlignStream < T >::Trim ( std::vector <int >sites) 00135 throw (Sequence::SeqException) 00139 { 00140 return Alignment::Trim (data, sites); 00141 } 00142 00143 template < typename T > 00144 std::vector < T > AlignStream < T >::TrimComplement 00145 (std::vector <int>sites) throw (Sequence::SeqException) 00149 { 00150 return Alignment::TrimComplement (data, sites); 00151 } 00152 00153 template <typename T > 00154 const std::vector < T> AlignStream< T >::Data(void) 00158 { 00159 return data; 00160 } 00161 00162 } 00163
1.6.3