1 | /* |
---|
2 | Copyright (c) 2006-2018 Elmar Pruesse <elmar.pruesse@ucdenver.edu> |
---|
3 | |
---|
4 | This file is part of SINA. |
---|
5 | SINA is free software: you can redistribute it and/or modify it under |
---|
6 | the terms of the GNU General Public License as published by the Free |
---|
7 | Software Foundation, either version 3 of the License, or (at your |
---|
8 | option) any later version. |
---|
9 | |
---|
10 | SINA is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
11 | WARRANTY; without even the implied warranty of MERCHANTABILITY or |
---|
12 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
---|
13 | for more details. |
---|
14 | |
---|
15 | You should have received a copy of the GNU General Public License |
---|
16 | along with SINA. If not, see <http://www.gnu.org/licenses/>. |
---|
17 | |
---|
18 | Additional permission under GNU GPL version 3 section 7 |
---|
19 | |
---|
20 | If you modify SINA, or any covered work, by linking or combining it |
---|
21 | with components of ARB (or a modified version of that software), |
---|
22 | containing parts covered by the terms of the |
---|
23 | ARB-public-library-license, the licensors of SINA grant you additional |
---|
24 | permission to convey the resulting work. Corresponding Source for a |
---|
25 | non-source form of such a combination shall include the source code |
---|
26 | for the parts of ARB used as well as that of the covered work. |
---|
27 | */ |
---|
28 | |
---|
29 | #include "aligned_base.h" |
---|
30 | #include <sstream> |
---|
31 | |
---|
32 | #ifndef TEST |
---|
33 | |
---|
34 | using namespace sina; |
---|
35 | |
---|
36 | std::ostream& |
---|
37 | operator<<(std::ostream& out, aligned_base ab) |
---|
38 | { |
---|
39 | std::stringstream tmp; |
---|
40 | tmp << ab.getBase() << "(" << ab.getPosition() << ")"; |
---|
41 | return out << tmp.str(); |
---|
42 | } |
---|
43 | |
---|
44 | |
---|
45 | /* === IUPAC == |
---|
46 | * |
---|
47 | * A = adenine |
---|
48 | * C = cytosine |
---|
49 | * G = guanine |
---|
50 | * T= thymine |
---|
51 | * U = uracil |
---|
52 | * R = G A (purine) |
---|
53 | * Y = T C (pyrimidine) |
---|
54 | * K = G T (keto) |
---|
55 | * M = A C (amino) |
---|
56 | * S = G C |
---|
57 | * W = A T |
---|
58 | * B = G T C |
---|
59 | * D = G A T |
---|
60 | * H = A C T |
---|
61 | * V = G C A |
---|
62 | * N = A G C T (any) |
---|
63 | * |
---|
64 | * Complements: |
---|
65 | * http://www.animalgenome.org/edu/gene/genetic-code.html |
---|
66 | * |
---|
67 | * |
---|
68 | */ |
---|
69 | |
---|
70 | const base_iupac::value_type |
---|
71 | base_iupac::iupac_char_to_bmask[] = { |
---|
72 | 0, 0, 0, 0, 0, 0, 0, 0, |
---|
73 | 0, 0, 0, 0, 0, 0, 0, 0, |
---|
74 | 0, 0, 0, 0, 0, 0, 0, 0, |
---|
75 | 0, 0, 0, 0, 0, 0, 0, 0, |
---|
76 | 0, 0, 0, 0, 0, 0, 0, 0, |
---|
77 | 0, 0, 0, 0, 0, 0, 0, 0, |
---|
78 | 0, 0, 0, 0, 0, 0, 0, 0, // 0-7 |
---|
79 | 0, 0, 0, 0, 0, 0, 0, 0, // 8-? |
---|
80 | |
---|
81 | 0, BASEM_A, BASEM_G|BASEM_TU|BASEM_C, BASEM_C, BASEM_G|BASEM_A|BASEM_TU, 0, 0, BASEM_G, // @-G |
---|
82 | BASEM_A|BASEM_C|BASEM_TU, 0, 0, BASEM_G|BASEM_TU, 0, BASEM_A|BASEM_C, BASEM_A|BASEM_G|BASEM_C|BASEM_TU, 0, // H-O |
---|
83 | 0, 0, BASEM_G|BASEM_A, BASEM_G|BASEM_C, BASEM_TU, BASEM_TU, BASEM_G|BASEM_C|BASEM_A, BASEM_A|BASEM_TU, // P-W |
---|
84 | 0, BASEM_TU|BASEM_C, 0, 0, 0, 0, 0, 0, // X-_ |
---|
85 | 0, BASEM_LC|BASEM_A, BASEM_LC|BASEM_G|BASEM_TU|BASEM_C, BASEM_LC|BASEM_C, BASEM_LC|BASEM_G|BASEM_A|BASEM_TU, 0, 0, BASEM_LC|BASEM_G, // `-g |
---|
86 | BASEM_LC|BASEM_A|BASEM_C|BASEM_TU, 0, 0, BASEM_LC|BASEM_G|BASEM_TU, 0, BASEM_LC|BASEM_A|BASEM_C, BASEM_LC|BASEM_A|BASEM_G|BASEM_C|BASEM_TU, 0, // h-o |
---|
87 | 0, 0, BASEM_LC|BASEM_G|BASEM_A, BASEM_LC|BASEM_G|BASEM_C, BASEM_LC|BASEM_TU, BASEM_LC|BASEM_TU, BASEM_LC|BASEM_G|BASEM_C|BASEM_A, BASEM_LC|BASEM_A|BASEM_TU, // p-w |
---|
88 | 0, BASEM_LC|BASEM_TU|BASEM_C, 0, 0, 0, 0, 0, 0, // x- |
---|
89 | |
---|
90 | 0, 0, 0, 0, 0, 0, 0, 0, |
---|
91 | 0, 0, 0, 0, 0, 0, 0, 0, |
---|
92 | 0, 0, 0, 0, 0, 0, 0, 0, |
---|
93 | 0, 0, 0, 0, 0, 0, 0, 0, |
---|
94 | 0, 0, 0, 0, 0, 0, 0, 0, |
---|
95 | 0, 0, 0, 0, 0, 0, 0, 0, |
---|
96 | 0, 0, 0, 0, 0, 0, 0, 0, |
---|
97 | 0, 0, 0, 0, 0, 0, 0, 0, |
---|
98 | |
---|
99 | 0, 0, 0, 0, 0, 0, 0, 0, |
---|
100 | 0, 0, 0, 0, 0, 0, 0, 0, |
---|
101 | 0, 0, 0, 0, 0, 0, 0, 0, |
---|
102 | 0, 0, 0, 0, 0, 0, 0, 0, |
---|
103 | 0, 0, 0, 0, 0, 0, 0, 0, |
---|
104 | 0, 0, 0, 0, 0, 0, 0, 0, |
---|
105 | 0, 0, 0, 0, 0, 0, 0, 0, |
---|
106 | 0, 0, 0, 0, 0, 0, 0, 0 |
---|
107 | }; |
---|
108 | |
---|
109 | const unsigned char |
---|
110 | base_iupac::bmask_to_iupac_rna_char[] = { |
---|
111 | //0 1 10 11 100 101 110 111 1000 1001 1010 1011 1100 1101 1110 1111 |
---|
112 | '.', 'A', 'G', 'R', 'C', 'M', 'S', 'V', 'U', 'W', 'K', 'D', 'Y', 'H', 'B', 'N', |
---|
113 | '.', 'a', 'g', 'r', 'c', 'm', 's', 'v', 'u', 'w', 'k', 'd', 'y', 'h', 'b', 'n' |
---|
114 | }; |
---|
115 | |
---|
116 | const unsigned char |
---|
117 | base_iupac::bmask_to_iupac_dna_char[] = { |
---|
118 | //0 1 10 11 100 101 110 111 1000 1001 1010 1011 1100 1101 1110 1111 |
---|
119 | '.', 'A', 'G', 'R', 'C', 'M', 'S', 'V', 'T', 'W', 'K', 'D', 'Y', 'H', 'B', 'N', |
---|
120 | '.', 'a', 'g', 'r', 'c', 'm', 's', 'v', 't', 'w', 'k', 'd', 'y', 'h', 'b', 'n' |
---|
121 | }; |
---|
122 | |
---|
123 | const float |
---|
124 | base_iupac::base_pairings[] = { |
---|
125 | // . A G R C M S V U W K D Y H B N |
---|
126 | 0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f, // . |
---|
127 | 0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,1.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f, // A |
---|
128 | 0.f,0.f,0.f,0.f,1.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f, // G |
---|
129 | 0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f, // R |
---|
130 | 0.f,0.f,1.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f, // C |
---|
131 | 0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f, // M |
---|
132 | 0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f, // S |
---|
133 | 0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f, // V |
---|
134 | 0.f,1.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f, // U |
---|
135 | 0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f, // W |
---|
136 | 0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f, // K |
---|
137 | 0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f, // D |
---|
138 | 0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f, // Y |
---|
139 | 0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f, // H |
---|
140 | 0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f, // B |
---|
141 | }; |
---|
142 | |
---|
143 | #else // TEST |
---|
144 | |
---|
145 | int main(int, char**) { |
---|
146 | return 0; |
---|
147 | } |
---|
148 | |
---|
149 | #endif // TEST |
---|
150 | |
---|
151 | |
---|
152 | /* |
---|
153 | Local Variables: |
---|
154 | mode:c++ |
---|
155 | c-file-style:"stroustrup" |
---|
156 | c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) |
---|
157 | indent-tabs-mode:nil |
---|
158 | fill-column:99 |
---|
159 | End: |
---|
160 | */ |
---|
161 | // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : |
---|
162 | |
---|