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: David Weese <david.weese@fu-berlin.de> 33 // Author: Manuel Holtgrewe <manuel.holtgrewe@fu-berlin.de> 34 // ========================================================================== 35 // Definitions for piggybacking qualities in free bits of bytes. 36 // ========================================================================== 37 38 #ifndef SEQAN_INCLUDE_SEQAN_BASIC_ALPHABET_QUALITIES_H_ 39 #define SEQAN_INCLUDE_SEQAN_BASIC_ALPHABET_QUALITIES_H_ 40 41 // TODO(holtgrew): Should the documentation be here? 42 43 namespace seqan { 44 45 // ============================================================================ 46 // Forwards 47 // ============================================================================ 48 49 // ============================================================================ 50 // Tags, Classes, Enums 51 // ============================================================================ 52 53 // ============================================================================ 54 // Metafunctions 55 // ============================================================================ 56 57 // ---------------------------------------------------------------------------- 58 // Metafunction QualityValueSize 59 // ---------------------------------------------------------------------------- 60 61 // TODO(holtgrew): Do we want a default specialization? Should it return 0? 62 template <typename TValue> 63 struct QualityValueSize 64 { 65 enum { VALUE = ValueSize<TValue>::VALUE }; 66 }; 67 68 template <typename TValue> 69 struct QualityValueSize<TValue const> : QualityValueSize<TValue> 70 {}; 71 72 // ---------------------------------------------------------------------------- 73 // Metafunction HasQualities 74 // ---------------------------------------------------------------------------- 75 76 template <typename TValue> 77 struct HasQualities 78 { 79 typedef False Type; 80 static const bool VALUE = false; 81 }; 82 83 // ============================================================================ 84 // Functions 85 // ============================================================================ 86 87 // ---------------------------------------------------------------------------- 88 // Function assignQualityValue() 89 // ---------------------------------------------------------------------------- 90 91 // Documentation is in alphabet_concept.h. 92 93 // ---------------------------------------------------------------------------- 94 // Function getQualityValue() 95 // ---------------------------------------------------------------------------- 96 97 // Documentation is in alphabet_concept.h. 98 99 // ---------------------------------------------------------------------------- 100 // Function convertQuality() 101 // ---------------------------------------------------------------------------- 102 103 // TODO(holtgrew): This could use some thought, what about other scales? 104 105 /*! 106 * @fn convertQuality 107 * @headerfile <seqan/basic.h> 108 * 109 * @brief Convert an integer quality value into its ASCII representation for FASTQ (Phred scale). 110 * 111 * @signature void convertQuality(c, q); 112 * 113 * @param[in] q Value of the quality to convert. The quality value is an integral value between 0 and 62 114 * (inclusive), <tt>int</tt>. 115 * @param[out] c Character to store the quality in, <tt>char</tt>. 116 * 117 * @see AlphabetWithQualitiesConcept#getQualityValue 118 * @see AlphabetWithQualitiesConcept#assignQualityValue 119 */ 120 121 inline 122 void convertQuality(char & c, int q) 123 { 124 c = '!' + char(q); 125 } 126 127 } // namespace seqan 128 129 #endif // #ifndef SEQAN_INCLUDE_SEQAN_BASIC_ALPHABET_QUALITIES_H_ 130