12#include <sharg/parser.hpp>
14#include <seqan3/io/sequence_file/input.hpp>
18namespace raptor::detail
22 seqan3::detail::valid_file_extensions<typename seqan3::sequence_file_input<>::valid_formats>()};
27#ifdef SEQAN3_HAS_BZIP2
40 if (compression_extensions.empty())
41 return sequence_extensions;
43 for (
auto && sequence_extension : sequence_extensions)
46 for (
auto && compression_extension : compression_extensions)
47 result.push_back(sequence_extension +
std::string{
'.'} + compression_extension);
59 using option_value_type = size_t;
61 void operator()(option_value_type
const & val)
const
64 throw sharg::validation_error{
"The value must be a power of two."};
69 return "Value must be a power of two.";
76 using option_value_type = size_t;
88 void operator()(option_value_type
const & val)
const
90 if (!is_zero_positive && !val)
91 throw sharg::validation_error{
"The value must be a positive integer."};
97 return "Value must be a positive integer or 0.";
99 return "Value must be a positive integer.";
103 bool is_zero_positive{
false};
124 throw sharg::validation_error{
125 seqan3::detail::to_string(
"Value ",
127 " must be an integer followed by [k,m,g,t] (case insensitive).")};
130 template <std::ranges::forward_range range_type>
132 void operator()(range_type
const & v)
const
144 return "Must be an integer followed by [k,m,g,t] (case insensitive).";
166 throw sharg::validation_error{
"The list of input files cannot be empty."};
176 if (is_minimiser_input && (file_path.extension() !=
".minimiser"))
177 throw sharg::validation_error{
"You cannot mix sequence and minimiser files as input."};
179 throw sharg::validation_error{
"The file " + value +
" does not exist."};
181 throw sharg::validation_error{
"The file " + value +
" is empty."};
183 if (is_minimiser_input)
184 minimiser_file_validator(file_path);
193 return seqan3::detail::to_string(
"The file must contain at least one file path per line, with multiple paths "
194 "being separated by a whitespace. Each line in the file corresponds to one "
195 "bin. Valid extensions for the paths in the file are [minimiser] when "
196 " using preprocessed input from \fBraptor prepare\fP, and ",
197 raptor::detail::sequence_extensions,
198#
if defined(SEQAN3_HAS_BZIP2) || defined(SEQAN3_HAS_ZLIB)
199 ", possibly followed by ",
200 raptor::detail::compression_extensions,
206 sharg::input_file_validator minimiser_file_validator{{
"minimiser"}};
231 throw sharg::validation_error{
232 sharg::detail::to_string(
"Failed to create directory\"", out_dir.c_str(),
"\": ", ec.message())};
240 return "A valid path for the output directory.";
244 sharg::output_directory_validator validator{};
263 if (!out_dir.empty())
269 throw sharg::validation_error{
270 sharg::detail::to_string(
"Failed to create directory \"", out_dir.c_str(),
"\": ", ec.message())};
279 return "A valid path for the output file. Write permissions must be granted.";
283 sharg::output_file_validator validator{sharg::output_file_open_options::open_or_create};
289 using base_t = sharg::input_file_validator;
292 using base_t::base_t;
296 return seqan3::detail::to_string(
297 "The input file must exist and read permissions must be granted. Valid file extensions are ",
298 raptor::detail::sequence_extensions,
299#
if defined(SEQAN3_HAS_BZIP2) || defined(SEQAN3_HAS_ZLIB)
300 ", possibly followed by ",
301 raptor::detail::compression_extensions,
Definition validators.hpp:152
Definition validators.hpp:213
Definition validators.hpp:248
Definition validators.hpp:74
Definition validators.hpp:287
Definition validators.hpp:107
T create_directories(T... args)
T has_single_bit(T... args)
Definition validators.hpp:58