1 // ========================================================================== 2 // SeqAn - The Library for Sequence Analysis 3 // ========================================================================== 4 // Copyright (c) 2006-2015, 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: Rene Rahn <rene.rahn@fu-berlin.de> 33 // ========================================================================== 34 35 #ifndef INCLUDE_SEQAN_JOURNALED_SET_JOURNALED_SET_JOIN_CONFIG_H_ 36 #define INCLUDE_SEQAN_JOURNALED_SET_JOURNALED_SET_JOIN_CONFIG_H_ 37 38 namespace seqan { 39 40 // ============================================================================ 41 // Forwards 42 // ============================================================================ 43 44 // ============================================================================ 45 // Tags, Classes, Enums 46 // ============================================================================ 47 48 // ---------------------------------------------------------------------------- 49 // Class JoinConfig 50 // ---------------------------------------------------------------------------- 51 52 template <> 53 struct JoinConfig<GlobalAlign<JournaledManhatten> > {}; 54 55 template <> 56 struct JoinConfig<GlobalAlign<JournaledCompact> > 57 { 58 typedef Score<int, BiAffine> TScoringScheme; 59 TScoringScheme _score; 60 int _lowerDiagonal; 61 int _upperDiagonal; 62 bool _isBandSet; 63 AlignConfig<true, false, false, true> _alignConfig; 64 65 JoinConfig() : _score(0, -100000, 0, -12, -1, -25), 66 _lowerDiagonal(0), 67 _upperDiagonal(0), 68 _isBandSet(false), 69 _alignConfig() 70 {} 71 }; 72 73 74 // ============================================================================ 75 // Metafunctions 76 // ============================================================================ 77 78 // ============================================================================ 79 // Functions 80 // ============================================================================ 81 82 // ---------------------------------------------------------------------------- 83 // Function isBandSet() 84 // ---------------------------------------------------------------------------- 85 86 template <typename TSpec> 87 inline bool isBandSet(JoinConfig<TSpec> const & joinConfig) 88 { 89 return joinConfig._isBandSet; 90 } 91 92 // ---------------------------------------------------------------------------- 93 // Function lowerDiagonal() 94 // ---------------------------------------------------------------------------- 95 96 template <typename TSpec> 97 inline int lowerDiagonal(JoinConfig<TSpec> const & joinConfig) 98 { 99 return joinConfig._lowerDiagonal; 100 } 101 102 // ---------------------------------------------------------------------------- 103 // Function setLowerDiagonal() 104 // ---------------------------------------------------------------------------- 105 106 template <typename TSpec> 107 inline void setLowerDiagonal(JoinConfig<TSpec> & joinConfig, int lowerDiagonal) 108 { 109 joinConfig._isBandSet = true; 110 joinConfig._lowerDiagonal = lowerDiagonal; 111 } 112 113 // ---------------------------------------------------------------------------- 114 // Function setLowerDiagonal() 115 // ---------------------------------------------------------------------------- 116 117 template <typename TSpec> 118 inline int upperDiagonal(JoinConfig<TSpec> const & joinConfig) 119 { 120 return joinConfig._upperDiagonal; 121 } 122 123 // ---------------------------------------------------------------------------- 124 // Function setUpperDiagonal() 125 // ---------------------------------------------------------------------------- 126 127 template <typename TSpec> 128 inline void setUpperDiagonal(JoinConfig<TSpec> & joinConfig, int upperDiagonal) 129 { 130 joinConfig._isBandSet = true; 131 joinConfig._upperDiagonal = upperDiagonal; 132 } 133 134 135 inline Score<int, BiAffine> & 136 scoringScheme(JoinConfig<GlobalAlign<JournaledCompact> > & joinConfig) 137 { 138 return joinConfig._score; 139 } 140 141 inline Score<int, BiAffine> const & 142 scoringScheme(JoinConfig<GlobalAlign<JournaledCompact> > const & joinConfig) 143 { 144 return joinConfig._score; 145 } 146 147 // ---------------------------------------------------------------------------- 148 // Function setScoringScheme() 149 // ---------------------------------------------------------------------------- 150 151 inline void 152 setScoringScheme(JoinConfig<GlobalAlign<JournaledCompact> > & joinConfig, Score<int, BiAffine> const & scoringScheme) 153 { 154 joinConfig._score = scoringScheme; 155 setScoreMismatch(joinConfig._score, -100000); // Explicitly forbid mis matches in context with journaling. 156 } 157 158 } // namespace seqan 159 160 #endif // #ifndef INCLUDE_SEQAN_JOURNALED_SET_JOURNALED_SET_JOIN_CONFIG_H_ 161