Skip to content

Commit

Permalink
fix: validate that either a ndjson or tsv file was given as input
Browse files Browse the repository at this point in the history
  • Loading branch information
Taepper committed Sep 12, 2024
1 parent fad0618 commit 7bf2ef7
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/silo/config/preprocessing_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,21 @@ void PreprocessingConfig::validate() const {
if (!std::filesystem::exists(input_directory)) {
throw preprocessing::PreprocessingException(input_directory.string() + " does not exist");
}
if (ndjson_input_filename.has_value() && metadata_file) {
if (ndjson_input_filename.has_value() && metadata_file.has_value()) {
throw preprocessing::PreprocessingException(fmt::format(
"Cannot specify both a ndjsonInputFilename ('{}') and metadataFilename('{}').",
ndjson_input_filename.value().string(),
metadata_file.value().string()
));
}
if (!ndjson_input_filename.has_value() && !metadata_file.has_value()) {
throw preprocessing::PreprocessingException(fmt::format(
"Neither a ndjsonInputFilename ('{}') nor a metadataFilename ('{}') was specified as "
"preprocessing option.",
NDJSON_INPUT_FILENAME_OPTION.toCamelCase(),
METADATA_FILENAME_OPTION.toCamelCase()
));
}
}

std::filesystem::path PreprocessingConfig::getOutputDirectory() const {
Expand Down Expand Up @@ -211,7 +219,7 @@ void PreprocessingConfig::overwrite(const silo::config::AbstractConfigSource& co
ctx.out(),
"{{ input directory: '{}', pango_lineage_definition_file: {}, output_directory: '{}', "
"metadata_file: '{}', reference_genome_file: '{}', gene_file_prefix: '{}', "
"nucleotide_sequence_file_prefix: '{}', unalgined_nucleotide_sequence_file_prefix: '{}', "
"nucleotide_sequence_file_prefix: '{}', unaligned_nucleotide_sequence_file_prefix: '{}', "
"ndjson_filename: {}, "
"preprocessing_database_location: {} }}",
preprocessing_config.input_directory.string(),
Expand Down

0 comments on commit 7bf2ef7

Please sign in to comment.