00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef COMPARISONS_H
00025 #define COMPARISONS_H
00026
00037 #include <string>
00038 #include <algorithm>
00039 #include <boost/static_assert.hpp>
00040 #include <boost/type_traits.hpp>
00041 #include <Sequence/SeqExceptions.hpp>
00042 #include <Sequence/SeqEnums.hpp>
00043 namespace Sequence
00044 {
00045 Mutations TsTv(char i, char j);
00046 Mutations TsTv(int i, int j);
00047 bool Different (const std::string & seq1,
00048 const std::string & seq2,
00049 bool skip_missing =1 ,
00050 bool nucleic_acid = 1);
00051
00052 template<typename T> bool notDifferent(const T &l,const T &r,
00053 const bool & skip_missing = 1,
00054 const bool & nucleic_acid = 1)
00055 {
00056 BOOST_STATIC_ASSERT( (boost::is_convertible<T,std::string>::value) );
00057 return !Different(std::string(l),std::string(r),
00058 skip_missing,nucleic_acid);
00059 }
00060
00061 unsigned NumDiffs(const std::string & seq1,
00062 const std::string & seq2,
00063 bool skip_missing =1 ,
00064 bool nucleic_acid = 1);
00065
00066 bool Gapped(const std::string &s);
00067
00068 template<typename Iterator> bool Gapped(Iterator beg,Iterator end,
00069 const char &gapchar = '-')
00076 {
00077 Iterator itr = std::find(beg,end,gapchar);
00078 return (itr!=end);
00079 }
00080
00081 bool NotAGap(const char &c);
00082 }
00083 #endif