libsequence  1.9.5
ComplementBase.cc
1 /*
2 
3 Copyright (C) 2003-2009 Kevin Thornton, krthornt[]@[]uci.edu
4 
5 Remove the brackets to email me.
6 
7 This file is part of libsequence.
8 
9 libsequence is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13 
14 libsequence is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 long with libsequence. If not, see <http://www.gnu.org/licenses/>.
21 
22 */
23 
25 #include <cctype>
26 
27 
28 namespace Sequence
29  {
30  void ComplementBase::operator()(char &ch) const
34  {
35  // char uch = std::toupper(ch);
36  switch(ch)
37  {
38  case 'A':
39  ch = 'T';
40  break;
41  case 'a':
42  ch = 't';
43  break;
44  case 'T':
45  ch = 'A';
46  break;
47  case 't':
48  ch = 'a';
49  break;
50  case 'G':
51  ch = 'C';
52  break;
53  case 'g':
54  ch = 'c';
55  break;
56  case 'C':
57  ch = 'G';
58  break;
59  case 'c':
60  ch = 'g';
61  break;
62  case 'M':
63  ch = 'K';
64  break;
65  case 'm':
66  ch ='k';
67  break;
68  case 'K':
69  ch = 'M';
70  break;
71  case 'k':
72  ch = 'm';
73  break;
74  case 'R':
75  ch = 'Y';
76  break;
77  case 'r':
78  ch = 'y';
79  break;
80  case 'Y':
81  ch = 'R';
82  break;
83  case 'y':
84  ch = 'r';
85  break;
86  case 'W':
87  ch = 'W';
88  break;
89  case 'w':
90  ch = 'w';
91  break;
92  case 'S':
93  ch = 'S';
94  break;
95  case 's':
96  ch = 's';
97  break;
98  case 'B':
99  ch = 'V';
100  break;
101  case 'b':
102  ch = 'v';
103  break;
104  case 'V':
105  ch = 'B';
106  break;
107  case 'v':
108  ch = 'b';
109  break;
110  case 'D':
111  ch = 'H';
112  break;
113  case 'd':
114  ch = 'h';
115  break;
116  case 'H':
117  ch = 'D';
118  break;
119  case 'h':
120  ch = 'd';
121  break;
122  case 'X':
123  ch = 'X';
124  break;
125  case 'x':
126  ch = 'x';
127  break;
128  case 'N':
129  ch = 'N';
130  break;
131  case 'n':
132  ch = 'n';
133  break;
134  case '-':
135  ch = '-';
136  break;
137  default:
138  ch = '?';
139  break;
140  }
141  }
142 }
143 
void operator()(char &ch) const
Delcaration of Sequence::ComplementBase, a function object to return the complement of a DNA nucleoti...
The namespace in which this library resides.