-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpreprocessing_config.h
84 lines (63 loc) · 2.51 KB
/
preprocessing_config.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#pragma once
#include <cstdint>
#include <filesystem>
#include <optional>
#include <string>
#include <string_view>
#include <unordered_map>
#include <Poco/Util/OptionSet.h>
#include <fmt/format.h>
#include "config/config_interface.h"
#include "config/source/yaml_file.h"
#include "silo/common/json_type_definitions.h"
#include "silo/config/config_defaults.h"
namespace silo::config {
class PreprocessingConfig {
friend class fmt::formatter<silo::config::PreprocessingConfig>;
PreprocessingConfig() = default;
std::optional<uint32_t> duckdb_memory_limit_in_g;
std::optional<std::filesystem::path> lineage_definitions_file;
std::filesystem::path database_config_file;
std::filesystem::path reference_genome_file;
public:
std::filesystem::path input_directory;
std::filesystem::path output_directory;
std::filesystem::path intermediate_results_directory;
std::optional<std::filesystem::path> ndjson_input_filename;
std::optional<std::filesystem::path> preprocessing_database_location;
/// Create PreprocessingConfig with all default values from the specification
static PreprocessingConfig withDefaults();
static ConfigSpecification getConfigSpecification();
void validate() const;
[[nodiscard]] std::filesystem::path getDatabaseConfigFilename() const;
[[nodiscard]] std::optional<std::filesystem::path> getLineageDefinitionsFilename() const;
[[nodiscard]] std::filesystem::path getReferenceGenomeFilename() const;
[[nodiscard]] std::optional<std::filesystem::path> getNdjsonInputFilename() const;
[[nodiscard]] std::optional<uint32_t> getDuckdbMemoryLimitInG() const;
void overwriteFrom(const VerifiedConfigAttributes& config_source);
[[nodiscard]] static std::vector<std::filesystem::path> getConfigFilePaths(
const VerifiedCommandLineArguments& cmd_source,
const VerifiedConfigAttributes& env_source
);
NLOHMANN_DEFINE_TYPE_INTRUSIVE(
PreprocessingConfig,
input_directory,
output_directory,
intermediate_results_directory,
preprocessing_database_location,
duckdb_memory_limit_in_g,
lineage_definitions_file,
ndjson_input_filename,
database_config_file,
reference_genome_file
)
};
} // namespace silo::config
template <>
struct [[maybe_unused]] fmt::formatter<silo::config::PreprocessingConfig>
: fmt::formatter<std::string> {
[[maybe_unused]] static auto format(
const silo::config::PreprocessingConfig& preprocessing_config,
format_context& ctx
) -> decltype(ctx.out());
};