libStatGen Software 1
Loading...
Searching...
No Matches
BaseUtilities.h
1/*
2 * Copyright (C) 2010-2012 Regents of the University of Michigan
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef __BASE_UTILITIES_H__
19#define __BASE_UTILITIES_H__
20
21#include <stdint.h>
22#include <string>
23
24
25/// This class contains static utilities for performing
26/// basic operations on bases.
28{
29public:
30 /// Returns whether or not the specified bases is
31 /// an indicator for ambiguity.
32 /// \return true if base = 'n' or 'N' or '.'
33 static bool isAmbiguous(char base);
34
35 /// Returns whether or not two bases are equal (case insensitive),
36 /// if one of the bases is '=', the bases are consided
37 /// to be equal.
38 static bool areEqual(char base1, char base2);
39
40 /// Get phred base quality from the specified ascii quality.
41 static uint8_t getPhredBaseQuality(char charQuality);
42
43 /// Get ascii quality from the specified phred quality.
44 static char getAsciiQuality(uint8_t phredQuality);
45
46 static void reverseComplement(std::string& sequence);
47
48 /// Character used when the quality is unknown.
49 static const char UNKNOWN_QUALITY_CHAR = ' ';
50 /// Int value used when the quality is unknown.
51 static const uint8_t UNKNOWN_QUALITY_INT = 0xFF;
52};
53
54
55#endif
This class contains static utilities for performing basic operations on bases.
static bool isAmbiguous(char base)
Returns whether or not the specified bases is an indicator for ambiguity.
static const char UNKNOWN_QUALITY_CHAR
Character used when the quality is unknown.
static bool areEqual(char base1, char base2)
Returns whether or not two bases are equal (case insensitive), if one of the bases is '=',...
static char getAsciiQuality(uint8_t phredQuality)
Get ascii quality from the specified phred quality.
static const uint8_t UNKNOWN_QUALITY_INT
Int value used when the quality is unknown.
static uint8_t getPhredBaseQuality(char charQuality)
Get phred base quality from the specified ascii quality.