IntaRNA 3.4.1
RNA-RNA interaction prediction | C++ API
Loading...
Searching...
No Matches
SeedConstraint.h
Go to the documentation of this file.
1
2#ifndef INTARNA_SEEDCONSTRAINT_H_
3#define INTARNA_SEEDCONSTRAINT_H_
4
5
6#include "IntaRNA/general.h"
8
9#include <cstddef>
10#include <iostream>
11
12namespace IntaRNA {
13
21
22public:
23
44 SeedConstraint( const size_t bp
45 , const size_t maxUnpairedOverall
46 , const size_t maxUnpaired1
47 , const size_t maxUnpaired2
48 , const E_type maxE
49 , const E_type maxED
50 , const E_type maxEhybrid
51 , const IndexRangeList & ranges1
52 , const IndexRangeList & ranges2reversed
53 , const std::string & explicitSeeds
54 , const bool noGUallowed
55 , const bool noGUendAllowed
56 , const bool noLP
57 );
58
59 virtual ~SeedConstraint();
60
61
67 size_t
68 getBasePairs() const;
69
76 size_t
78
86 size_t
87 getMaxUnpaired1() const;
88
96 size_t
97 getMaxUnpaired2() const;
98
104 E_type
105 getMaxE() const;
106
113 E_type
114 getMaxED() const;
115
122 E_type
123 getMaxEhybrid() const;
124
129 size_t
130 getMaxLength1() const;
131
136 size_t
137 getMaxLength2() const;
138
143 bool
144 isGUallowed() const;
145
150 bool
151 isGUendAllowed() const;
152
157 bool
158 isLpAllowed() const;
159
165 const IndexRangeList &
166 getRanges1() const;
167
173 const IndexRangeList &
174 getRanges2() const;
175
180 const std::string &
181 getExplicitSeeds() const;
182
189 getRanges1();
190
197 getRanges2();
198
203 std::string &
205
212 friend std::ostream& operator<<(std::ostream& out, const SeedConstraint& c);
213
214protected:
215
217 size_t bp;
218
221
224
227
230
233
236
239
242
244 std::string explicitSeeds;
245
248
251
254
255};
256
257
261
262inline
264 const size_t bp_
265 , const size_t maxUnpairedOverall_
266 , const size_t maxUnpaired1_
267 , const size_t maxUnpaired2_
268 , const E_type maxE_
269 , const E_type maxED_
270 , const E_type maxEhybrid
271 , const IndexRangeList & ranges1
272 , const IndexRangeList & ranges2reversed
273 , const std::string & explicitSeeds
274 , const bool noGUallowed
275 , const bool noGUendAllowed
276 , const bool noLP
277 )
278 :
279 bp(bp_)
280 , maxUnpairedOverall(maxUnpairedOverall_)
281 , maxUnpaired1(std::min(maxUnpaired1_,maxUnpairedOverall_)) // exclude too large boundaries
282 , maxUnpaired2(std::min(maxUnpaired2_,maxUnpairedOverall_)) // exclude too large boundaries
283 , maxE(maxE_)
284 , maxED(maxED_)
285 , maxEhybrid(maxEhybrid)
286 , ranges1(ranges1)
287 , ranges2(ranges2reversed)
288 , explicitSeeds(explicitSeeds)
289 , bpGUallowed(!noGUallowed)
290 , bpGUendAllowed(!noGUendAllowed)
291 , lpAllowed(!noLP)
292{
293 if (bp < 2 && explicitSeeds.empty()) throw std::runtime_error("SeedConstraint() : base pair number ("+toString(bp)+") < 2");
294}
295
297
298inline
301
303
304inline
305size_t
307getBasePairs() const {
308 return bp;
309}
310
312
313inline
314E_type
316getMaxE() const {
317 return maxE;
318}
319
321
322inline
323E_type
325getMaxED() const {
326 return maxED;
327}
328
330
331inline
332E_type
334getMaxEhybrid() const {
335 return maxEhybrid;
336}
337
339
340inline
341size_t
343getMaxUnpaired1() const {
344 return maxUnpaired1;
345}
346
348
349inline
350size_t
352getMaxUnpaired2() const {
353 return maxUnpaired2;
354}
355
357
358inline
359size_t
364
366
367inline
368size_t
370getMaxLength1() const {
371 return getBasePairs() + getMaxUnpaired1();
372}
373
375
376inline
377size_t
379getMaxLength2() const {
380 return getBasePairs() + getMaxUnpaired2();
381}
382
384
385inline
386const IndexRangeList &
388getRanges1() const {
389 return ranges1;
390}
391
393
394inline
395const IndexRangeList &
397getRanges2() const {
398 return ranges2;
399}
400
402
403inline
406getRanges1() {
407 return ranges1;
408}
409
411
412inline
415getRanges2() {
416 return ranges2;
417}
418
420
421inline
422const std::string &
424getExplicitSeeds() const {
425 return explicitSeeds;
426}
427
429
430inline
431std::string &
436
438
439inline
440bool
442isGUallowed() const {
443 return bpGUallowed;
444}
445
447
448inline
449bool
451isGUendAllowed() const {
452 return bpGUendAllowed;
453}
454
456
457inline
458bool
460isLpAllowed() const {
461 return lpAllowed;
462}
463
465
466inline
467std::ostream&
468operator<<(std::ostream& out, const SeedConstraint& c)
469{
470 out <<"SeedConstraint( bp="<<c.getBasePairs()
471 <<", up="<<c.getMaxUnpairedOverall()
472 <<", up1="<<c.getMaxUnpaired1()
473 <<", up2="<<c.getMaxUnpaired2()
474 <<", E="<<E_2_Ekcal(c.getMaxE())
475 <<", ED="<<E_2_Ekcal(c.getMaxED())
476 <<", Ehybrid="<<E_2_Ekcal(c.getMaxEhybrid())
477 <<", noGU="<<(c.isGUallowed() ? "false":"true")
478 <<", noGUend="<<(c.isGUendAllowed() ? "false":"true")
479 <<")";
480 return out;
481}
482
484
485} // namespace
486
487#endif /* SEEDCONSTRAINT_H_ */
Definition IndexRangeList.h:20
Definition SeedConstraint.h:20
E_type getMaxEhybrid() const
Definition SeedConstraint.h:334
size_t getMaxUnpaired2() const
Definition SeedConstraint.h:352
IndexRangeList ranges1
the index ranges of seq1 to be searched for seeds
Definition SeedConstraint.h:238
E_type getMaxE() const
Definition SeedConstraint.h:316
size_t getMaxLength2() const
Definition SeedConstraint.h:379
std::string explicitSeeds
the string encoding of the explicit seed interactions to be used
Definition SeedConstraint.h:244
bool isGUallowed() const
Definition SeedConstraint.h:442
E_type maxED
the maximal ED value (per sequence) allowed for a seed
Definition SeedConstraint.h:232
bool bpGUallowed
whether or not GU base pairs are allowed within seeds
Definition SeedConstraint.h:247
size_t maxUnpairedOverall
the overall summed maximally allowed number of unpaired bases in a seed
Definition SeedConstraint.h:220
const std::string & getExplicitSeeds() const
Definition SeedConstraint.h:424
const IndexRangeList & getRanges2() const
Definition SeedConstraint.h:397
bool isGUendAllowed() const
Definition SeedConstraint.h:451
E_type maxEhybrid
the maximal hybridization energy (incl E_init) allowed for a seed
Definition SeedConstraint.h:235
size_t getBasePairs() const
Definition SeedConstraint.h:307
size_t getMaxLength1() const
Definition SeedConstraint.h:370
const IndexRangeList & getRanges1() const
Definition SeedConstraint.h:388
E_type getMaxED() const
Definition SeedConstraint.h:325
bool lpAllowed
whether or not lonely base pairs are allowed
Definition SeedConstraint.h:253
bool bpGUendAllowed
whether or not GU base pairs are allowed at seed ends
Definition SeedConstraint.h:250
friend std::ostream & operator<<(std::ostream &out, const SeedConstraint &c)
Definition SeedConstraint.h:468
size_t bp
the number of base pairs to be present in a seed
Definition SeedConstraint.h:217
size_t getMaxUnpairedOverall() const
Definition SeedConstraint.h:361
size_t maxUnpaired2
the maximally allowed number of unpaired bases in seed seq2
Definition SeedConstraint.h:226
size_t maxUnpaired1
the maximally allowed number of unpaired bases in seed seq1
Definition SeedConstraint.h:223
virtual ~SeedConstraint()
Definition SeedConstraint.h:299
E_type maxE
the maximal energy allowed for a seed
Definition SeedConstraint.h:229
IndexRangeList ranges2
the index ranges of seq2 to be searched for seeds
Definition SeedConstraint.h:241
SeedConstraint(const size_t bp, const size_t maxUnpairedOverall, const size_t maxUnpaired1, const size_t maxUnpaired2, const E_type maxE, const E_type maxED, const E_type maxEhybrid, const IndexRangeList &ranges1, const IndexRangeList &ranges2reversed, const std::string &explicitSeeds, const bool noGUallowed, const bool noGUendAllowed, const bool noLP)
Definition SeedConstraint.h:263
size_t getMaxUnpaired1() const
Definition SeedConstraint.h:343
bool isLpAllowed() const
Definition SeedConstraint.h:460
#define toString(x)
Definition general.h:60
#define E_2_Ekcal(e)
convert internal energy type to energy value in kcal/mol units
Definition general.h:107
Definition Accessibility.h:13
int E_type
type for energy values (energy + accessibility [ED]) (internally)
Definition general.h:78
std::ostream & operator<<(std::ostream &out, const AccessibilityConstraint &c)
Definition AccessibilityConstraint.h:481