File: alpha.h

package info (click to toggle)
libmuscle 3.7%2B4565-7
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 1,912 kB
  • sloc: cpp: 27,959; makefile: 58; sh: 26
file content (111 lines) | stat: -rw-r--r-- 2,248 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#ifndef	alpha_h
#define	alpha_h

namespace muscle {

bool StrHasAmino(const char *Str);
bool StrHasGap(const char *Str);
void ClearInvalidLetterWarning();
void InvalidLetterWarning(char c, char w);
void ReportInvalidLetters();


// AX=Amino alphabet with eXtensions (B, Z and X)
enum AX
	{
	AX_A,
	AX_C,
	AX_D,
	AX_E,
	AX_F,
	AX_G,
	AX_H,
	AX_I,
	AX_K,
	AX_L,
	AX_M,
	AX_N,
	AX_P,
	AX_Q,
	AX_R,
	AX_S,
	AX_T,
	AX_V,
	AX_W,
	AX_Y,

	AX_X,	// Any

	AX_B,	// D or N
	AX_Z,	// E or Q

	AX_GAP,
	};
const unsigned AX_COUNT = AX_GAP + 1;

// NX=Nucleotide alphabet with extensions
enum NX
	{
	NX_A,
	NX_C,
	NX_G,
	NX_T,
	NX_U = NX_T,

    NX_M, // AC
    NX_R, // AG
    NX_W, // AT
    NX_S, // CG
    NX_Y, // CT
    NX_K, // GT
    NX_V, // ACG
    NX_H, // ACT
    NX_D, // AGT
    NX_B, // CGT
    NX_X, // GATC
    NX_N, // GATC
	NX_GAP
	};
const unsigned NX_COUNT = NX_GAP + 1;

const unsigned MAX_ALPHA = 20;
const unsigned MAX_ALPHA_EX = AX_COUNT;
const unsigned MAX_CHAR = 256;

extern TLS<ALPHA> g_Alpha;
extern TLS<unsigned> g_AlphaSize;

void SetAlpha(ALPHA Alpha);
char GetWildcardChar();
bool IsNucleo(char c);
bool IsDNA(char c);
bool IsRNA(char c);

extern TLS<unsigned[MAX_CHAR]> g_CharToLetter;
extern TLS<unsigned[MAX_CHAR]> g_CharToLetterEx;

extern TLS<char[MAX_ALPHA]> g_LetterToChar;
extern TLS<char[MAX_ALPHA_EX]> g_LetterExToChar;

extern TLS<char[MAX_CHAR]> g_UnalignChar;
extern TLS<char[MAX_CHAR]> g_AlignChar;

extern TLS<bool[MAX_CHAR]> g_IsWildcardChar;
extern TLS<bool[MAX_CHAR]> g_IsResidueChar;

#define CharToLetter(c)		(g_CharToLetter.get()[(unsigned char) (c)])
#define CharToLetterEx(c)	(g_CharToLetterEx.get()[(unsigned char) (c)])

#define LetterToChar(u)		(g_LetterToChar.get()[u])
#define LetterExToChar(u)	(g_LetterExToChar.get()[u])

#define IsResidueChar(c)	(g_IsResidueChar.get()[(unsigned char) (c)])
#define IsGapChar(c)		('-' == (c) || '.' == (c))
#define IsWildcardChar(c)	(g_IsWildcardChar.get()[(unsigned char) (c)])

#define AlignChar(c)		(g_AlignChar.get()[(unsigned char) (c)])
#define UnalignChar(c)		(g_UnalignChar.get()[(unsigned char) (c)])

} // namespace muscle

#endif	// alpha_h