Skip to content

Commit

Permalink
Merge pull request #86 from BackofenLab/intarna-2
Browse files Browse the repository at this point in the history
version 2.0.5
  • Loading branch information
Martin Mann authored Sep 27, 2017
2 parents f83393f + c7150ca commit 02e272a
Show file tree
Hide file tree
Showing 9 changed files with 131 additions and 12 deletions.
20 changes: 19 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@

version 2.0.5

170926 Martin Mann :
* IntaRNA/PredictorMfe4d :
* getNextBest() : BUGFIX : matrix access was not using interaction end
distance and interaction data was wrongly storing distance as right index;
this was causing segfaults when requesting more than one prediction output
(thanks to Rick Gelhausen)

170926 Martin Mann :
* IntaRNA/PredictorMfe4dSeed :
* IntaRNA/PredictorMfe2dHeuristicSeed :
+ updateOptima() to disable predTracker updates when fillHybridE() of super
class is called;
--> BUGFIX : so far resulting tracker profiles were a mix of non-seeded and
seeded interactions and thus not complementary with the predicted
interactions

version 2.0.4

170706 Martin Mann :
Expand All @@ -9,7 +27,7 @@ version 2.0.4

170705 Martin Mann :
* perl/Intarna*.pl :
* shebang corrected
* shebang corrected (thanks to Patrick Wright)

170503 Martin Mann :
* README.md :
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

AC_PREREQ([2.65])
# 5 argument version only available with aclocal >= 2.64
AC_INIT( [IntaRNA], [2.0.4], [], [intaRNA], [http://www.bioinf.uni-freiburg.de] )
AC_INIT( [IntaRNA], [2.0.5], [], [intaRNA], [http://www.bioinf.uni-freiburg.de] )


# minimal required version of the boost library
Expand Down
12 changes: 11 additions & 1 deletion src/IntaRNA/AccessibilityBasePair.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,17 @@

namespace IntaRNA {


/**
* Provides accessibility penalties for a Nussinov-like energy scoring where
* each base pair is scored by #basePairEnergy independently from its structural
* context.
*
* This implementation is mainly for teaching and testing purpose.
*
* @author Mostafa Mahmoud
* @author Martin Mann
*
*/
class AccessibilityBasePair: public Accessibility {

public:
Expand Down
6 changes: 3 additions & 3 deletions src/IntaRNA/PredictorMfe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ updateOptima( const size_t i1, const size_t j1
, const E_type interE
, const bool isHybridE )
{
// LOG(DEBUG) <<"energy( "<<i1<<"-"<<j1<<", "<<i2<<"-"<<j2<<" ) = "
// LOG(DEBUG) <<"PredictorMfe::updateOptima( "<<i1<<"-"<<j1<<", "<<i2<<"-"<<j2<<" , E = "
// <<interE;

// check if nothing to be done
Expand All @@ -100,8 +100,8 @@ updateOptima( const size_t i1, const size_t j1

if (mfeInteractions.size() == 1) {
if (curE < mfeInteractions.begin()->energy) {
// LOG(DEBUG) <<"PredictorMfe::updateOptima() : new mfe ( "
// <<i1<<"-"<<j1<<", "<<i2<<"-"<<j2<<" ) = " <<interE <<" : "<<curE;
// LOG(DEBUG) <<"PredictorMfe::updateOptima() : new mfe ( "
// <<i1<<"-"<<j1<<", "<<i2<<"-"<<j2<<" ) = " <<interE <<" : "<<curE;
// store new global min
mfeInteractions.begin()->energy = (curE);
// store interaction boundaries
Expand Down
4 changes: 2 additions & 2 deletions src/IntaRNA/PredictorMfe2dHeuristicSeed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ predict( const IndexRange & r1

// compute hybridization energies WITHOUT seed condition
// sets also -energy -hybridE
// -> no hybrid update since updateOptima overwritten
// -> no tracker update since updateOptima overwritten
PredictorMfe2dHeuristic::fillHybridE();

// check if any interaction possible
Expand All @@ -118,7 +118,7 @@ predict( const IndexRange & r1
return;
}

// init mfe for later updates
// reinit mfe for later updates with final information
initOptima( outConstraint );

// compute entries
Expand Down
40 changes: 40 additions & 0 deletions src/IntaRNA/PredictorMfe2dHeuristicSeed.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,23 @@ class PredictorMfe2dHeuristicSeed: public PredictorMfe2dHeuristic {

protected:

/**
* optima update without tracker notification
*
* @param i1 the index of the first sequence interacting with i2
* @param j1 the index of the first sequence interacting with j2
* @param i2 the index of the second sequence interacting with i1
* @param j2 the index of the second sequence interacting with j1
* @param energy ignored
* @param isHybridE ignored
*/
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 );

/**
* Fills a given interaction (boundaries given) with the according
* hybridizing base pairs.
Expand Down Expand Up @@ -116,6 +133,29 @@ class PredictorMfe2dHeuristicSeed: public PredictorMfe2dHeuristic {

};

//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////

inline
void
PredictorMfe2dHeuristicSeed::
updateOptima( const size_t i1, const size_t j1
, const size_t i2, const size_t j2
, const E_type energy
, const bool isHybridE )
{
// temporarily disable tracker
PredictionTracker * curPredTracker = this->predTracker;
this->predTracker = NULL;
// update optimum information
PredictorMfe2dHeuristic::updateOptima(i1,j1,i2,j2,energy,isHybridE);
// reenable tracker
this->predTracker = curPredTracker;
}

//////////////////////////////////////////////////////////////////////////

} // namespace

#endif /* INTARNA_PREDICTORMFE2DHEURISTICSEED_H_ */
14 changes: 11 additions & 3 deletions src/IntaRNA/PredictorMfe4d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ getNextBest( Interaction & curBest )
// iterate (decreasingly) over all left interaction starts
E2dMatrix * curTable = NULL;
IndexRange r1,r2;
size_t d1 = 0, d2 = 0; // temp vars to deals with possible interaction lengths
E_type curE = E_INF;
for (r1.from=hybridE.size1(); r1.from-- > 0;) {

Expand All @@ -422,26 +423,33 @@ getNextBest( Interaction & curBest )
continue;
}

// access energy table for left-most interaction base pair
curTable = hybridE(r1.from,r2.from);

for (r1.to=r1.from; r1.to<curTable->size1(); r1.to++) {
// iterate over all available interaction site lengths in seq1
for (d1 = 0; d1<curTable->size1(); d1++) {

// set according right interaction boundary in seq1
r1.to = r1.from + d1;
// check of overlapping
if (reportedInteractions.first.overlaps(r1)) {
// stop since all larger sites will overlap as well
break;;
}

for (r2.to=r2.from; r2.to<curTable->size2(); r2.to++) {
// iterate over all available interaction site lengths in seq2
for (d2=0; d2<curTable->size2(); d2++) {

// set according right interaction boundary in seq2
r2.to = r2.from + d2;
// check of overlapping
if (reportedInteractions.second.overlaps(r2)) {
// stop since all larger sites will overlap as well
break;;
}

// get overall energy of entry
curE = energy.getE( r1.from, r1.to, r2.from, r2.to, (*curTable)(r1.to,r2.to));
curE = energy.getE( r1.from, r1.to, r2.from, r2.to, (*curTable)(d1,d2));

// skip sites with energy too low
// or higher than current best found so far
Expand Down
5 changes: 4 additions & 1 deletion src/IntaRNA/PredictorMfe4dSeed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@ predict( const IndexRange & r1
initOptima( tmpOutConstraint );

// fill matrix
// compute hybridization energies WITHOUT seed condition
// sets also -energy -hybridE
// -> no tracker update since updateOptima overwritten
fillHybridE( );

// check if any interaction possible
Expand Down Expand Up @@ -324,7 +327,7 @@ fillHybridE_seed( )

// update mfe if needed (call super class)
if (E_isNotINF(curMinE)) {
updateOptima( i1,j1,i2,j2, curMinE, true );
PredictorMfe4d::updateOptima( i1,j1,i2,j2, curMinE, true );
}

}
Expand Down
40 changes: 40 additions & 0 deletions src/IntaRNA/PredictorMfe4dSeed.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,23 @@ class PredictorMfe4dSeed: public PredictorMfe4d {

protected:

/**
* optima update without tracker notification
*
* @param i1 the index of the first sequence interacting with i2
* @param j1 the index of the first sequence interacting with j2
* @param i2 the index of the second sequence interacting with i1
* @param j2 the index of the second sequence interacting with j1
* @param energy ignored
* @param isHybridE ignored
*/
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 );

/**
* Removes all temporary data structures and resets the predictor
*/
Expand Down Expand Up @@ -126,6 +143,29 @@ class PredictorMfe4dSeed: public PredictorMfe4d {

};

//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////

inline
void
PredictorMfe4dSeed::
updateOptima( const size_t i1, const size_t j1
, const size_t i2, const size_t j2
, const E_type energy
, const bool isHybridE )
{
// temporarily disable tracker
PredictionTracker * curPredTracker = this->predTracker;
this->predTracker = NULL;
// update optimum information
PredictorMfe4d::updateOptima(i1,j1,i2,j2,energy,isHybridE);
// reenable tracker
this->predTracker = curPredTracker;
}

//////////////////////////////////////////////////////////////////////////

} // namespace

#endif /* INTARNA_PREDICTORMFE4DSEED_H_ */

0 comments on commit 02e272a

Please sign in to comment.