LocARNA-1.9.2
|
00001 #ifndef LOCARNA_PARAMS_HH 00002 #define LOCARNA_PARAMS_HH 00003 00004 #ifdef HAVE_CONFIG_H 00005 #include <config.h> 00006 #endif 00007 00008 #include "scoring_fwd.hh" 00009 00010 #include <vector> 00011 #include <string> 00012 00013 namespace LocARNA { 00014 00015 class Scoring; 00016 class Sequence; 00017 class ArcMatches; 00018 class AnchorConstraints; 00019 class TraceController; 00020 class SparsificationMapper; 00021 00028 class FreeEndgapsDescription { 00029 std::vector<bool> desc; 00030 00031 public: 00040 explicit 00041 FreeEndgapsDescription(const std::string &d) : desc(4) { 00042 if (d.length() >= 4) { 00043 for (size_t i = 0; i < 4; i++) 00044 desc[i] = (d[i] == '+'); 00045 } else { 00046 for (size_t i = 0; i < 4; i++) 00047 desc[i] = false; 00048 } 00049 } 00050 00055 bool 00056 allow_left_1() const { 00057 return desc[0]; 00058 } 00059 00064 bool 00065 allow_right_1() const { 00066 return desc[1]; 00067 } 00068 00073 bool 00074 allow_left_2() const { 00075 return desc[2]; 00076 } 00077 00082 bool 00083 allow_right_2() const { 00084 return desc[3]; 00085 } 00086 }; 00087 00101 class AlignerParams { 00102 friend class Aligner; 00103 friend class AlignerImpl; 00104 00105 protected: 00106 const Sequence *seqA_; 00107 00108 const Sequence *seqB_; 00109 00110 const ArcMatches *arc_matches_; 00111 00112 const Scoring *scoring_; 00113 00114 bool no_lonely_pairs_; 00115 00116 bool struct_local_; 00117 00118 00119 bool sequ_local_; 00120 00121 00122 std::string 00123 free_endgaps_; 00124 00125 bool DO_TRACE_; 00126 00127 const TraceController *trace_controller_; 00128 00129 00130 00131 int max_diff_am_; 00132 00133 int max_diff_at_am_; 00134 00135 00136 bool stacking_; 00137 00138 const AnchorConstraints *constraints_; 00139 00140 public: 00145 AlignerParams & 00146 seqA(const Sequence &seqA) { 00147 seqA_ = &seqA; 00148 return *this; 00149 } 00150 00155 AlignerParams & 00156 seqB(const Sequence &seqB) { 00157 seqB_ = &seqB; 00158 return *this; 00159 } 00160 00165 AlignerParams & 00166 arc_matches(const ArcMatches &arc_matches) { 00167 arc_matches_ = &arc_matches; 00168 return *this; 00169 } 00170 00175 AlignerParams & 00176 scoring(const Scoring &scoring) { 00177 scoring_ = &scoring; 00178 return *this; 00179 } 00180 00185 AlignerParams & 00186 no_lonely_pairs(bool no_lonely_pairs) { 00187 no_lonely_pairs_ = no_lonely_pairs; 00188 return *this; 00189 } 00190 00196 AlignerParams & 00197 struct_local(bool struct_local) { 00198 struct_local_ = struct_local; 00199 return *this; 00200 } 00201 00207 AlignerParams & 00208 sequ_local(bool sequ_local) { 00209 sequ_local_ = sequ_local; 00210 return *this; 00211 } 00212 00217 AlignerParams & 00218 free_endgaps(const std::string &free_endgaps) { 00219 free_endgaps_ = free_endgaps; 00220 return *this; 00221 } 00222 00227 AlignerParams & 00228 DO_TRACE(bool DO_TRACE) { 00229 DO_TRACE_ = DO_TRACE; 00230 return *this; 00231 } 00232 00238 AlignerParams & 00239 trace_controller(const TraceController &trace_controller) { 00240 trace_controller_ = &trace_controller; 00241 return *this; 00242 } 00243 00248 AlignerParams & 00249 max_diff_am(int max_diff_am) { 00250 max_diff_am_ = max_diff_am; 00251 return *this; 00252 } 00253 00258 AlignerParams & 00259 max_diff_at_am(int max_diff_at_am) { 00260 max_diff_at_am_ = max_diff_at_am; 00261 return *this; 00262 } 00263 00268 AlignerParams & 00269 stacking(bool stacking) { 00270 stacking_ = stacking; 00271 return *this; 00272 } 00273 00278 AlignerParams & 00279 constraints(const AnchorConstraints &constraints) { 00280 constraints_ = &constraints; 00281 return *this; 00282 } 00283 00284 protected: 00288 AlignerParams() 00289 : seqA_(0L), 00290 seqB_(0L), 00291 arc_matches_(0L), 00292 scoring_(0L), 00293 no_lonely_pairs_(false), 00294 struct_local_(false), 00295 sequ_local_(false), 00296 free_endgaps_(""), 00297 DO_TRACE_(true), 00298 trace_controller_(0L), 00299 max_diff_am_(-1), 00300 max_diff_at_am_(-1), 00301 stacking_(false), 00302 constraints_(0L) {} 00303 00304 public: 00305 virtual ~AlignerParams(); 00306 }; 00307 00311 class AlignerPParams : public AlignerParams { 00312 friend class AlignerP; 00313 00314 protected: 00315 double min_am_prob_; 00316 00317 double min_bm_prob_; 00318 00319 pf_score_t pf_scale_; 00320 00324 AlignerPParams() 00325 : AlignerParams(), 00326 min_am_prob_(0), 00327 min_bm_prob_(0), 00328 pf_scale_((pf_score_t)1) {} 00329 00330 public: 00335 AlignerPParams & 00336 min_am_prob(double min_am_prob) { 00337 min_am_prob_ = min_am_prob; 00338 return *this; 00339 } 00340 00345 AlignerPParams & 00346 min_bm_prob(double min_bm_prob) { 00347 min_bm_prob_ = min_bm_prob; 00348 return *this; 00349 } 00350 00355 AlignerPParams & 00356 pf_scale(pf_score_t pf_scale) { 00357 pf_scale_ = pf_scale; 00358 return *this; 00359 } 00360 00361 ~AlignerPParams() {} 00362 }; 00363 00367 class AlignerNParams : public AlignerParams { 00368 friend class AlignerN; 00369 00370 protected: 00371 const SparsificationMapper 00372 *sparsification_mapperA_; 00373 const SparsificationMapper 00374 *sparsification_mapperB_; 00375 00379 AlignerNParams() 00380 : AlignerParams(), 00381 sparsification_mapperA_(0L), 00382 sparsification_mapperB_(0L) {} 00383 00384 public: 00389 AlignerNParams & 00390 sparsification_mapperA( 00391 const SparsificationMapper &sparsification_mapperA) { 00392 sparsification_mapperA_ = &sparsification_mapperA; 00393 return *this; 00394 } 00395 00400 AlignerNParams & 00401 sparsification_mapperB( 00402 const SparsificationMapper &sparsification_mapperB) { 00403 sparsification_mapperB_ = &sparsification_mapperB; 00404 return *this; 00405 } 00406 00407 ~AlignerNParams() {} 00408 }; 00409 } 00410 00411 #endif // LOCARNA_PARAMS_HH