libuproc  1.2.0
codon.h
Go to the documentation of this file.
1 /* Copyright 2014 Peter Meinicke, Robin Martinjak
2  *
3  * This file is part of libuproc.
4  *
5  * libuproc is free software: you can redistribute it and/or modify it under
6  * the terms of the GNU Lesser General Public License as published by the Free
7  * Software Foundation, either version 3 of the License, or (at your option)
8  * any later version.
9  *
10  * libuproc is distributed in the hope that it will be useful, but WITHOUT ANY
11  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with libuproc. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
30 #ifndef UPROC_CODON_H
31 #define UPROC_CODON_H
32 
33 #include <stdbool.h>
34 
35 #include "uproc/common.h"
36 
47 typedef int uproc_nt;
48 
50 enum {
52  UPROC_NT_A = (1 << 0),
53 
55  UPROC_NT_C = (1 << 1),
56 
58  UPROC_NT_G = (1 << 2),
59 
61  UPROC_NT_T = (1 << 3),
62 
65 
68 
71 
74 };
75 
77 #define UPROC_NT_BITS 4
78 
83 typedef unsigned uproc_codon;
84 
86 #define UPROC_CODON_NTS 3
87 
89 #define UPROC_CODON_BITS (UPROC_CODON_NTS * UPROC_NT_BITS)
90 
92 #define UPROC_CODON_COUNT (4 * 4 * 4)
93 
95 #define UPROC_BINARY_CODON_COUNT (1 << UPROC_CODON_BITS)
96 
107 void uproc_codon_append(uproc_codon *codon, uproc_nt nt);
108 
119 void uproc_codon_prepend(uproc_codon *codon, uproc_nt nt);
120 
129 uproc_nt uproc_codon_get_nt(uproc_codon codon, unsigned position);
130 
146 bool uproc_codon_match(uproc_codon codon, uproc_codon mask);
147 
152 #endif
Adenine.
Definition: codon.h:52
Thymine.
Definition: codon.h:61
Cytosine.
Definition: codon.h:55
int uproc_nt
Type for nucleotides.
Definition: codon.h:47
Uracil (same value as T)
Definition: codon.h:64
void uproc_codon_prepend(uproc_codon *codon, uproc_nt nt)
Prepend nucleotide to codon.
Guanine.
Definition: codon.h:58
void uproc_codon_append(uproc_codon *codon, uproc_nt nt)
Append nucleotide to codon.
unsigned uproc_codon
Type used to represent a codon (or codon mask)
Definition: codon.h:83
Result of converting a non-alphabetic ([A-Za-z]) character.
Definition: codon.h:70
Wildcard matching any base.
Definition: codon.h:67
uproc_nt uproc_codon_get_nt(uproc_codon codon, unsigned position)
Retrieve a codon's nucleotide at a certain position.
Result of converting a non-IUPAC symbol.
Definition: codon.h:73
bool uproc_codon_match(uproc_codon codon, uproc_codon mask)
Match a codon against a "codon mask".
Module: Common definitions.