Skip to content

Commit

Permalink
Merge pull request #257 from waveygang/mm-index-only
Browse files Browse the repository at this point in the history
allow only creating the index and exiting
  • Loading branch information
ekg authored Jul 2, 2024
2 parents 2cb58b9 + b9677d9 commit 2243583
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/interface/parse_args.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,9 @@ void parse_args(int argc,
//args::ValueFlag<std::string> path_high_frequency_kmers(mapping_opts, "FILE", " input file containing list of high frequency kmers", {'H', "high-freq-kmers"});
//args::ValueFlag<std::string> spaced_seed_params(mapping_opts, "spaced-seeds", "Params to generate spaced seeds <weight_of_seed> <number_of_seeds> <similarity> <region_length> 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<std::string> 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<std::string> 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<std::string> align_input_paf(alignment_opts, "FILE", "derive precise alignments for this input PAF", {'i', "input-paf"});
Expand Down Expand Up @@ -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";
Expand Down
1 change: 1 addition & 0 deletions src/map/include/map_parameters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions src/map/include/winSketch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 2243583

Please sign in to comment.