IntaRNA 3.4.1
RNA-RNA interaction prediction | C++ API
Loading...
Searching...
No Matches
Predictor.h
Go to the documentation of this file.
1
2#ifndef INTARNA_PREDICTOR_H_
3#define INTARNA_PREDICTOR_H_
4
5#include "IntaRNA/general.h"
7
10
12
13namespace IntaRNA {
14
21class Predictor {
22
23public:
24
39 );
40
44 virtual ~Predictor();
45
55 virtual
56 void
58 , const IndexRange & r2 = IndexRange(0,RnaSequence::lastPos) ) = 0;
59
69 static
70 size_t
71 getMaxInteractionWidth( const size_t w, const size_t maxLoopSize );
72
79 Z_type
80 getZall() const;
81
82protected:
83
86
89
92
96
97
101 virtual
102 void
104
117 virtual
118 void
119 updateOptima( const size_t i1, const size_t j1
120 , const size_t i2, const size_t j2
121 , const E_type energy
122 , const bool isHybridE
123 , const bool incrementZall ) = 0;
124
141 virtual
142 void
143 updateZall( const size_t i1, const size_t j1
144 , const size_t i2, const size_t j2
145 , const E_type energy
146 , const bool isHybridE );
147
148
149
153 virtual
154 void
156
161 void
162 incrementZall( const Z_type partZ );
163
164};
165
166
170
171inline
173 , OutputHandler & output
174 , PredictionTracker * predTracker )
175:
176 energy(energy)
177 , output(output)
178 , predTracker(predTracker)
179 , Zall(0)
180{
181}
182
184
185inline
190
192
193inline
194size_t
196getMaxInteractionWidth( const size_t w, const size_t maxLoopSize )
197{
198 // check if no window at all
199 if (w==0)
200 return 0;
201 // compute maximal interaction width, ie each position pairs with max loop size
202 return 1 + ((w-1)*(maxLoopSize+1));
203}
204
206
207inline
208Z_type
210getZall() const
211{
212 return Zall;
213}
214
216
217inline
218void
220incrementZall( const Z_type partZ )
221{
222#if INTARNA_IN_DEBUG_MODE
223 if ( (std::numeric_limits<Z_type>::max() - partZ) <= Zall) {
224 LOG(WARNING) <<"PredictorMfeEns::incrementZall() : partition function overflow! Recompile with larger partition function data type!";
225 }
226#endif
227 // increment overall partition function
228 Zall += partZ;
229}
230
232
233
235
236inline
237void
239updateZall( const size_t i1, const size_t j1
240 , const size_t i2, const size_t j2
241 , const E_type interE
242 , const bool isHybridE )
243{
244 // ignore if not needed
246 return;
247 }
248
249 // ignore invalid reports
250 if (E_isINF(interE) || interE >= E_MAX) {
251 return;
252 }
253
254 // check GU ends if needed
255 if (output.getOutputConstraint().noGUend && (energy.isGU(i1,i2) || energy.isGU(j1,j2)) ) {
256 return;
257 }
258
259 // check ED penalties
263 )
264 {
265 return;
266 }
267
268 // increment Zall with BW of overall energy
271 isHybridE ?
272 energy.getE( i1,j1, i2,j2, interE )
273 : interE
274 ));
275}
276
278
279} // namespace
280
281#endif /* PREDICTOR_H_ */
static const E_type ED_UPPER_BOUND
upper bound for all ED return values
Definition Accessibility.h:30
Definition IndexRange.h:20
Definition InteractionEnergyIdxOffset.h:18
virtual E_type getE(const size_t i1, const size_t j1, const size_t i2, const size_t j2, const E_type hybridE) const
Definition InteractionEnergyIdxOffset.h:862
virtual bool isGU(const size_t i1, const size_t i2) const
Definition InteractionEnergyIdxOffset.h:634
virtual E_type getED1(const size_t i1, const size_t j1) const
Definition InteractionEnergyIdxOffset.h:594
virtual E_type getED2(const size_t i2, const size_t j2) const
Definition InteractionEnergyIdxOffset.h:604
Definition InteractionEnergy.h:20
virtual Z_type getBoltzmannWeight(const E_type energy) const
Definition InteractionEnergy.h:786
const bool noGUend
whether or not inter-molecular UG base pairs are allowed at interaction ends
Definition OutputConstraint.h:54
const E_type maxED
maximal ED penalty of each interacting subsequence to be considered for output
Definition OutputConstraint.h:63
const bool needZall
whether or not Zall has to be computed for output generation
Definition OutputConstraint.h:57
Definition OutputHandler.h:20
const OutputConstraint & getOutputConstraint() const
Definition OutputHandler.h:167
Definition PredictionTracker.h:15
Definition Predictor.h:21
void incrementZall(const Z_type partZ)
Definition Predictor.h:220
virtual void reportOptima()=0
virtual void updateZall(const size_t i1, const size_t j1, const size_t i2, const size_t j2, const E_type energy, const bool isHybridE)
Definition Predictor.h:239
PredictionTracker * predTracker
prediction tracker to be used
Definition Predictor.h:91
static size_t getMaxInteractionWidth(const size_t w, const size_t maxLoopSize)
Definition Predictor.h:196
Z_type Zall
Definition Predictor.h:95
virtual void predict(const IndexRange &r1=IndexRange(0, RnaSequence::lastPos), const IndexRange &r2=IndexRange(0, RnaSequence::lastPos))=0
InteractionEnergyIdxOffset energy
energy computation handler
Definition Predictor.h:85
Predictor(const InteractionEnergy &energy, OutputHandler &output, PredictionTracker *predTracker)
Definition Predictor.h:172
Z_type getZall() const
Definition Predictor.h:210
OutputHandler & output
interaction output handler
Definition Predictor.h:88
virtual ~Predictor()
Definition Predictor.h:186
virtual void updateOptima(const size_t i1, const size_t j1, const size_t i2, const size_t j2, const E_type energy, const bool isHybridE, const bool incrementZall)=0
virtual void initOptima()=0
static const size_t lastPos
Definition RnaSequence.h:57
#define E_isINF(e)
check if a given energy is set to E_INF
Definition general.h:143
void INTARNA_CLEANUP(T *&pointer)
Definition general.h:30
Definition Accessibility.h:13
int E_type
type for energy values (energy + accessibility [ED]) (internally)
Definition general.h:78
double Z_type
type for probabilities, RT and Boltzmann values
Definition general.h:88
const E_type E_MAX
Definition general.h:80