Skip to content

Commit

Permalink
Merge pull request #77 from OndrejSladky/mask-opt-fix
Browse files Browse the repository at this point in the history
Fixed issue with mask optimization and k>15.
  • Loading branch information
OndrejSladky authored Oct 1, 2024
2 parents ccefa59 + 642fa8e commit abbb8ff
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 6 deletions.
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@ all: kmercamel

test: cpptest converttest verify

mask-verify:
./verify.py --k 13 --superstring_path $(DATA)/global-k13c.fa $(DATA)/spneumoniae.fa
./verify.py --k 31 --superstring_path $(DATA)/global-k31c.fa $(DATA)/spneumoniae.fa
./verify.py --k 63 --superstring_path $(DATA)/global-k63c.fa $(DATA)/spneumoniae.fa
./verify.py --k 127 --superstring_path $(DATA)/global-k127c.fa $(DATA)/spneumoniae.fa


verify: verify.py kmercamel
./verify.py $(DATA)/spneumoniae.fa
./verify.py --k 13 --superstring_path $(DATA)/global-k13c.fa $(DATA)/spneumoniae.fa

quick-verify: verify.py kmercamel
./verify.py --quick $(DATA)/spneumoniae.fa
./verify.py --k 13 --superstring_path $(DATA)/global-k13c.fa $(DATA)/spneumoniae.fa

cpptest: kmercameltest kmercameltest-large kmercameltest-extra-large
./kmercameltest
Expand Down
2 changes: 2 additions & 0 deletions data/global-k127c.fa

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions data/global-k31c.fa

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions data/global-k63c.fa

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/masks.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ void PrintMaskConventionWarning() {
"The masked superstring will still represent the same set, but the superstring will differ from the original" <<
" (it will be shorter)." << std::endl <<
" - Ignore the warning if the previous fixes are not suitable" <<
"Ensure that for your masked superstring, k is always explicitly provided and not inferred from the mask.";
"Ensure that for your masked superstring, k is always explicitly provided and not inferred from the mask." << std::endl;
}

/// Return the given character in the correct case corresponding to the mask symbol.
Expand All @@ -47,7 +47,7 @@ void OptimizeOnes(kseq_t* masked_superstring, std::ostream &of, kh_S_t *kMers, k
[[maybe_unused]] kmer_t _, int k,
bool complements, bool minimize) {
kmer_t currentKMer = 0, reverseComplement = 0;
kmer_t mask = (1 << (2 * k)) - 1;
kmer_t mask = ((kmer_t(1)) << (2 * k)) - 1;
kmer_t shift = 2 * (k - 1);
ReprintSequenceHeader(masked_superstring, of);
uint8_t ms_validation = 0;
Expand Down Expand Up @@ -92,7 +92,7 @@ std::pair<size_t, size_t> ReadWriteIntervals(kh_P_t *intervals, kh_S_t *kMers, k
const bool* setIntervals = nullptr) {
bool reading = setIntervals == nullptr;
kmer_t currentKMer = 0, reverseComplement = 0;
kmer_t mask = (1 << (2 * k)) - 1;
kmer_t mask = ((kmer_t(1)) << (2 * k)) - 1;
kmer_t shift = 2 * (k - 1);
size_t currentInterval = 0;
size_t occurrences = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.0
v1.0.2

0 comments on commit abbb8ff

Please sign in to comment.