Skip to content

Commit

Permalink
Merge pull request #4495 from vgteam/vg-inject-identity
Browse files Browse the repository at this point in the history
Create --add-identity option
  • Loading branch information
faithokamoto authored Jan 22, 2025
2 parents 834a1f6 + d1a5a0c commit b09617f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/subcommand/inject_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<std::string> output_formats = { "GAM", "GAF", "JSON" };
Expand All @@ -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'},
Expand Down Expand Up @@ -86,6 +89,10 @@ int main_inject(int argc, char** argv) {
}
break;

case 'i':
add_identity = true;
break;

case 'r':
rescore = true;
break;
Expand Down Expand Up @@ -126,6 +133,10 @@ int main_inject(int argc, char** argv) {

function<void(Alignment&)> 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));
Expand Down

1 comment on commit b09617f

@adamnovak
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vg CI tests complete for merge to master. View the full report here.

16 tests passed, 0 tests failed and 0 tests skipped in 17423 seconds

Please sign in to comment.