From 4276e7469c21204ab5c6605129a5f4095eeb4613 Mon Sep 17 00:00:00 2001 From: Benjamin Buchfink Date: Mon, 20 Feb 2023 10:57:47 +0100 Subject: [PATCH] Fixed LTO issue, ppos output fields in realign. --- src/ChangeLog | 4 ++++ src/basic/match.h | 2 ++ src/masking/masking.h | 3 ++- src/masking/motifs.cpp | 13 +++++++++++-- src/run/main.cpp | 1 + 5 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index b0d150e2..f7399b86 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -23,6 +23,10 @@ `--iterate` option to activate linear-time feature. - Added the option `--linsearch` to activate linear-time feature for the search workflows. +- Fixed a bug that caused the `ppos` and `positive` output fields not to work + for the `realign` workflow. +- Fixed an issue that caused motif masking not to work when compiled with link + time optimization. [2.1.1] - Fixed compilation errors on non-x86 systems and for the clang compiler. diff --git a/src/basic/match.h b/src/basic/match.h index b5e6f4dd..4401e9c5 100644 --- a/src/basic/match.h +++ b/src/basic/match.h @@ -451,6 +451,7 @@ struct TypeSerializer { buf_->write(h.subject_len); buf_->write(h.identities()); buf_->write(h.mismatches()); + buf_->write(h.positives()); buf_->write(h.gaps()); buf_->write(h.length()); buf_->write(h.gap_openings()); @@ -488,6 +489,7 @@ struct TypeDeserializer { file_->read(h.subject_len); file_->read(h.hsp_.identities); file_->read(h.hsp_.mismatches); + file_->read(h.hsp_.positives); file_->read(h.hsp_.gaps); file_->read(h.hsp_.length); file_->read(h.hsp_.gap_openings); diff --git a/src/masking/masking.h b/src/masking/masking.h index 0010834a..f972675d 100644 --- a/src/masking/masking.h +++ b/src/masking/masking.h @@ -103,4 +103,5 @@ struct MaskingTable { }; const size_t MOTIF_LEN = 8; -extern const std::unordered_set, Kmer::Hash> motif_table; \ No newline at end of file +extern std::unordered_set, Kmer::Hash> motif_table; +void init_motif_table(); \ No newline at end of file diff --git a/src/masking/motifs.cpp b/src/masking/motifs.cpp index b1e7edc8..e278e977 100644 --- a/src/masking/motifs.cpp +++ b/src/masking/motifs.cpp @@ -1,6 +1,8 @@ #include "masking.h" -const std::unordered_set, Kmer::Hash> motif_table = { +std::unordered_set, Kmer::Hash> motif_table; + +static const char motif_strings[][9] = { "FRKYTAFT", "KYTAFTIP", "RKYTAFTI", @@ -8001,4 +8003,11 @@ const std::unordered_set, Kmer::Hash> motif_table = { "EYRLYLDA", "YRLYLDAY", "QFHQKLLK",*/ -}; \ No newline at end of file +}; + +void init_motif_table() { + const auto n = sizeof(motif_strings) / sizeof(motif_strings[0]); + motif_table.reserve(n); + for (size_t i = 0; i < n; ++i) + motif_table.insert(motif_strings[i]); +} \ No newline at end of file diff --git a/src/run/main.cpp b/src/run/main.cpp index 840ac412..c06308dd 100644 --- a/src/run/main.cpp +++ b/src/run/main.cpp @@ -90,6 +90,7 @@ namespace Incremental { int main(int ac, const char* av[]) { try { + init_motif_table(); CommandLineParser parser; config = Config(ac, av, true, parser);