12#include <sharg/parser.hpp>
14#include <seqan3/io/sequence_file/input.hpp>
18namespace raptor::detail
31 seqan3::detail::valid_file_extensions<typename seqan3::sequence_file_input<>::valid_formats>()};
41#ifdef SEQAN3_HAS_BZIP2
72 result.
back() += compression_extension;
88 using option_value_type = size_t;
90 void operator()(option_value_type
const & val)
const
93 throw sharg::validation_error{
"The value must be a power of two."};
98 return "Value must be a power of two.";
105 using option_value_type = size_t;
117 void operator()(option_value_type
const & val)
const
119 if (!is_zero_positive && !val)
120 throw sharg::validation_error{
"The value must be a positive integer."};
125 if (is_zero_positive)
126 return "Value must be a positive integer or 0.";
128 return "Value must be a positive integer.";
132 bool is_zero_positive{
false};
153 throw sharg::validation_error{
154 seqan3::detail::to_string(
"Value ",
156 " must be an integer followed by [k,m,g,t] (case insensitive).")};
159 template <std::ranges::forward_range range_type>
161 void operator()(range_type
const & v)
const
173 return "Must be an integer followed by [k,m,g,t] (case insensitive).";
195 throw sharg::validation_error{
"The list of input files cannot be empty."};
205 if (is_minimiser_input && (file_path.extension() !=
".minimiser"))
206 throw sharg::validation_error{
"You cannot mix sequence and minimiser files as input."};
208 throw sharg::validation_error{
"The file " + value +
" does not exist."};
210 throw sharg::validation_error{
"The file " + value +
" is empty."};
212 if (is_minimiser_input)
213 minimiser_file_validator(file_path);
222 return seqan3::detail::to_string(
"The file must contain at least one file path per line, with multiple paths "
223 "being separated by a whitespace. Each line in the file corresponds to one "
224 "bin. Valid extensions for the paths in the file are [minimiser] when "
225 "using preprocessed input from \\fBraptor prepare\\fP, and ",
226 raptor::detail::sequence_extensions(),
227#
if defined(SEQAN3_HAS_BZIP2) || defined(SEQAN3_HAS_ZLIB)
228 ", possibly followed by ",
229 raptor::detail::compression_extensions(),
235 sharg::input_file_validator minimiser_file_validator{{
"minimiser"}};
260 throw sharg::validation_error{
261 sharg::detail::to_string(
"Failed to create directory\"", out_dir.c_str(),
"\": ", ec.message())};
269 return "A valid path for the output directory.";
273 sharg::output_directory_validator validator{};
295 if (!out_dir.empty())
301 throw sharg::validation_error{
302 sharg::detail::to_string(
"Failed to create directory \"", out_dir.c_str(),
"\": ", ec.message())};
311 return "A valid path for the output file. Write permissions must be granted.";
315 sharg::output_file_validator validator{sharg::output_file_open_options::open_or_create};
321 using base_t = sharg::input_file_validator;
324 using base_t::base_t;
328 return seqan3::detail::to_string(
329 "The input file must exist and read permissions must be granted. Valid file extensions are ",
330 raptor::detail::sequence_extensions(),
331#
if defined(SEQAN3_HAS_BZIP2) || defined(SEQAN3_HAS_ZLIB)
332 ", possibly followed by ",
333 raptor::detail::compression_extensions(),
Definition validators.hpp:181
Definition validators.hpp:242
Definition validators.hpp:277
Definition validators.hpp:103
Definition validators.hpp:319
Definition validators.hpp:136
T create_directories(T... args)
T has_single_bit(T... args)
Definition validators.hpp:87
std::vector< std::string > const & compression_extensions()
The valid extensions of a compressed file.
Definition validators.hpp:36
std::vector< std::string > const & combined_extensions()
The valid extensions of a sequence file, including compressed ones.
Definition validators.hpp:54
std::vector< std::string > const & sequence_extensions()
The valid extensions of a sequence file.
Definition validators.hpp:28