Pteros  2.0
Molecular modeling library for human beings!
mas.h
1 // Copyright Maarten L. Hekkelman, Radboud University 2008-2011.
2 // Distributed under the Boost Software License, Version 1.0.
3 // (See accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
5 
6 #pragma once
7 
8 #include <string>
9 
10 #if defined(_MSC_VER)
11 
12 #ifndef P_WIN
13 #define P_WIN 1
14 #endif
15 
16 // These are Microsoft Visual C++ special settings
17 // the iso646 file contains the C++ keywords that are
18 // otherwise not recognized.
19 #include <ciso646>
20 #define snprintf _snprintf
21 
22 // Disable some warnings
23 #pragma warning (disable : 4996)
24 #pragma warning (disable : 4355)
25 #endif
26 
27 #include <boost/version.hpp>
28 #include <boost/cstdint.hpp>
29 
30 typedef int8_t int8;
31 typedef uint8_t uint8;
32 typedef int16_t int16;
33 typedef uint16_t uint16;
34 typedef int32_t int32;
35 typedef uint32_t uint32;
36 typedef int64_t int64;
37 typedef uint64_t uint64;
38 
39 #ifndef nullptr
40 #define nullptr NULL
41 #endif
42 
43 // we even have globals:
44 extern int VERBOSE;
45 
46 // Code for amino acid sequences
47 
48 typedef std::basic_string<uint8> sequence;
49 
50 // 22 real letters and 1 dummy (X is the dummy, B and Z are pseudo letters)
51 extern const char kResidues[]; // = "ABCDEFGHIKLMNPQRSTVWYZX";
52 extern const uint8 kResidueNrTable[];
53 
54 inline uint8 ResidueNr(char inAA)
55 {
56  int result = 23;
57 
58  inAA |= 040;
59  if (inAA >= 'a' and inAA <= 'z')
60  result = kResidueNrTable[inAA - 'a'];
61 
62  return result;
63 }
64 
65 inline bool is_gap(char aa)
66 {
67  return aa == ' ' or aa == '.' or aa == '-';
68 }
69 
70 sequence encode(const std::string& s);
71 std::string decode(const sequence& s);