diff --git a/ChangeLog b/ChangeLog index 692e1c38..db2b1b99 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,23 @@ ################################################################################ ################################################################################ +################################################################################ +### version 3.1.3 +################################################################################ + +# IntaRNA +- bugfix latest changes on traceback + +################################################################################ + +191104 Martin Raden + * PredictorMfe2dSeedExtension:: + * traceBack() + * bugfix tracback (reset of k2 iteration) + +191031 Martin Raden + * using c++11 raw strings where appropriate + ################################################################################ ### version 3.1.2 ################################################################################ @@ -27,6 +44,7 @@ - new total energy output `Etotal` = (E+Eall1+Eall2) and `EallTotal` = (Eall+Eall1+Eall2) - new `RT` output + - new `bpList` output # auxiliary R scripts - plotRegions.py - visualization of sequence regions covered by IntaRNA diff --git a/configure.ac b/configure.ac index 44fe1fcf..7d2cbd24 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.1.2], [], [intaRNA], [http://www.bioinf.uni-freiburg.de] ) +AC_INIT([IntaRNA], [3.1.3], [], [intaRNA], [http://www.bioinf.uni-freiburg.de] ) # minimal required version of the boost library BOOST_REQUIRED_VERSION=1.50.0 diff --git a/src/IntaRNA/AccessibilityConstraint.cpp b/src/IntaRNA/AccessibilityConstraint.cpp index 382b9e88..07f1e320 100644 --- a/src/IntaRNA/AccessibilityConstraint.cpp +++ b/src/IntaRNA/AccessibilityConstraint.cpp @@ -26,8 +26,7 @@ const std::string AccessibilityConstraint::dotBracketAlphabet = ; const std::string AccessibilityConstraint::regionIndexList = "["+AccessibilityConstraint::dotBracket_constraints+"]:" - +"(-?[123456789]\\d*--?[123456789]\\d*,)*-?[123456789]\\d*--?[123456789]\\d*" - ; + + R"((-?[123456789]\d*--?[123456789]\d*,)*-?[123456789]\d*--?[123456789]\d*)"; const boost::regex AccessibilityConstraint::regex( "([" @@ -41,14 +40,14 @@ const boost::regex AccessibilityConstraint::regex( // D | Dm1.9 | Db-0.7 | Dm1.9b-0.7 // Z | Zb0.8 // W -const boost::regex AccessibilityConstraint::regexShapeMethod("^((D(m-?(\\d+|\\d+.\\d+))?(b-?(\\d+|\\d+.\\d+))?)|(Z(b(\\d+|\\d+.\\d+))?)|(W))$"); +const boost::regex AccessibilityConstraint::regexShapeMethod(R"(^((D(m-?(\d+|\d+.\d+))?(b-?(\d+|\d+.\d+))?)|(Z(b(\d+|\d+.\d+))?)|(W))$)"); // M // C0.2 // S // Ls0.5i0.5 // Os0.5i-0.5 -const boost::regex AccessibilityConstraint::regexShapeConversion("^((M)|(C(\\d+|\\d+.\\d+)?)|(S)|((L|O)(s-?(\\d+|\\d+.\\d+)i-?(\\d+|\\d+.\\d+))?))$"); +const boost::regex AccessibilityConstraint::regexShapeConversion(R"(^((M)|(C(\d+|\d+.\d+)?)|(S)|((L|O)(s-?(\d+|\d+.\d+)i-?(\d+|\d+.\d+))?))$)"); //////////////////////////////////////////////////////////////////////// diff --git a/src/IntaRNA/AccessibilityFromStream.cpp b/src/IntaRNA/AccessibilityFromStream.cpp index 1abbcd1b..86eff91f 100644 --- a/src/IntaRNA/AccessibilityFromStream.cpp +++ b/src/IntaRNA/AccessibilityFromStream.cpp @@ -73,7 +73,7 @@ parseRNAplfold_text( std::istream & inStream, const Z_type RT, const bool parseP if ( !std::getline( inStream, line ) ) { throw std::runtime_error("AccessibilityFromStream::parseRNAplfold_text() : nothing readable"); } - if ( ! boost::regex_match(line,boost::regex("^#[\\w\\s]+$"), boost::match_perl) ) { + if ( ! boost::regex_match(line,boost::regex(R"(^#[\w\s]+$)"), boost::match_perl) ) { throw std::runtime_error("AccessibilityFromStream::parseRNAplfold_text() : first line != expected header line starting with '#'"); } @@ -81,7 +81,7 @@ parseRNAplfold_text( std::istream & inStream, const Z_type RT, const bool parseP if ( !std::getline( inStream, line ) ) { throw std::runtime_error("AccessibilityFromStream::parseRNAplfold_text() : length header (2nd line) not found"); } - if ( ! boost::regex_match(line,boost::regex("^\\s*#i.\\s+l=1(\\s+\\d+)*\\s*$"), boost::match_perl) ) { + if ( ! boost::regex_match(line,boost::regex(R"(^\s*#i.\s+l=1(\s+\d+)*\s*$)"), boost::match_perl) ) { throw std::runtime_error("AccessibilityFromStream::parseRNAplfold_text() : second line is no proper lengths header"); } // check if maxLength <= max available length diff --git a/src/IntaRNA/IndexRange.cpp b/src/IntaRNA/IndexRange.cpp index fb9a42da..264f9d7a 100644 --- a/src/IntaRNA/IndexRange.cpp +++ b/src/IntaRNA/IndexRange.cpp @@ -15,7 +15,6 @@ const size_t IndexRange::LAST_INDEX = IndexRange::NA_INDEX-1; //////////////////////////////////////////////////////////////// -//const std::string IndexRange::regexString("(0|-?[123456789]\\d*)-(0|-?[123456789]\\d*)"); const boost::regex IndexRange::regex("^"+std::string(IndexRange::regexString)+"$"); //////////////////////////////////////////////////////////////// diff --git a/src/IntaRNA/IndexRange.h b/src/IntaRNA/IndexRange.h index 8079980f..c5258b4e 100644 --- a/src/IntaRNA/IndexRange.h +++ b/src/IntaRNA/IndexRange.h @@ -35,7 +35,7 @@ class IndexRange { size_t to; //! regular expression that matches valid IndexRange string encodings - static constexpr const char* regexString = "(0|-?[123456789]\\d*)-(0|-?[123456789]\\d*)"; + static constexpr const char* regexString = R"((0|-?[123456789]\d*)-(0|-?[123456789]\d*))"; //! regular expression that matches valid IndexRange string encodings static const boost::regex regex; diff --git a/src/IntaRNA/PredictionTrackerSpotProb.cpp b/src/IntaRNA/PredictionTrackerSpotProb.cpp index 0d09a7e5..1aaeb0c2 100644 --- a/src/IntaRNA/PredictionTrackerSpotProb.cpp +++ b/src/IntaRNA/PredictionTrackerSpotProb.cpp @@ -8,8 +8,8 @@ namespace IntaRNA { ////////////////////////////////////////////////////////////////////// -const std::string PredictionTrackerSpotProb::str_spot ="(0|-?[123456789]\\d*)&(0|-?[123456789]\\d*)"; -const boost::regex PredictionTrackerSpotProb::regexSpotString("\\s*|"+str_spot+"(,"+str_spot+")*"); +const std::string PredictionTrackerSpotProb::str_spot = R"((0|-?[123456789]\d*)&(0|-?[123456789]\d*))"; +const boost::regex PredictionTrackerSpotProb::regexSpotString(R"(\s*|)"+str_spot+"(,"+str_spot+")*"); ////////////////////////////////////////////////////////////////////// diff --git a/src/IntaRNA/PredictorMfe2dSeedExtension.cpp b/src/IntaRNA/PredictorMfe2dSeedExtension.cpp index 3d2e5d75..b98278ee 100644 --- a/src/IntaRNA/PredictorMfe2dSeedExtension.cpp +++ b/src/IntaRNA/PredictorMfe2dSeedExtension.cpp @@ -392,8 +392,8 @@ traceBack( Interaction & interaction ) // check all combinations of decompositions into (i1,i2)..(k1,k2)-(si1,si2) const size_t k1max = std::min(si1-1,i1+noLpShift+energy.getMaxInternalLoopSize1()+1); const size_t k2max = std::min(si2-1,i2+noLpShift+energy.getMaxInternalLoopSize2()+1); - for (k1++; traceNotFound && k1<=k1max; k1++) { - for (k2++; traceNotFound && k2<=k2max; k2++) { + for (k1=i1+noLpShift+1; traceNotFound && k1<=k1max; k1++) { + for (k2=i2+noLpShift+1; traceNotFound && k2<=k2max; k2++) { // check if (k1,k2) are valid left boundary if ( E_isNotINF( hybridE_left(si1-k1,si2-k2) ) ) { if ( E_equal( curE, @@ -411,10 +411,10 @@ traceBack( Interaction & interaction ) i1=k1; i2=k2; curE = hybridE_left(si1-i1,si2-i2); - } - } - } - } + } // found trace step + } // (k1,k2) complementary + } // k2 + } // k1 if (traceNotFound) { LOG(ERROR) <<"left-not-found: i "< #include #include +#include #if INTARNA_MULITHREADING #include @@ -1099,6 +1100,11 @@ parse(int argc, char** argv) if (parsingCode == ReturnCode::KEEP_GOING) { try { + + // parsing escape literals + outSep = unescaped_string::getUnescaped( outSep ); + + // open output stream { // open according stream @@ -2511,7 +2517,7 @@ getPersonality( int argc, char ** argv ) // default : check via call name std::string value(argv[0]); // strip path if present - size_t cutPos = value.find_last_of("/\\"); + size_t cutPos = value.find_last_of(R"(/\)"); if (cutPos != std::string::npos) { value = value.substr(cutPos+1); } @@ -2519,7 +2525,7 @@ getPersonality( int argc, char ** argv ) // check if respective parameter provided // --> overwrites default from call name const boost::regex paramNameRegex("^--personality.*", boost::regex::icase); - const boost::regex paramRegex("^--personality=\\S+$", boost::regex::icase); + const boost::regex paramRegex(R"(^--personality=\S+$)", boost::regex::icase); bool setViaParameter = false; for (int i=1; i #include #include +#include #include #include @@ -87,6 +88,41 @@ class CommandLineParsing { } } + template + struct unescaped_string + : boost::spirit::qi::grammar + { + boost::spirit::qi::rule unesc_str; + boost::spirit::qi::symbols unesc_char; + + unescaped_string() + : unescaped_string::base_type(unesc_str) + { + using namespace boost::spirit; + unesc_char.add(R"(\a)", '\a')(R"(\b)", '\b')(R"(\f)", '\f')(R"(\n)", '\n') + (R"(\r)", '\r')(R"(\t)", '\t')(R"(\v)", '\v') + (R"(\\)", '\\')(R"(\')", '\'')(R"(\")", '\"') + ; + + unesc_str = qi::lit(qi::_r1) + >> *(unesc_char | qi::graph | qi::space | R"(\x)" >> qi::hex) + >> qi::lit(qi::_r1) + ; + } + + static + std::string + getUnescaped( const std::string & rawString ) + { + using namespace boost::spirit; + std::string parsed; + char const* quote = ""; // leading and trailing quote string to parse + unescaped_string myGrammar; + qi::parse( rawString.begin(), rawString.end(), myGrammar(quote), parsed); + return parsed; + } + }; + /** * Identifies the requested personality from the given call arguments */ diff --git a/tests/AccessibilityConstraint_test.cpp b/tests/AccessibilityConstraint_test.cpp index e1ef03ae..776909b6 100644 --- a/tests/AccessibilityConstraint_test.cpp +++ b/tests/AccessibilityConstraint_test.cpp @@ -28,7 +28,7 @@ TEST_CASE( "AccessibilityConstraint", "[AccessibilityConstraint]" ) { boost::regex regex; // general test - regex = boost::regex("\\s"); + regex = boost::regex(R"(\s)"); REQUIRE_FALSE(boost::regex_match( "", regex, boost::match_perl )); REQUIRE(boost::regex_match( " ", regex, boost::match_perl )); diff --git a/tests/PredictionTrackerProfileMinE_test.cpp b/tests/PredictionTrackerProfileMinE_test.cpp index 5e4676fa..c7a5ef38 100644 --- a/tests/PredictionTrackerProfileMinE_test.cpp +++ b/tests/PredictionTrackerProfileMinE_test.cpp @@ -39,8 +39,8 @@ TEST_CASE( "PredictionTrackerProfileMinE", "[PredictionTrackerProfileMinE]" ) { // LOG(DEBUG)<<"1.s2:\n"<