00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef CGATOOLS_UTIL_BASEUTIL_HPP_
00016 #define CGATOOLS_UTIL_BASEUTIL_HPP_ 1
00017
00020
00021 #include "cgatools/core.hpp"
00022 #include <string>
00023
00024 namespace cgatools { namespace util { namespace baseutil {
00025
00027 extern char BASE_COMPATIBILITY[256];
00028 extern char BASE_COMPLEMENT[256];
00030
00032 bool isValidBase(char base);
00033
00035 bool isCalledSequence(const std::string& sequence);
00036
00038 bool isCalledSequence(const std::string& sequence, size_t start, size_t end);
00039
00042 bool isValidIupacCode(char iupacCode);
00043
00051 uint32_t pack(char base);
00052
00057 char unpack(uint32_t packedBase);
00058
00061 char disambiguate(char iupacCode);
00062
00067 inline bool isConsistent(char lhs, char rhs)
00068 {
00069 return 0 != ( BASE_COMPATIBILITY[uint8_t(lhs)] &
00070 BASE_COMPATIBILITY[uint8_t(rhs)] );
00071 }
00072
00077 bool isConsistent(const std::string& lhs, const std::string& rhs);
00078
00083 bool isConsistent(const std::string& lhs, size_t lhsStart, size_t lhsEnd,
00084 const std::string& rhs, size_t rhsStart, size_t rhsEnd);
00085
00095 char complement(char iupacCode);
00096
00099 std::string reverseComplement(const std::string& sequence);
00100
00101 } } }
00102
00103 #endif // CGATOOLS_UTIL_BASEUTIL_