From 364e88c8132d279de96bd4131639e1f4d090106a Mon Sep 17 00:00:00 2001 From: Tobias Rausch Date: Tue, 17 Sep 2024 16:10:38 +0200 Subject: [PATCH] drop deprecated func --- Dockerfile | 1 + Makefile | 2 +- singularity/dicey.def | 2 +- src/gtf.h | 17 +++++++++-------- src/hunter.h | 9 +++------ src/silica.h | 29 +++++++++++------------------ src/version.h | 2 +- 7 files changed, 27 insertions(+), 35 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1ad27be..33bf1ee 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,6 +23,7 @@ RUN apt-get update && apt-get install -y \ libhdf5-dev \ libncurses-dev \ liblzma-dev \ + pkg-config \ zlib1g-dev \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* diff --git a/Makefile b/Makefile index 679a284..e28a6da 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ bindir ?= $(exec_prefix)/bin # Flags CXX=g++ -CXXFLAGS += -std=c++14 -isystem ${JLIB} -isystem ${EBROOTHTSLIB} -isystem ${SDSL_ROOT}/include -pedantic -W -Wall +CXXFLAGS += -std=c++17 -isystem ${JLIB} -isystem ${EBROOTHTSLIB} -isystem ${SDSL_ROOT}/include -pedantic -W -Wall LDFLAGS += -L${EBROOTHTSLIB} -L${EBROOTHTSLIB}/lib -L${SDSL_ROOT}/lib -lboost_iostreams -lboost_filesystem -lboost_system -lboost_program_options -lboost_date_time -ldl -lpthread ifeq (${STATIC}, 1) diff --git a/singularity/dicey.def b/singularity/dicey.def index 5b75e2b..5f7909b 100644 --- a/singularity/dicey.def +++ b/singularity/dicey.def @@ -17,7 +17,7 @@ Stage: build # Final image BootStrap: library -From: alpine:3.9 +From: alpine:latest Stage: final %files from build diff --git a/src/gtf.h b/src/gtf.h index 6995e64..37e051f 100644 --- a/src/gtf.h +++ b/src/gtf.h @@ -36,6 +36,10 @@ namespace dicey { explicit IntervalLabel(int32_t s) : start(s), end(s+1), strand('*'), lid(-1) {} IntervalLabel(int32_t s, int32_t e, char t, int32_t l) : start(s), end(e), strand(t), lid(l) {} + + bool operator<(const IntervalLabel& s2) const { + return start < s2.start; + } }; struct IntervalLabelId { @@ -47,22 +51,19 @@ namespace dicey { explicit IntervalLabelId(int32_t s) : start(s), end(s+1), strand('*'), lid(-1), eid(-1) {} IntervalLabelId(int32_t s, int32_t e, char t, int32_t l, int32_t i) : start(s), end(e), strand(t), lid(l), eid(i) {} + + bool operator<(const IntervalLabelId& s2) const { + return start < s2.start; + } }; template - struct SortIntervalLabel : public std::binary_function { + struct SortIntervalLabel { inline bool operator()(TRecord const& s1, TRecord const& s2) const { return s1.lid < s2.lid; } }; - template - struct SortIntervalStart : public std::binary_function { - inline bool operator()(TRecord const& s1, TRecord const& s2) const { - return s1.start < s2.start; - } - }; - inline void _insertInterval(std::vector& cr, int32_t s, int32_t e, char strand, int32_t lid, int32_t) { // Uniqueness not necessary because we flatten the interval map diff --git a/src/hunter.h b/src/hunter.h index d284186..6d9213b 100644 --- a/src/hunter.h +++ b/src/hunter.h @@ -58,12 +58,9 @@ namespace dicey std::string queryalign; DnaHit(int32_t sc, uint32_t const refIndex, uint32_t const s, char const orient, std::string const& ra, std::string const& qa) : score(sc), chr(refIndex), start(s), strand(orient), refalign(ra), queryalign(qa) {} - }; - template - struct SortDnaHit : public std::binary_function { - inline bool operator()(TRecord const& a, TRecord const& b) const { - return ((a.score > b.score) || ((a.score == b.score) && (a.chr < b.chr)) || ((a.score == b.score) && (a.chr == b.chr) && (a.start < b.start))); + bool operator<(const DnaHit& b) const { + return ((score > b.score) || ((score == b.score) && (chr < b.chr)) || ((score == b.score) && (chr == b.chr) && (start < b.start))); } }; @@ -393,7 +390,7 @@ namespace dicey } // Sort - std::sort(ht.begin(), ht.end(), SortDnaHit()); + std::sort(ht.begin(), ht.end()); // Output jsonDnaHitOut(c, seqname, ht, msg); diff --git a/src/silica.h b/src/silica.h index 0082478..069b600 100644 --- a/src/silica.h +++ b/src/silica.h @@ -74,16 +74,13 @@ namespace dicey double temp; double perfTemp; std::string genome; + + bool operator<(const PrimerBind& b) const { + return (temp > b.temp); + } + }; - template - struct SortPrimer : public std::binary_function - { - inline bool operator()(TRecord const& a, TRecord const& b) const { - return (a.temp > b.temp); - } - }; - struct PcrProduct { uint32_t refIndex; uint32_t leng; @@ -94,16 +91,12 @@ namespace dicey double forTemp; double revTemp; double penalty; + + bool operator<(const PcrProduct& b) const { + return (penalty < b.penalty); + } }; - template - struct SortProducts : public std::binary_function - { - inline bool operator()(TRecord const& a, TRecord const& b) const { - return (a.penalty < b.penalty); - } - }; - template inline void writeJsonPrimerOut(TConfig const& c, TStream& rcfile, std::vector const& qn, std::vector const& allp, std::vector const& pcrColl, std::vector const& pName, std::vector const& pSeq, std::vector const& msg) { @@ -588,7 +581,7 @@ namespace dicey } // Sort by temperature - std::sort(allp.begin(), allp.end(), SortPrimer()); + std::sort(allp.begin(), allp.end()); // Search PCR amplicons if (c.pruneprimer) jsonPrimerOut(c, seqname, allp, pcrColl, pName, pSeq, msg); @@ -622,7 +615,7 @@ namespace dicey } // Sort by penalty - std::sort(pcrColl.begin(), pcrColl.end(), SortProducts()); + std::sort(pcrColl.begin(), pcrColl.end()); // Output amplicons jsonPrimerOut(c, seqname, allp, pcrColl, pName, pSeq, msg); diff --git a/src/version.h b/src/version.h index e357ecd..8c222e2 100644 --- a/src/version.h +++ b/src/version.h @@ -5,7 +5,7 @@ namespace dicey { - std::string diceyVersionNumber = "0.3.1"; + std::string diceyVersionNumber = "0.3.2"; inline void printTitle(std::string const& title)