@@ -117,6 +117,22 @@ class bin_validator
117117 {
118118 if (value.extension () == " .minimiser" )
119119 minimiser_file_validator (value);
120+ else if (values.size () == 1u )
121+ {
122+ std::ifstream list_of_files{value};
123+ std::string line;
124+ while (std::getline (list_of_files, line))
125+ {
126+ if (!line.empty ())
127+ {
128+ std::filesystem::path bin_path{line};
129+ if (bin_path.extension () == " .minimiser" )
130+ minimiser_file_validator (bin_path);
131+ else
132+ sequence_file_validator (bin_path);
133+ }
134+ }
135+ }
120136 else
121137 throw exception;
122138 }
@@ -131,9 +147,10 @@ class bin_validator
131147
132148 std::string get_help_page_message () const
133149 {
134- return " The input file must exist and read permissions must be granted. Valid file extensions are: [minimiser],"
135- " or [embl, fasta, fa, fna, ffn, faa, frn, fas, fastq, fq, genbank, gb, gbk, sam] possibly followed by: "
136- " [gz, bgzf, bz2]." ;
150+ return " The input file must exist and read permissions must be granted. Valid file extensions for bin files are"
151+ " : [minimiser], or [embl, fasta, fa, fna, ffn, faa, frn, fas, fastq, fq, genbank, gb, gbk, sam] "
152+ " possibly followed by: [gz, bgzf, bz2]. All other extensions will be assumed to contain one line per"
153+ " path to a bin." ;
137154 }
138155
139156private:
@@ -148,7 +165,7 @@ inline void init_shared_meta(seqan3::argument_parser & parser)
148165 parser.info .citation = " Seiler, E. et al. (2020). Raptor: A fast and space-efficient pre-filter for"
149166 " querying very large collections of nucleotide sequences. bioRxiv 2020.10.08.330985. doi:"
150167 " https://doi.org/10.1101/2020.10.08.330985" ;
151- parser.info .date = " 12-10 -2020" ;
168+ parser.info .date = " 16-12 -2020" ;
152169 parser.info .email = " enrico.seiler@fu-berlin.de" ;
153170 parser.info .long_copyright = R"( BSD 3-Clause License
154171
@@ -182,7 +199,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)";
182199 parser.info .short_copyright = " BSD 3-Clause License" ;
183200 parser.info .short_description = " A fast and space-efficient pre-filter for querying very large collections of nucleotide sequences." ;
184201 parser.info .url = " https://github.com/seqan/raptor" ;
185- parser.info .version = " 1.0.2 " ;
202+ parser.info .version = " 1.1.0 " ;
186203}
187204
188205void init_top_level_parser (seqan3::argument_parser & parser)
@@ -229,7 +246,8 @@ inline void init_build_parser(seqan3::argument_parser & parser, build_arguments
229246 init_shared_meta (parser);
230247 init_shared_options (parser, arguments);
231248 parser.add_positional_option (arguments.bin_path ,
232- " Provide a list of input files. One file per bin. " ,
249+ " Provide a list of input files (one file per bin). Alternatively, provide a text file "
250+ " containing the paths to the bins (one line per path to a bin). " ,
233251 bin_validator{});
234252 parser.add_option (arguments.out_path ,
235253 ' \0 ' ,
@@ -319,6 +337,34 @@ void run_build(seqan3::argument_parser & parser)
319337 init_build_parser (parser, arguments);
320338 try_parsing (parser);
321339
340+ // ==========================================
341+ // Process bin_path
342+ // ==========================================
343+ if (arguments.bin_path .size () == 1u ) // Either only one bin or a file containing bin paths
344+ {
345+ auto & file = arguments.bin_path [0 ];
346+
347+ if (file.extension () != " .minimiser" )
348+ {
349+ try
350+ {
351+ seqan3::input_file_validator<seqan3::sequence_file_input<>> validator;
352+ validator (file);
353+ }
354+ catch (seqan3::validation_error const & exception)
355+ {
356+ decltype (arguments.bin_path ) new_values;
357+ std::ifstream list_of_files{file};
358+ std::string line;
359+ while (std::getline (list_of_files, line))
360+ new_values.emplace_back (line);
361+ while (new_values.back ().empty ())
362+ new_values.pop_back ();
363+ arguments.bin_path = std::move (new_values);
364+ }
365+ }
366+ }
367+
322368 // ==========================================
323369 // Various checks.
324370 // ==========================================
0 commit comments