LocARNA-1.8.11
params.hh
1 #ifndef LOCARNA_PARAMS_HH
2 #define LOCARNA_PARAMS_HH
3 
4 #ifdef HAVE_CONFIG_H
5 # include <config.h>
6 #endif
7 
8 #include "scoring_fwd.hh"
9 
10 #include <vector>
11 #include <string>
12 
13 namespace LocARNA {
14 
15  class Scoring;
16  class Sequence;
17  class ArcMatches;
18  class AnchorConstraints;
19  class TraceController;
20  class SparsificationMapper;
21 
29  std::vector<bool> desc;
30  public:
31 
39  explicit
40  FreeEndgapsDescription(const std::string &d)
41  : desc(4)
42  {
43  if (d.length()>=4) {
44  for (size_t i=0; i<4; i++) desc[i] = (d[i]=='+');
45  } else {
46  for (size_t i=0; i<4; i++) desc[i] = false;
47  }
48  }
49 
54  bool
55  allow_left_1() const {
56  return desc[0];
57  }
58 
63  bool
64  allow_right_1() const {
65  return desc[1];
66  }
67 
72  bool
73  allow_left_2() const {
74  return desc[2];
75  }
76 
81  bool
82  allow_right_2() const {
83  return desc[3];
84  }
85  };
86 
87 
101  class AlignerParams {
102  friend class Aligner;
103  friend class AlignerImpl;
104  protected:
105 
106  const Sequence *seqA_;
107 
108  const Sequence *seqB_;
109 
111 
112  const Scoring *scoring_;
113 
115 
117 
118  bool sequ_local_;
119 
120  std::string free_endgaps_;
121 
122  bool DO_TRACE_;
123 
125 
127 
129 
130  double min_am_prob_;
131 
132  double min_bm_prob_;
133 
134  bool stacking_;
135 
137 
138 
139  public:
140 
145  AlignerParams &
146  seqA(const Sequence &seqA) {seqA_=&seqA; return *this;}
147 
152  AlignerParams &
153  seqB(const Sequence &seqB) {seqB_=&seqB; return *this;}
154 
159  AlignerParams &
160  arc_matches(const ArcMatches &arc_matches) {arc_matches_=&arc_matches; return *this;}
161 
166  AlignerParams &
167  scoring(const Scoring &scoring) {scoring_=&scoring; return *this;}
168 
173  AlignerParams &
174  no_lonely_pairs(bool no_lonely_pairs) {no_lonely_pairs_=no_lonely_pairs; return *this;}
175 
180  AlignerParams &
181  struct_local(bool struct_local) {struct_local_=struct_local; return *this;}
182 
187  AlignerParams &
188  sequ_local(bool sequ_local) {sequ_local_=sequ_local; return *this;}
189 
194  AlignerParams &
195  free_endgaps(const std::string &free_endgaps) {
196  free_endgaps_=free_endgaps; return *this;}
197 
202  AlignerParams &
203  DO_TRACE(bool DO_TRACE) {DO_TRACE_=DO_TRACE; return *this;}
204 
209  AlignerParams &
210  trace_controller(const TraceController &trace_controller) {
211  trace_controller_=&trace_controller;
212  return *this;}
213 
218  AlignerParams &
219  max_diff_am(int max_diff_am) {max_diff_am_=max_diff_am; return *this;}
220 
225  AlignerParams &
226  max_diff_at_am(int max_diff_at_am) {max_diff_at_am_=max_diff_at_am; return *this;}
227 
232  AlignerParams &
233  min_am_prob(double min_am_prob) {min_am_prob_=min_am_prob; return *this;}
234 
239  AlignerParams &
240  min_bm_prob(double min_bm_prob) {min_bm_prob_=min_bm_prob; return *this;}
241 
246  AlignerParams &
247  stacking(bool stacking) {stacking_=stacking; return *this;}
248 
253  AlignerParams &
254  constraints(const AnchorConstraints &constraints) {
255  constraints_=&constraints; return *this;}
256 
257 
258  protected:
263  seqA_(0L),
264  seqB_(0L),
265  arc_matches_(0L),
266  scoring_(0L),
267  no_lonely_pairs_(false),
268  struct_local_(false),
269  sequ_local_(false),
270  free_endgaps_(""),
271  DO_TRACE_(true),
272  trace_controller_(0L),
273  max_diff_am_(-1),
274  max_diff_at_am_(-1),
275  min_am_prob_(0),
276  min_bm_prob_(0),
277  stacking_(false),
278  constraints_(0L)
279  {}
280 
281  public:
282  virtual
283  ~AlignerParams();
284  };
285 
286 
290  class AlignerPParams: public AlignerParams {
291  friend class AlignerP;
292 
293  protected:
295 
300  : AlignerParams(),
301  pf_scale_((pf_score_t)1)
302  {}
303 
304  public:
310  pf_scale(pf_score_t pf_scale) {pf_scale_=pf_scale; return *this;}
311 
312  ~AlignerPParams() {}
313 
314  };
315 
319  class AlignerNParams: public AlignerParams {
320  friend class AlignerN;
321 
322  protected:
325 
330  AlignerParams(),
331  sparsification_mapperA_(0L),
332  sparsification_mapperB_(0L)
333  {}
334 
335  public:
341  sparsification_mapperA(const SparsificationMapper &sparsification_mapperA) {
342  sparsification_mapperA_=&sparsification_mapperA; return *this;}
343 
349  sparsification_mapperB(const SparsificationMapper &sparsification_mapperB) {
350  sparsification_mapperB_=&sparsification_mapperB; return *this;}
351 
352  ~AlignerNParams() {}
353  };
354 
355 
356 }
357 
358 #endif // LOCARNA_PARAMS_HH
AlignerPParams & pf_scale(pf_score_t pf_scale)
set parameter pf_scale
Definition: params.hh:310
AlignerParams & min_am_prob(double min_am_prob)
set parameter min_am_prob
Definition: params.hh:233
Represents anchor constraints between two sequences.
Definition: anchor_constraints.hh:26
bool allow_right_2() const
Definition: params.hh:82
AlignerParams & struct_local(bool struct_local)
set parameter struct_local
Definition: params.hh:181
Implements locarna alignment algorithm.
Definition: aligner.hh:67
Computes partition function of alignment, arc match and base match probabilities. ...
Definition: aligner_p.hh:52
bool allow_left_1() const
Definition: params.hh:55
bool stacking_
whether to use stacking
Definition: params.hh:134
AlignerNParams & sparsification_mapperA(const SparsificationMapper &sparsification_mapperA)
set parameter sparsification mapper
Definition: params.hh:341
bool allow_left_2() const
Definition: params.hh:73
Description of free end gaps.
Definition: params.hh:28
AlignerParams & arc_matches(const ArcMatches &arc_matches)
set parameter arc matches
Definition: params.hh:160
AlignerParams & no_lonely_pairs(bool no_lonely_pairs)
set parameter no_lonely_pairs
Definition: params.hh:174
AlignerParams & trace_controller(const TraceController &trace_controller)
set parameter trace_controller
Definition: params.hh:210
AlignerParams()
Definition: params.hh:262
AlignerParams & sequ_local(bool sequ_local)
set parameter sequ_local
Definition: params.hh:188
parameters for AlignerN
Definition: params.hh:319
const TraceController * trace_controller_
trace controller controlling allowed trace cells
Definition: params.hh:124
const SparsificationMapper * sparsification_mapperB_
sparsification mapper B
Definition: params.hh:324
bool struct_local_
allow exclusions for maximizing alignment of connected substructures
Definition: params.hh:116
Maintains the relevant arc matches and their scores.
Definition: arc_matches.hh:112
const Sequence * seqA_
sequence A
Definition: params.hh:106
const Scoring * scoring_
scoring object
Definition: params.hh:112
Definition: aligner.cc:17
AlignerParams & max_diff_at_am(int max_diff_at_am)
set parameter max_diff_at_am
Definition: params.hh:226
AlignerNParams()
Definition: params.hh:329
Implementation of Aligner.
Definition: aligner_impl.hh:24
std::string free_endgaps_
description of potentially allowed free end gaps
Definition: params.hh:120
AlignerParams & constraints(const AnchorConstraints &constraints)
set parameter constraints
Definition: params.hh:254
AlignerParams & stacking(bool stacking)
set parameter stacking
Definition: params.hh:247
int max_diff_am_
maximal difference of arc lengths in arc match
Definition: params.hh:126
AlignerParams & seqB(const Sequence &seqB)
set parameter seqeunce A
Definition: params.hh:153
double pf_score_t
type of partition functions
Definition: scoring_fwd.hh:26
bool allow_right_1() const
Definition: params.hh:64
AlignerParams & scoring(const Scoring &scoring)
set parameter scoring
Definition: params.hh:167
Represents the mapping for sparsification.
Definition: sparsification_mapper.hh:34
AlignerParams & free_endgaps(const std::string &free_endgaps)
set parameter free_endgaps
Definition: params.hh:195
double min_bm_prob_
minimal probability of a base match
Definition: params.hh:132
AlignerNParams & sparsification_mapperB(const SparsificationMapper &sparsification_mapperB)
set parameter sparsification mapper
Definition: params.hh:349
AlignerPParams()
Definition: params.hh:299
const SparsificationMapper * sparsification_mapperA_
sparsification mapper A
Definition: params.hh:323
FreeEndgapsDescription(const std::string &d)
Construct from string description.
Definition: params.hh:40
bool DO_TRACE_
whether do perfom trace back
Definition: params.hh:122
Implements SPARSE, next generation alignment algorithm for locarna.
Definition: aligner_n.hh:37
Parameter for alignment by Aligner.
Definition: params.hh:101
bool no_lonely_pairs_
no lonely pairs option
Definition: params.hh:114
const bool DO_TRACE
Switch on/off trace back.
Definition: locarna.cc:56
const Sequence * seqB_
sequence B
Definition: params.hh:108
parameters for AlignerP
Definition: params.hh:290
int max_diff_at_am_
maximal difference of positions at ends of an arc match
Definition: params.hh:128
pf_score_t pf_scale_
scaling factor for partition function
Definition: params.hh:294
const AnchorConstraints * constraints_
anchor constraints
Definition: params.hh:136
AlignerParams & min_bm_prob(double min_bm_prob)
set parameter min_bm_prob
Definition: params.hh:240
const ArcMatches * arc_matches_
arc matches
Definition: params.hh:110
AlignerParams & max_diff_am(int max_diff_am)
set parameter max_diff_am
Definition: params.hh:219
bool sequ_local_
sequence local alignment / maximize alignment of subsequences
Definition: params.hh:118
Controls the matrix cells valid for traces.
Definition: trace_controller.hh:177
Provides methods for the scoring of alignments.
Definition: scoring.hh:285
double min_am_prob_
minimal probability of an arc match
Definition: params.hh:130
"Sequence View" of multiple alignment as array of column vectors
Definition: sequence.hh:29
AlignerParams & DO_TRACE(bool DO_TRACE)
set parameter DO_TRACE
Definition: params.hh:203
AlignerParams & seqA(const Sequence &seqA)
set parameter seqeunce A
Definition: params.hh:146