Skip to content

Commit

Permalink
sshash with checking for cfseg supported
Browse files Browse the repository at this point in the history
  • Loading branch information
NPSDC committed Jul 26, 2024
1 parent 691e26a commit a5b662a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
10 changes: 5 additions & 5 deletions src/build.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ int build(int argc, char** argv) {
bool check = parser.get<bool>("check");
if (check) {
check_correctness_lookup_access(dict, input_filename, fmt);
// check_correctness_navigational_kmer_query(dict, input_filename, fmt);
// check_correctness_navigational_contig_query(dict);
// if (build_config.weighted) check_correctness_weights(dict, input_filename);
// check_correctness_kmer_iterator(dict);
// check_correctness_contig_iterator(dict);
check_correctness_navigational_kmer_query(dict, input_filename, fmt);
check_correctness_navigational_contig_query(dict);
if (build_config.weighted) check_correctness_weights(dict, input_filename);
check_correctness_kmer_iterator(dict);
check_correctness_contig_iterator(dict);
}
bool bench = parser.get<bool>("bench");
if (bench) {
Expand Down
20 changes: 9 additions & 11 deletions src/check_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ bool check_correctness_lookup_access(std::istream& is, dictionary const& dict, s
std::string expected_kmer_str(k, 0);

std::cout << "checking correctness of access and positive lookup..." << std::endl;

while (appendline(is, line)) {
// std::getline(is, line);
sequence.clear();
if (fmt == "fasta") {
std::cout << "pos " << line[0] << std::endl;
if (line.size() == pos || line[pos] == '>' || line[pos] == ';') {
// comment or empty line restart the term buffer
line.clear();
Expand All @@ -62,7 +62,6 @@ bool check_correctness_lookup_access(std::istream& is, dictionary const& dict, s
[](char c) { return std::tolower(c); });
}
++num_lines;
std::cout << "seq " << sequence << std::endl;
for (uint64_t i = 0; i + k <= sequence.size(); ++i) {
assert(util::is_valid(sequence.data() + i, k));

Expand Down Expand Up @@ -172,9 +171,9 @@ bool check_correctness_lookup_access(std::istream& is, dictionary const& dict, s
++num_kmers;
}
if (sequence.size() > k - 1) {
std::copy(sequence.data() + sequence.size() - (k - 1), sequence.data() + sequence.size(), sequence.data());
sequence.resize(k - 1);
pos = sequence.size();
std::copy(line.data() + line.size() - (k - 1), line.data() + line.size(), line.data());
line.resize(k - 1);
pos = line.size();
} else {
pos = 0;
}
Expand All @@ -195,7 +194,7 @@ bool check_correctness_navigational_kmer_query(std::istream& is,
std::string sequence;

std::cout << "checking correctness of navigational queries for kmers..." << std::endl;
while (!is.eof()) {
while (appendline(is, line)) {
std::getline(is, line);
if (fmt == "fasta") {
if (line.size() == pos || line[pos] == '>' || line[pos] == ';') {
Expand Down Expand Up @@ -279,9 +278,9 @@ bool check_correctness_navigational_kmer_query(std::istream& is,
++num_kmers;
}
if (sequence.size() > k - 1) {
std::copy(sequence.data() + sequence.size() - (k - 1), sequence.data() + sequence.size(), sequence.data());
sequence.resize(k - 1);
pos = sequence.size();
std::copy(line.data() + line.size() - (k - 1), line.data() + line.size(), line.data());
line.resize(k - 1);
pos = line.size();
} else {
pos = 0;
}
Expand Down Expand Up @@ -344,7 +343,6 @@ bool check_correctness_weights(std::istream& is, dictionary const& dict) {

while (!is.eof()) {
std::getline(is, line); // header line
std::cout << "line is " << line << std::endl;

if (line.empty()) break;

Expand Down

0 comments on commit a5b662a

Please sign in to comment.