Skip to content

Commit

Permalink
drop deprecated func
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasrausch committed Sep 20, 2024
1 parent d1e7b56 commit c7ffb2d
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 42 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ bindir ?= $(exec_prefix)/bin

# Flags
CXX ?= g++
CXXFLAGS += -std=c++11 -isystem ${EBROOTHTSLIB} -pedantic -W -Wall -Wno-unknown-pragmas -D__STDC_LIMIT_MACROS -fno-strict-aliasing -fpermissive
CXXFLAGS += -std=c++17 -isystem ${EBROOTHTSLIB} -pedantic -W -Wall -Wno-unknown-pragmas -D__STDC_LIMIT_MACROS -fno-strict-aliasing -fpermissive
LDFLAGS += -L${EBROOTHTSLIB} -lboost_iostreams -lboost_filesystem -lboost_system -lboost_program_options -lboost_date_time

# Flags for static compile
Expand Down
5 changes: 1 addition & 4 deletions src/annotate.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,7 @@ namespace sansa
std::cerr << "Error parsing GTF/GFF3/BED file!" << std::endl;
return 1;
}
for(int32_t refIndex = 0; refIndex < maxRID; ++refIndex) {
// Sort by position
std::sort(gRegions[refIndex].begin(), gRegions[refIndex].end(), SortIntervalStart<IntervalLabel>());
}
for(int32_t refIndex = 0; refIndex < maxRID; ++refIndex) std::sort(gRegions[refIndex].begin(), gRegions[refIndex].end());
}

// Query SV
Expand Down
17 changes: 6 additions & 11 deletions src/compvcf.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,12 @@ namespace sansa

CompSVRecord() : match(0), tid(0), svStart(0), svEnd(0), svLen(0), svt(0), qual(0), consBp(0), score(0), bestMatchId(0), gtConc(0), nonrefGtConc(0), id(""), allele("") {}
CompSVRecord(int32_t const t, int32_t const svS) : match(0), tid(t), svStart(svS), svEnd(0), svLen(0), svt(0), qual(0), consBp(0), score(0), bestMatchId(0), gtConc(0), nonrefGtConc(0), id(""), allele("") {}
};

template<typename TSV>
struct SortCompSVRecord : public std::binary_function<TSV, TSV, bool>
{
inline bool operator()(TSV const& sv1, TSV const& sv2) {
return ((sv1.tid<sv2.tid) || ((sv1.tid==sv2.tid) && (sv1.svStart<sv2.svStart)) || ((sv1.tid==sv2.tid) && (sv1.svStart==sv2.svStart) && (sv1.svEnd<sv2.svEnd)));
bool operator<(const CompSVRecord& sv2) const {
return ((tid<sv2.tid) || ((tid==sv2.tid) && (svStart<sv2.svStart)) || ((tid==sv2.tid) && (svStart==sv2.svStart) && (svEnd<sv2.svEnd)));
}
};



struct CompvcfConfig {
typedef std::map<std::string, uint32_t> TChrMap;
bool filterForPass;
Expand Down Expand Up @@ -100,7 +95,7 @@ namespace sansa
std::cerr << '[' << boost::posix_time::to_simple_string(boost::posix_time::second_clock::local_time()) << "] " << "Comparing " << compsv.size() << " SVs with " << basesv.size() << " SVs in the base VCF/BCF file " << std::endl;
for(uint32_t i = 0; i < basesv.size(); ++i) {
int32_t earliestStart = std::max(basesv[i].svStart - (c.bpdiff + 1), 0);
typename TCompSVType::const_iterator itsv = std::lower_bound(compsv.begin(), compsv.end(), CompSVRecord(basesv[i].tid, earliestStart), SortCompSVRecord<CompSVRecord>());
typename TCompSVType::const_iterator itsv = std::lower_bound(compsv.begin(), compsv.end(), CompSVRecord(basesv[i].tid, earliestStart));
for(uint32_t j = (itsv - compsv.begin()); j < compsv.size(); ++j) {
if (basesv[i].tid < compsv[j].tid) break; // Sorted by tid
if (c.checkCT) {
Expand Down Expand Up @@ -461,8 +456,8 @@ namespace sansa
if (!_loadCompSVs(c, c.vcffile.string(), compsv)) return -1;

// Sort SVs
sort(basesv.begin(), basesv.end(), SortCompSVRecord<CompSVRecord>());
sort(compsv.begin(), compsv.end(), SortCompSVRecord<CompSVRecord>());
sort(basesv.begin(), basesv.end());
sort(compsv.begin(), compsv.end());

// Recall, precission, GT concordance
compareSVs(c, basesv, compsv);
Expand Down
12 changes: 4 additions & 8 deletions src/markdup.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,12 @@ namespace sansa
std::vector<float> vaf;
std::vector<float> gq;
std::vector<int32_t> gt;
};

template<typename TSV>
struct SortSVEvents : public std::binary_function<TSV, TSV, bool>
{
inline bool operator()(TSV const& sv1, TSV const& sv2) {
return ((sv1.tid<sv2.tid) || ((sv1.tid==sv2.tid) && (sv1.svStart<sv2.svStart)) || ((sv1.tid==sv2.tid) && (sv1.svStart==sv2.svStart) && (sv1.svEnd<sv2.svEnd)));
bool operator<(const SVEvent& sv2) const {
return ((tid<sv2.tid) || ((tid==sv2.tid) && (svStart<sv2.svStart)) || ((tid==sv2.tid) && (svStart==sv2.svStart) && (svEnd<sv2.svEnd)));
}
};


struct MarkdupConfig {
bool filterForPass;
Expand Down Expand Up @@ -429,7 +425,7 @@ namespace sansa
if (!_loadSVEvents(c, allsv)) return -1;

// Sort SVs
sort(allsv.begin(), allsv.end(), SortSVEvents<SVEvent>());
sort(allsv.begin(), allsv.end());

// Mark duplicates
_markDuplicates(c, allsv);
Expand Down
2 changes: 1 addition & 1 deletion src/parsedb.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ namespace sansa
bcf_destroy(rec);

// Sort SVs
sort(svs.begin(), svs.end(), SortSVs<SV>());
sort(svs.begin(), svs.end());

// Statistics
now = boost::posix_time::second_clock::local_time();
Expand Down
2 changes: 1 addition & 1 deletion src/query.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ namespace sansa
if (featureContained.empty()) featureContained = "NA";

// Any breakpoint hit?
typename TSV::iterator itSV = std::lower_bound(svs.begin(), svs.end(), SV(qsv.chr, std::max(0, qsv.svStart - c.bpwindow), qsv.chr2, qsv.svEnd), SortSVs<SV>());
typename TSV::iterator itSV = std::lower_bound(svs.begin(), svs.end(), SV(qsv.chr, std::max(0, qsv.svStart - c.bpwindow), qsv.chr2, qsv.svEnd));
int32_t bestID = -1;
float bestScore = -1;
bool noMatch = true;
Expand Down
24 changes: 8 additions & 16 deletions src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,20 @@ namespace sansa

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) {}
};


template<typename TRecord>
struct SortIntervalLabel : public std::binary_function<TRecord, TRecord, bool> {
inline bool operator()(TRecord const& s1, TRecord const& s2) const {
return s1.lid < s2.lid;
bool operator<(const IntervalLabel& s2) const {
return start < s2.start;
}
};


template<typename TRecord>
struct SortIntervalStart : public std::binary_function<TRecord, TRecord, bool> {
struct SortIntervalLabel {
inline bool operator()(TRecord const& s1, TRecord const& s2) const {
return s1.start < s2.start;
return s1.lid < s2.lid;
}
};


inline void
_insertInterval(std::vector<IntervalLabel>& cr, int32_t s, int32_t e, char strand, int32_t lid, int32_t) {
// Uniqueness not necessary because we flatten the interval map
Expand All @@ -69,17 +65,13 @@ namespace sansa
SV(int32_t const c1, int32_t const pos1, int32_t const c2, int32_t pos2) : chr(c1), svStart(pos1), chr2(c2), svEnd(pos2), id(-1), qual(0), svt(-1), svlen(-1) {}

SV(int32_t const c1, int32_t const pos1, int32_t const c2, int32_t pos2, int32_t const ival, int32_t const qval, int32_t const svtval, int32_t const svl) : chr(c1), svStart(pos1), chr2(c2), svEnd(pos2), id(ival), qual(qval), svt(svtval), svlen(svl) {}
};


template<typename TSV>
struct SortSVs : public std::binary_function<TSV, TSV, bool>
{
inline bool operator()(TSV const& sv1, TSV const& sv2) {
return ((sv1.chr<sv2.chr) || ((sv1.chr==sv2.chr) && (sv1.svStart<sv2.svStart)) || ((sv1.chr==sv2.chr) && (sv1.svStart==sv2.svStart) && (sv1.chr2<sv2.chr2)) || ((sv1.chr==sv2.chr) && (sv1.svStart==sv2.svStart) && (sv1.chr2==sv2.chr2) && (sv1.svEnd<sv2.svEnd)) || ((sv1.chr==sv2.chr) && (sv1.svStart==sv2.svStart) && (sv1.chr2==sv2.chr2) && (sv1.svEnd==sv2.svEnd) && (sv1.id < sv2.id)));
bool operator<(const SV& sv2) const {
return ((chr<sv2.chr) || ((chr==sv2.chr) && (svStart<sv2.svStart)) || ((chr==sv2.chr) && (svStart==sv2.svStart) && (chr2<sv2.chr2)) || ((chr==sv2.chr) && (svStart==sv2.svStart) && (chr2==sv2.chr2) && (svEnd<sv2.svEnd)) || ((chr==sv2.chr) && (svStart==sv2.svStart) && (chr2==sv2.chr2) && (svEnd==sv2.svEnd) && (id < sv2.id)));
}
};


inline bool
_translocation(int32_t const svt) {
return (DELLY_SVT_TRANS <= svt) && (svt < 9);
Expand Down

0 comments on commit c7ffb2d

Please sign in to comment.