@@ -26,8 +26,8 @@ ConfigKeyPath inputDirectoryOptionKey() {
2626ConfigKeyPath outputDirectoryOptionKey () {
2727 return YamlFile::stringToConfigKeyPath (" outputDirectory" );
2828}
29- ConfigKeyPath lineageDefinitionsFilenameOptionKey () {
30- return YamlFile::stringToConfigKeyPath (" lineageDefinitionsFilename " );
29+ ConfigKeyPath lineageDefinitionFilenamesOptionKey () {
30+ return YamlFile::stringToConfigKeyPath (" lineageDefinitionFilenames " );
3131}
3232ConfigKeyPath phyloTreeFilenameOptionKey () {
3333 return YamlFile::stringToConfigKeyPath (" phyloTreeFilename" );
@@ -67,9 +67,10 @@ ConfigSpecification InitializeConfig::getConfigSpecification() {
6767 " The path to the directory to hold the output files."
6868 ),
6969 ConfigAttributeSpecification::createWithoutDefault (
70- lineageDefinitionsFilenameOptionKey (),
71- ConfigValueType::PATH ,
72- " File name of the file holding the lineage definitions. Relative from inputDirectory."
70+ lineageDefinitionFilenamesOptionKey (),
71+ ConfigValueType::STRING ,
72+ " Comma separated list of file names holding the lineage definitions. This can also be "
73+ " a Sequence in YAML. Relative from inputDirectory."
7374 ),
7475 ConfigAttributeSpecification::createWithoutDefault (
7576 phyloTreeFilenameOptionKey (),
@@ -108,10 +109,22 @@ std::filesystem::path InitializationFiles::getDatabaseConfigFilename() const {
108109 return directory / database_config_file;
109110}
110111
111- std::optional<std::filesystem::path> InitializationFiles::getLineageDefinitionsFilename () const {
112- return lineage_definitions_file.has_value ()
113- ? std::optional (directory / lineage_definitions_file.value ())
114- : std::nullopt ;
112+ std::vector<std::filesystem::path> InitializationFiles::getLineageDefinitionFilenames () const {
113+ if (not lineage_definition_files.has_value ()) {
114+ return {};
115+ }
116+ auto comma_separated_string = lineage_definition_files.value ();
117+ std::vector<std::filesystem::path> filenames;
118+ std::stringstream ss (comma_separated_string);
119+ std::string item;
120+
121+ while (std::getline (ss, item, ' ,' )) {
122+ if (!item.empty ()) {
123+ filenames.emplace_back (directory / item);
124+ }
125+ }
126+
127+ return filenames;
115128}
116129
117130std::optional<std::filesystem::path> InitializationFiles::getPhyloTreeFilename () const {
@@ -128,8 +141,8 @@ void InitializeConfig::overwriteFrom(const VerifiedConfigAttributes& config_sour
128141 if (auto var = config_source.getPath (inputDirectoryOptionKey ())) {
129142 initialization_files.directory = var.value ();
130143 }
131- if (auto var = config_source.getPath ( lineageDefinitionsFilenameOptionKey ())) {
132- initialization_files.lineage_definitions_file = var.value ();
144+ if (auto var = config_source.getString ( lineageDefinitionFilenamesOptionKey ())) {
145+ initialization_files.lineage_definition_files = var.value ();
133146 }
134147 if (auto var = config_source.getPath (phyloTreeFilenameOptionKey ())) {
135148 initialization_files.phylogenetic_tree_file = var.value ();
0 commit comments