From b9677d92d6bafe1013a66507eced05f158303045 Mon Sep 17 00:00:00 2001 From: Erik Garrison Date: Tue, 2 Jul 2024 09:46:13 +0200 Subject: [PATCH] allow only creating the index and exiting --- src/interface/parse_args.hpp | 6 ++++-- src/map/include/map_parameters.hpp | 1 + src/map/include/winSketch.hpp | 5 +++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/interface/parse_args.hpp b/src/interface/parse_args.hpp index d61b8749..957dd363 100644 --- a/src/interface/parse_args.hpp +++ b/src/interface/parse_args.hpp @@ -99,8 +99,9 @@ void parse_args(int argc, //args::ValueFlag path_high_frequency_kmers(mapping_opts, "FILE", " input file containing list of high frequency kmers", {'H', "high-freq-kmers"}); //args::ValueFlag spaced_seed_params(mapping_opts, "spaced-seeds", "Params to generate spaced seeds e.g \"10 5 0.75 20\"", {'e', "spaced-seeds"}); args::Flag no_merge(mapping_opts, "no-merge", "don't merge consecutive segment-level mappings", {'M', "no-merge"}); - args::ValueFlag mashmap_index(mapping_opts, "FILE", "Use MashMap index if FILE exists, else create one and save as FILE", {'4', "mm-index"}); - args::Flag overwrite_mashmap_index(mapping_opts, "", "Confidence value for the hypergeometric filtering [default: 99.9%]", {'5', "overwrite-mm-index"}); + args::ValueFlag mashmap_index(mapping_opts, "FILE", "Use MashMap index in FILE, create if it doesn't exist", {"mm-index"}); + args::Flag create_mashmap_index_only(mapping_opts, "create-index-only", "Create only the index file without performing mapping", {"create-index-only"}); + args::Flag overwrite_mashmap_index(mapping_opts, "overwrite-mm-index", "Overwrite MashMap index if it exists", {"overwrite-mm-index"}); args::Group alignment_opts(parser, "[ Alignment Options ]"); args::ValueFlag align_input_paf(alignment_opts, "FILE", "derive precise alignments for this input PAF", {'i', "input-paf"}); @@ -621,6 +622,7 @@ void parse_args(int argc, } map_parameters.overwrite_index = overwrite_mashmap_index; + map_parameters.create_index_only = create_mashmap_index_only; if (approx_mapping) { map_parameters.outFileName = "/dev/stdout"; diff --git a/src/map/include/map_parameters.hpp b/src/map/include/map_parameters.hpp index 77343c4f..9e38944f 100644 --- a/src/map/include/map_parameters.hpp +++ b/src/map/include/map_parameters.hpp @@ -54,6 +54,7 @@ struct Parameters std::string outFileName; //output file name stdfs::path indexFilename; //output file name of index bool overwrite_index; //overwrite index if it exists + bool create_index_only; //only create index and exit bool split; //Split read mapping (done if this is true) bool lower_triangular; // set to true if we should filter out half of the mappings bool skip_self; //skip self mappings diff --git a/src/map/include/winSketch.hpp b/src/map/include/winSketch.hpp index 3a07f337..1777d58c 100644 --- a/src/map/include/winSketch.hpp +++ b/src/map/include/winSketch.hpp @@ -139,6 +139,11 @@ namespace skch { this->writeIndex(); } + if (param.create_index_only) + { + std::cerr << "[mashmap::skch::Sketch] Index created successfully. Exiting." << std::endl; + exit(0); + } } else { this->build(false); this->readIndex();