diff --git a/ChangeLog b/ChangeLog index 0b2b9d38..72842672 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,11 +10,64 @@ # changes in development version since last release ################################################################################ - +# IntaRNA ################################################################################ ################################################################################ + +################################################################################ +### version 3.2.1 +################################################################################ + +# IntaRNA +- support for multi-seq input when `seedQ|TRange` given +- BUGFIX: Andronescu07 energy parameter set was not loaded by name without file +- BUGFIX: 'outMinPu' was not fully implemented +- BUILDFIX: non-global import of boost::bind + +# CopomuS : +- exit value 0 if no favorable interaction was found + +################################################################################ + +201127 Martin Raden + * bin/CommandLineParsing : + * changing import and usage of boost::bind and boost::placeholders namespace + (thanks to Behra Phani Rama Krishna) + +200615 Martin Raden + * IntaRNA/OutputConstraint : + + maxED : maximal ED penalty of each interacting subsequence + * bin/CommandLineParsing : + * getOutputConstraint() : + + energy argument to setup OutputConstraint constructor call + * IntaRNA/Predictor : + * updateZall() : + + check for OutputConstraint.maxED + * IntaRNA/PredictorMfe : + * updateOptima() : + + check for OutputConstraint.maxED + * IntaRNA/PredictorMfe* : + * obsolete OutputConstraint variable removed + +200602 Martin Raden + * bin/CommandLineParsing : + + sequence error information now with sequence ID rather than number + +200602 Martin Raden + * bin/CommandLineParsing : + + explicit seedQ|TRange check for each sequence (support for multi-seq input) + +200429 Martin Raden + * python/copomus/candidate_selectors.py : + * bugfix: sys.exit(0) if not favorable interaction was found + +200312 Martin Raden + * bin/CommandLineParsing : + * validate_energyFile() : + + bugfix: missing check for predefined Andronescu07 data set name + ################################################################################ ### version 3.2.0 ################################################################################ diff --git a/configure.ac b/configure.ac index 4e2ad09f..d0b2f54e 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ AC_PREREQ([2.65]) # 5 argument version only available with aclocal >= 2.64 -AC_INIT([IntaRNA], [3.2.0], [], [intaRNA], [http://www.bioinf.uni-freiburg.de] ) +AC_INIT([IntaRNA], [3.2.1], [], [intaRNA], [http://www.bioinf.uni-freiburg.de] ) # minimal required version of the boost library BOOST_REQUIRED_VERSION=1.50.0 diff --git a/python/copomus/candidate_selectors.py b/python/copomus/candidate_selectors.py index 67a580f9..fbcb8e1e 100644 --- a/python/copomus/candidate_selectors.py +++ b/python/copomus/candidate_selectors.py @@ -24,7 +24,7 @@ def get_mfe_bps(query: str, target: str, qidxpos0: int, tidxpos0: int, param_fil data = i.run(query, target, qidxpos0, tidxpos0, 'bpList', threads, param_file=param_file) if not data or not data['bpList']: print('No favorable interaction between the specified sequences!') - sys.exit(1) + sys.exit(0) for t in data['bpList'].strip().split(':'): t_index, q_index = [int(x) for x in t.strip('(').strip(')').split(',')] candidates.append((q_index, t_index)) # note we do query first, then target @@ -48,7 +48,7 @@ def get_mfe_bps_so(query: str, target: str, qidxpos0: int, tidxpos0: int, param_ data = i.run(query, target, qidxpos0, tidxpos0, 'start1,end1,start2,end2', threads, param_file=param_file) if not data: print('No favorable interaction between the specified sequences!') - sys.exit(1) + sys.exit(0) data = i.run(query, target, qidxpos0, tidxpos0, 'bpList', threads, 1000, param_file, ['--qRegion', f"{data['start2']}-{data['end2']}", '--tRegion', f"{data['start1']}-{data['end1']}"]) for subopt in data: diff --git a/src/IntaRNA/OutputConstraint.cpp b/src/IntaRNA/OutputConstraint.cpp index ab4fb9d9..a5babdff 100644 --- a/src/IntaRNA/OutputConstraint.cpp +++ b/src/IntaRNA/OutputConstraint.cpp @@ -15,6 +15,7 @@ OutputConstraint::OutputConstraint( , const bool noGUend , const bool needZall , const bool needBPs + , const E_type maxED ) : reportMax(reportMax) @@ -26,6 +27,7 @@ OutputConstraint::OutputConstraint( , noGUend(noGUend) , needZall(needZall) , needBPs(needBPs) + , maxED(maxED) { if(deltaE < (E_type)0.0) throw std::runtime_error("OutputConstraint(deltaE="+toString(deltaE)+") not >= 0.0"); } diff --git a/src/IntaRNA/OutputConstraint.h b/src/IntaRNA/OutputConstraint.h index 566da511..82cb8d92 100644 --- a/src/IntaRNA/OutputConstraint.h +++ b/src/IntaRNA/OutputConstraint.h @@ -3,6 +3,7 @@ #define INTARNA_OUTPUTCONSTRAINT_H_ #include "IntaRNA/general.h" +#include "IntaRNA/Accessibility.h" namespace IntaRNA { @@ -58,6 +59,9 @@ class OutputConstraint //! whether or not interaction base pairs have to be traced for output generation const bool needBPs; + //! maximal ED penalty of each interacting subsequence to be considered for output + const E_type maxED; + public: /** @@ -83,7 +87,8 @@ class OutputConstraint , const bool noLP = false , const bool noGUend = false , const bool needZall = false - , const bool needBPs = true ); + , const bool needBPs = true + , const E_type maxED = Accessibility::ED_UPPER_BOUND); //! destruction virtual ~OutputConstraint(); diff --git a/src/IntaRNA/Predictor.h b/src/IntaRNA/Predictor.h index 87844ab1..09001de4 100644 --- a/src/IntaRNA/Predictor.h +++ b/src/IntaRNA/Predictor.h @@ -256,6 +256,15 @@ updateZall( const size_t i1, const size_t j1 return; } + // check ED penalties + if (output.getOutputConstraint().maxED < Accessibility::ED_UPPER_BOUND + && (energy.getED1(i1,j1) > output.getOutputConstraint().maxED + || energy.getED2(i2,j2) > output.getOutputConstraint().maxED) + ) + { + return; + } + // increment Zall with BW of overall energy incrementZall( energy.getBoltzmannWeight( diff --git a/src/IntaRNA/PredictorMfe.cpp b/src/IntaRNA/PredictorMfe.cpp index d9c2142e..75523d39 100644 --- a/src/IntaRNA/PredictorMfe.cpp +++ b/src/IntaRNA/PredictorMfe.cpp @@ -92,6 +92,15 @@ updateOptima( const size_t i1, const size_t j1 return; } + // check ED penalties + if (output.getOutputConstraint().maxED < Accessibility::ED_UPPER_BOUND + && (energy.getED1(i1,j1) > output.getOutputConstraint().maxED + || energy.getED2(i2,j2) > output.getOutputConstraint().maxED) + ) + { + return; + } + // update Zall if needed if (incrementZall) { updateZall( i1,j1, i2,j2, interE, isHybridE ); diff --git a/src/IntaRNA/PredictorMfe2d.cpp b/src/IntaRNA/PredictorMfe2d.cpp index 781c1286..90d066d8 100644 --- a/src/IntaRNA/PredictorMfe2d.cpp +++ b/src/IntaRNA/PredictorMfe2d.cpp @@ -34,9 +34,6 @@ PredictorMfe2d:: predict( const IndexRange & r1 , const IndexRange & r2 ) { - // temporary access - const OutputConstraint & outConstraint = output.getOutputConstraint(); - #if INTARNA_MULITHREADING #pragma omp critical(intarna_omp_logOutput) #endif diff --git a/src/IntaRNA/PredictorMfe2dHeuristic.cpp b/src/IntaRNA/PredictorMfe2dHeuristic.cpp index e6d99dad..91750cc8 100644 --- a/src/IntaRNA/PredictorMfe2dHeuristic.cpp +++ b/src/IntaRNA/PredictorMfe2dHeuristic.cpp @@ -35,8 +35,6 @@ predict( const IndexRange & r1 , const IndexRange & r2 ) { - // temporary access - const OutputConstraint & outConstraint = output.getOutputConstraint(); #if INTARNA_MULITHREADING #pragma omp critical(intarna_omp_logOutput) #endif diff --git a/src/IntaRNA/PredictorMfe2dHeuristicSeed.cpp b/src/IntaRNA/PredictorMfe2dHeuristicSeed.cpp index 4876f132..41cf127a 100644 --- a/src/IntaRNA/PredictorMfe2dHeuristicSeed.cpp +++ b/src/IntaRNA/PredictorMfe2dHeuristicSeed.cpp @@ -35,8 +35,6 @@ PredictorMfe2dHeuristicSeed:: predict( const IndexRange & r1 , const IndexRange & r2 ) { - // temporary access - const OutputConstraint & outConstraint = output.getOutputConstraint(); #if INTARNA_MULITHREADING #pragma omp critical(intarna_omp_logOutput) #endif diff --git a/src/IntaRNA/PredictorMfe2dHeuristicSeedExtension.cpp b/src/IntaRNA/PredictorMfe2dHeuristicSeedExtension.cpp index 86abd0c6..1d14cee1 100644 --- a/src/IntaRNA/PredictorMfe2dHeuristicSeedExtension.cpp +++ b/src/IntaRNA/PredictorMfe2dHeuristicSeedExtension.cpp @@ -33,8 +33,6 @@ void PredictorMfe2dHeuristicSeedExtension:: predict( const IndexRange & r1, const IndexRange & r2 ) { - // temporary access - const OutputConstraint & outConstraint = output.getOutputConstraint(); #if INTARNA_MULITHREADING #pragma omp critical(intarna_omp_logOutput) #endif diff --git a/src/IntaRNA/PredictorMfe2dSeed.cpp b/src/IntaRNA/PredictorMfe2dSeed.cpp index c1a1dc89..fbb8fe4a 100644 --- a/src/IntaRNA/PredictorMfe2dSeed.cpp +++ b/src/IntaRNA/PredictorMfe2dSeed.cpp @@ -32,8 +32,6 @@ void PredictorMfe2dSeed:: predict( const IndexRange & r1, const IndexRange & r2 ) { - // temporary access - const OutputConstraint & outConstraint = output.getOutputConstraint(); #if INTARNA_MULITHREADING #pragma omp critical(intarna_omp_logOutput) #endif diff --git a/src/IntaRNA/PredictorMfe2dSeedExtension.cpp b/src/IntaRNA/PredictorMfe2dSeedExtension.cpp index 38521f2b..86861c92 100644 --- a/src/IntaRNA/PredictorMfe2dSeedExtension.cpp +++ b/src/IntaRNA/PredictorMfe2dSeedExtension.cpp @@ -33,8 +33,6 @@ void PredictorMfe2dSeedExtension:: predict( const IndexRange & r1, const IndexRange & r2 ) { - // temporary access - const OutputConstraint & outConstraint = output.getOutputConstraint(); #if INTARNA_MULITHREADING #pragma omp critical(intarna_omp_logOutput) #endif diff --git a/src/IntaRNA/PredictorMfeEns.cpp b/src/IntaRNA/PredictorMfeEns.cpp index 23a06f3d..6d0094df 100644 --- a/src/IntaRNA/PredictorMfeEns.cpp +++ b/src/IntaRNA/PredictorMfeEns.cpp @@ -111,8 +111,6 @@ void PredictorMfeEns:: traceBack( Interaction & interaction ) { - // temporary access - const OutputConstraint & outConstraint = output.getOutputConstraint(); // check if something to trace if (interaction.basePairs.size() < 2) { return; diff --git a/src/IntaRNA/PredictorMfeEns2d.cpp b/src/IntaRNA/PredictorMfeEns2d.cpp index 707c509d..145d3553 100644 --- a/src/IntaRNA/PredictorMfeEns2d.cpp +++ b/src/IntaRNA/PredictorMfeEns2d.cpp @@ -34,8 +34,6 @@ PredictorMfeEns2d:: predict( const IndexRange & r1 , const IndexRange & r2 ) { - // temporary access - const OutputConstraint & outConstraint = output.getOutputConstraint(); #if INTARNA_MULITHREADING #pragma omp critical(intarna_omp_logOutput) #endif diff --git a/src/IntaRNA/PredictorMfeEns2dHeuristic.cpp b/src/IntaRNA/PredictorMfeEns2dHeuristic.cpp index 00398d44..1c43f418 100644 --- a/src/IntaRNA/PredictorMfeEns2dHeuristic.cpp +++ b/src/IntaRNA/PredictorMfeEns2dHeuristic.cpp @@ -34,8 +34,6 @@ predict( const IndexRange & r1 , const IndexRange & r2 ) { - // temporary access - const OutputConstraint & outConstraint = output.getOutputConstraint(); #if INTARNA_MULITHREADING #pragma omp critical(intarna_omp_logOutput) #endif diff --git a/src/IntaRNA/PredictorMfeEns2dHeuristicSeedExtension.cpp b/src/IntaRNA/PredictorMfeEns2dHeuristicSeedExtension.cpp index bc1fe839..9fd05b9e 100644 --- a/src/IntaRNA/PredictorMfeEns2dHeuristicSeedExtension.cpp +++ b/src/IntaRNA/PredictorMfeEns2dHeuristicSeedExtension.cpp @@ -32,8 +32,6 @@ void PredictorMfeEns2dHeuristicSeedExtension:: predict( const IndexRange & r1, const IndexRange & r2 ) { - // temporary access - const OutputConstraint & outConstraint = output.getOutputConstraint(); #if INTARNA_MULITHREADING #pragma omp critical(intarna_omp_logOutput) #endif diff --git a/src/IntaRNA/PredictorMfeEns2dSeedExtension.cpp b/src/IntaRNA/PredictorMfeEns2dSeedExtension.cpp index cc7aa459..80c4a763 100644 --- a/src/IntaRNA/PredictorMfeEns2dSeedExtension.cpp +++ b/src/IntaRNA/PredictorMfeEns2dSeedExtension.cpp @@ -33,8 +33,6 @@ void PredictorMfeEns2dSeedExtension:: predict( const IndexRange & r1, const IndexRange & r2 ) { - // temporary access - const OutputConstraint & outConstraint = output.getOutputConstraint(); #if INTARNA_MULITHREADING #pragma omp critical(intarna_omp_logOutput) #endif diff --git a/src/IntaRNA/PredictorMfeEnsSeedOnly.cpp b/src/IntaRNA/PredictorMfeEnsSeedOnly.cpp index 8f82ac7d..c5e79d6d 100644 --- a/src/IntaRNA/PredictorMfeEnsSeedOnly.cpp +++ b/src/IntaRNA/PredictorMfeEnsSeedOnly.cpp @@ -32,8 +32,6 @@ void PredictorMfeEnsSeedOnly:: predict( const IndexRange & r1, const IndexRange & r2 ) { - // temporary access - const OutputConstraint & outConstraint = output.getOutputConstraint(); #if INTARNA_MULITHREADING #pragma omp critical(intarna_omp_logOutput) #endif @@ -97,8 +95,6 @@ void PredictorMfeEnsSeedOnly:: traceBack( Interaction & interaction ) { - // temporary access - const OutputConstraint & outConstraint = output.getOutputConstraint(); // check if something to trace if (interaction.basePairs.size() < 2) { return; diff --git a/src/IntaRNA/PredictorMfeSeedOnly.cpp b/src/IntaRNA/PredictorMfeSeedOnly.cpp index 0b5feffc..afab7776 100644 --- a/src/IntaRNA/PredictorMfeSeedOnly.cpp +++ b/src/IntaRNA/PredictorMfeSeedOnly.cpp @@ -32,8 +32,6 @@ void PredictorMfeSeedOnly:: predict( const IndexRange & r1, const IndexRange & r2 ) { - // temporary access - const OutputConstraint & outConstraint = output.getOutputConstraint(); #if INTARNA_MULITHREADING #pragma omp critical(intarna_omp_logOutput) #endif @@ -95,8 +93,6 @@ void PredictorMfeSeedOnly:: traceBack( Interaction & interaction ) { - // temporary access - const OutputConstraint & outConstraint = output.getOutputConstraint(); // check if something to trace if (interaction.basePairs.size() < 2) { return; diff --git a/src/bin/CommandLineParsing.cpp b/src/bin/CommandLineParsing.cpp index 697e13b5..f3a9cc76 100644 --- a/src/bin/CommandLineParsing.cpp +++ b/src/bin/CommandLineParsing.cpp @@ -12,7 +12,7 @@ #include #endif -#include +#include #include #include #include @@ -350,6 +350,7 @@ CommandLineParsing::CommandLineParsing( const Personality personality ) } using namespace boost::program_options; + using namespace boost::placeholders; //// REMAINING INITIALIZATIONS ///////////////////////////////// @@ -1237,18 +1238,14 @@ parse(int argc, char** argv) } else { // check query search ranges if (!seedQRange.empty()) { - if (query.size()!=1) { - throw error("seedQRange given but more than one query sequence provided"); - } else { - validate_indexRangeList("seedQRange",seedQRange, *(query.begin())); + for (auto q : query) { + validate_indexRangeList("seedQRange",seedQRange, q); } } // check target search ranges if (!seedTRange.empty()) { - if (target.size()!=1) { - throw error("seedTRange given but more than one target sequence provided"); - } else { - validate_indexRangeList("seedTRange",seedTRange, *(target.begin())); + for (auto t : target) { + validate_indexRangeList("seedTRange",seedTRange, t); } } @@ -1256,14 +1253,14 @@ parse(int argc, char** argv) // check for explicit seed constraints if (seedTQ.empty()) { // check for minimal sequence length (>=seedBP) - for( size_t i=0; i0 ? std::min(Accessibility::ED_UPPER_BOUND, energy.getE( outMinPu.val )) : Accessibility::ED_UPPER_BOUND) ); } @@ -2234,7 +2232,7 @@ validateSequenceAlphabet( const std::string& paramName, for (int i=0; igetOutStream(), energy, 10, false ); + return new OutputHandlerText( getOutputConstraint(energy), outStreamHandler->getOutStream(), energy, 10, false ); case 'D' : - return new OutputHandlerText( getOutputConstraint(), outStreamHandler->getOutStream(), energy, 10, true ); + return new OutputHandlerText( getOutputConstraint(energy), outStreamHandler->getOutStream(), energy, 10, true ); case 'E' : // ensure that Zall is computed outNeedsZall = true; // no interaction details needed outNeedsBPs = false; - return new OutputHandlerEnsemble( getOutputConstraint(), outStreamHandler->getOutStream(), energy ); + return new OutputHandlerEnsemble( getOutputConstraint(energy), outStreamHandler->getOutStream(), energy ); case 'C' : // ensure that Zall is computed if needed outNeedsZall = outNeedsZall || OutputHandlerCsv::needsZall(OutputHandlerCsv::string2list( outCsvCols )); // check whether interaction details are needed outNeedsBPs = OutputHandlerCsv::needBPs(OutputHandlerCsv::string2list( outCsvCols ));; // create output handler - return new OutputHandlerCsv( getOutputConstraint(), outStreamHandler->getOutStream(), energy, OutputHandlerCsv::string2list( outCsvCols ), outSep, false, outCsvLstSep ); + return new OutputHandlerCsv( getOutputConstraint(energy), outStreamHandler->getOutStream(), energy, OutputHandlerCsv::string2list( outCsvCols ), outSep, false, outCsvLstSep ); default : INTARNA_NOT_IMPLEMENTED("Output mode "+toString(outMode.val)+" not implemented yet"); } diff --git a/src/bin/CommandLineParsing.h b/src/bin/CommandLineParsing.h index f505388d..1c48f13e 100644 --- a/src/bin/CommandLineParsing.h +++ b/src/bin/CommandLineParsing.h @@ -290,9 +290,10 @@ class CommandLineParsing { /** * The constraints to be applied to the interaction output generation + * @param energy the interaction energy to be used for computation * @return the output constraints to be applied */ - OutputConstraint getOutputConstraint() const; + OutputConstraint getOutputConstraint( const InteractionEnergy & energy ) const; /** * The stream to write the interaction output to @@ -1330,7 +1331,9 @@ validate_energyFile(const std::string & value) { // check for supported default models if (value == std::string(VrnaHandler::Turner99) - || value == std::string(VrnaHandler::Turner04) ) + || value == std::string(VrnaHandler::Turner04) + || value == std::string(VrnaHandler::Andronescu07) + ) { return; } diff --git a/src/bin/IntaRNA.cpp b/src/bin/IntaRNA.cpp index 92f250d4..ca9f77b1 100644 --- a/src/bin/IntaRNA.cpp +++ b/src/bin/IntaRNA.cpp @@ -213,9 +213,9 @@ int main(int argc, char **argv){ // setup collecting output handler to ensure // k-best output per query-target combination // and not per region combination if not requested - OutputHandlerInteractionList bestInteractions( parameters.getOutputConstraint(), + OutputHandlerInteractionList bestInteractions( parameters.getOutputConstraint(*energy), (parameters.reportBestPerRegion() ? std::numeric_limits::max() : 1 ) - * parameters.getOutputConstraint().reportMax ); + * parameters.getOutputConstraint(*energy).reportMax ); // run prediction for all range combinations for(const IndexRange & tRange : parameters.getTargetRanges(*energy, targetNumber, *targetAcc)) {