1 // ==========================================================================
2 //                 SeqAn - The Library for Sequence Analysis
3 // ==========================================================================
4 // Copyright (c) 2006-2018, Knut Reinert, FU Berlin
5 // All rights reserved.
6 //
7 // Redistribution and use in source and binary forms, with or without
8 // modification, are permitted provided that the following conditions are met:
9 //
10 //     * Redistributions of source code must retain the above copyright
11 //       notice, this list of conditions and the following disclaimer.
12 //     * Redistributions in binary form must reproduce the above copyright
13 //       notice, this list of conditions and the following disclaimer in the
14 //       documentation and/or other materials provided with the distribution.
15 //     * Neither the name of Knut Reinert or the FU Berlin nor the names of
16 //       its contributors may be used to endorse or promote products derived
17 //       from this software without specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 // ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE
23 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
29 // DAMAGE.
30 //
31 // ==========================================================================
32 // Author: Hannes Hauswedell <hannes.hauswedell@fu-berlin.de>
33 // ==========================================================================
34 // Reduced Versions of the 24-letter amino acid alphabet
35 // ==========================================================================
36 
37 #ifndef SEQAN_REDUCED_AMINOACID_BASE_LATE_H_
38 #define SEQAN_REDUCED_AMINOACID_BASE_LATE_H_
39 
40 namespace seqan {
41 
42 // ============================================================================
43 // Forwards
44 // ============================================================================
45 
46 // ============================================================================
47 // Tags, Classes, Enums
48 // ============================================================================
49 
50 // ============================================================================
51 // Metafunctions
52 // ============================================================================
53 
54 // ============================================================================
55 // Functions
56 // ============================================================================
57 
58 // -----------------------------------------------------------------------
59 // Function unknownValueImpl()
60 // -----------------------------------------------------------------------
61 
62 template <typename TRedSpec>
63 inline SimpleType<unsigned char, ReducedAminoAcid_<TRedSpec> >
unknownValueImpl(SimpleType<unsigned char,ReducedAminoAcid_<TRedSpec>> *)64 unknownValueImpl(SimpleType<unsigned char, ReducedAminoAcid_<TRedSpec> > *)
65 {
66     static const SimpleType<unsigned char, ReducedAminoAcid_<TRedSpec> >
67       _result = SimpleType<unsigned char, ReducedAminoAcid_<TRedSpec> >('X');
68     return _result;
69 }
70 
71 // -----------------------------------------------------------------------
72 // Function assign()
73 // -----------------------------------------------------------------------
74 
75 template <typename TRedSpec>
assign(char & c_target,SimpleType<unsigned char,ReducedAminoAcid_<TRedSpec>> const & source)76 inline void assign(char & c_target, SimpleType<unsigned char,
77                    ReducedAminoAcid_<TRedSpec> > const & source)
78 {
79     c_target = TranslateTableRedAAToChar_<TRedSpec>::VALUE[source.value];
80 }
81 
82 template <typename TRedSpec>
assign(SimpleType<unsigned char,ReducedAminoAcid_<TRedSpec>> & target,uint8_t c_source)83 inline void assign(SimpleType<unsigned char,
84                    ReducedAminoAcid_<TRedSpec> > & target,
85                    uint8_t c_source)
86 {
87     target.value = TranslateTableByteToRedAA_<TRedSpec>::VALUE[c_source];
88 }
89 
90 template <typename TRedSpec>
assign(SimpleType<unsigned char,ReducedAminoAcid_<TRedSpec>> & target,char c_source)91 inline void assign(SimpleType<unsigned char,
92                    ReducedAminoAcid_<TRedSpec> > & target,
93                    char c_source)
94 {
95     target.value = TranslateTableCharToRedAA_<TRedSpec>::VALUE[(unsigned char) c_source];
96 }
97 
98 template <typename TRedSpec>
assign(SimpleType<unsigned char,ReducedAminoAcid_<TRedSpec>> & target,AminoAcid c_source)99 inline void assign(SimpleType<unsigned char,
100                    ReducedAminoAcid_<TRedSpec> > & target,
101                    AminoAcid c_source)
102 {
103     target.value = TranslateTableAAToRedAA_<TRedSpec>::VALUE[c_source.value];
104 }
105 
106 }
107 #endif // def SEQAN_REDUCED_AMINOACID_BASE_LATE_H_
108