Skip to content

Commit

Permalink
Find IBF bin size for a genome minimiser set
Browse files Browse the repository at this point in the history
  • Loading branch information
eaasna committed Apr 10, 2024
1 parent 43b9c49 commit 1f6509e
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 28 deletions.
2 changes: 1 addition & 1 deletion include/utilities/threshold/basics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,6 @@ inline uint64_t combinations(size_t const k, size_t const n)
return 0;
}

enum class search_kind {LEMMA, HEURISTIC, STELLAR};
enum class search_kind {LEMMA, HEURISTIC, MINIMISER, STELLAR};

} //namespace valik
3 changes: 2 additions & 1 deletion include/valik/search/search_local.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,11 @@ bool search_local(search_arguments & arguments, search_time_statistics & time_st

std::cout << "\n-----------Search parameters-----------\n";
std::cout << "kmer size " << std::to_string(arguments.shape_size) << '\n';
std::cout << "window size " << std::to_string(arguments.window_size) << '\n';
switch (arguments.search_type)
{
case search_kind::LEMMA: std::cout << "k-mer lemma "; break;
//case search_kind::MINIMISER: std::cout << "minimiser "; break;
case search_kind::MINIMISER: std::cout << "minimiser "; break;
case search_kind::HEURISTIC: std::cout << "heuristic "; break;
default: break;
}
Expand Down
52 changes: 26 additions & 26 deletions src/argument_parsing/build.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,32 +112,6 @@ void run_build(sharg::parser & parser)
arguments.window_size = search_profile.k;
}

// ==========================================
// Various checks.
// ==========================================
if (parser.is_option_set("kmer-count-cutoff") && parser.is_option_set("use-filesize-dependent-cutoff"))
throw sharg::parser_error{"You cannot use both --kmer-count-cutoff and --use-filesize-dependent-cutoff."};

if (parser.is_option_set("window"))
{
if (arguments.kmer_size > arguments.window_size)
throw sharg::parser_error{"The k-mer size cannot be bigger than the window size."};
}
else
{
if (arguments.fast)
{
arguments.window_size = arguments.kmer_size + 2;
raptor::compute_minimiser(arguments);
arguments.input_is_minimiser = true;
}
else
arguments.window_size = arguments.kmer_size;
}

arguments.shape = seqan3::shape{seqan3::ungapped{arguments.kmer_size}};
arguments.shape_weight = arguments.shape.count();

// ==========================================
// Process bin_path:
// if building from clustered sequences each line in input corresponds to a bin
Expand Down Expand Up @@ -167,6 +141,32 @@ void run_build(sharg::parser & parser)
}
}

// ==========================================
// Process minimiser parameters for IBF size calculation.
// ==========================================
if (parser.is_option_set("kmer-count-cutoff") && parser.is_option_set("use-filesize-dependent-cutoff"))
throw sharg::parser_error{"You cannot use both --kmer-count-cutoff and --use-filesize-dependent-cutoff."};

arguments.shape = seqan3::shape{seqan3::ungapped{arguments.kmer_size}};
arguments.shape_weight = arguments.shape.count();

if (parser.is_option_set("window"))
{
if (arguments.kmer_size > arguments.window_size)
throw sharg::parser_error{"The k-mer size cannot be bigger than the window size."};
}
else
{
if (arguments.fast)
{
arguments.window_size = arguments.kmer_size + 2;
raptor::compute_minimiser(arguments);
arguments.input_is_minimiser = true;
}
else
arguments.window_size = arguments.kmer_size;
}

try
{
sharg::output_file_validator{sharg::output_file_open_options::open_or_create}(arguments.out_path);
Expand Down
3 changes: 3 additions & 0 deletions src/argument_parsing/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,9 @@ void run_search(sharg::parser & parser)
arguments.threshold_percentage = arguments.threshold / (double) (arguments.pattern_size - arguments.shape.size() + 1);
arguments.fnr = error_profile.fnr;
}

if (arguments.window_size > arguments.shape_size)
arguments.search_type = search_kind::MINIMISER;
}

// ==========================================
Expand Down
1 change: 1 addition & 0 deletions src/prepare/compute_bin_size.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/

#include <utilities/prepare/compute_bin_size.hpp>
#include <seqan3/core/debug_stream.hpp>

namespace raptor
{
Expand Down

0 comments on commit 1f6509e

Please sign in to comment.