libStatGen Software
1
|
00001 /* 00002 * Copyright (C) 2010-2012 Regents of the University of Michigan 00003 * 00004 * This program is free software: you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation, either version 3 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00016 */ 00017 00018 #ifndef __BASE_UTILITIES_H__ 00019 #define __BASE_UTILITIES_H__ 00020 00021 #include <stdint.h> 00022 #include <string> 00023 00024 00025 /// This class contains static utilities for performing 00026 /// basic operations on bases. 00027 class BaseUtilities 00028 { 00029 public: 00030 /// Returns whether or not the specified bases is 00031 /// an indicator for ambiguity. 00032 /// \return true if base = 'n' or 'N' or '.' 00033 static bool isAmbiguous(char base); 00034 00035 /// Returns whether or not two bases are equal (case insensitive), 00036 /// if one of the bases is '=', the bases are consided 00037 /// to be equal. 00038 static bool areEqual(char base1, char base2); 00039 00040 /// Get phred base quality from the specified ascii quality. 00041 static uint8_t getPhredBaseQuality(char charQuality); 00042 00043 /// Get ascii quality from the specified phred quality. 00044 static char getAsciiQuality(uint8_t phredQuality); 00045 00046 static void reverseComplement(std::string& sequence); 00047 00048 /// Character used when the quality is unknown. 00049 static const char UNKNOWN_QUALITY_CHAR = ' '; 00050 /// Int value used when the quality is unknown. 00051 static const uint8_t UNKNOWN_QUALITY_INT = 0xFF; 00052 }; 00053 00054 00055 #endif