From d1a5a0cf0b5556b371e12d1de16498e53fefbd13 Mon Sep 17 00:00:00 2001 From: Faith Okamoto <52177356+faithokamoto@users.noreply.github.com> Date: Thu, 16 Jan 2025 12:56:49 -0800 Subject: [PATCH] Create --add-identity option --- src/subcommand/inject_main.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/subcommand/inject_main.cpp b/src/subcommand/inject_main.cpp index 0194077443..b31a569892 100644 --- a/src/subcommand/inject_main.cpp +++ b/src/subcommand/inject_main.cpp @@ -29,6 +29,7 @@ void help_inject(char** argv) { << endl << "options:" << endl << " -x, --xg-name FILE use this graph or xg index (required, non-XG formats also accepted)" << endl + << " -i, --add-identity add the 'identity' statistic (\% of matching base pairs) to output GAM" << endl << " -r, --rescore re-score alignments" << endl << " -o, --output-format NAME output the alignments in NAME format (gam / gaf / json) [gam]" << endl << " -t, --threads N number of threads to use" << endl; @@ -41,6 +42,7 @@ int main_inject(int argc, char** argv) { } string xg_name; + bool add_identity = false; bool rescore = false; string output_format = "GAM"; std::set output_formats = { "GAM", "GAF", "JSON" }; @@ -53,6 +55,7 @@ int main_inject(int argc, char** argv) { { {"help", no_argument, 0, 'h'}, {"xg-name", required_argument, 0, 'x'}, + {"add-identity", no_argument, 0, 'i'}, {"rescore", no_argument, 0, 'r'}, {"output-format", required_argument, 0, 'o'}, {"threads", required_argument, 0, 't'}, @@ -86,6 +89,10 @@ int main_inject(int argc, char** argv) { } break; + case 'i': + add_identity = true; + break; + case 'r': rescore = true; break; @@ -126,6 +133,10 @@ int main_inject(int argc, char** argv) { function lambda = [&](Alignment& aln) { set_crash_context(aln.name()); + if (add_identity) { + // Calculate & save identity statistic + aln.set_identity(identity(aln.path())); + } if (rescore) { // Rescore the alignment aln.set_score(aligner.score_contiguous_alignment(aln));