Skip to content

Commit

Permalink
fixing percent complete on read-limited runs
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljon committed May 18, 2022
1 parent 8cb8113 commit 29819cb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
"args": [
"-v",
"-d",
"-l",
"1000000",
"-f",
"sam",
"-i",
Expand Down
12 changes: 11 additions & 1 deletion Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,17 @@ private void Run()
{
if (sequenceReader.SequencesRead % UpdatePeriod == 0)
{
Console.Error.WriteLine($"{sequenceReader.SequencesRead.WithSsiUnits()} sequences completed ({sequenceReader.ApproximateCompletion:0.0}%)");
var approximateCompletion = sequenceReader.ApproximateCompletion;

// if we're limiting the number of reads then the reader's
// approximation will be incorrect (it's based on file positions),
// so we'll do the math ourselves
if (Settings.ReadLimit < ulong.MaxValue)
{
approximateCompletion = 100.0 * (double)sequenceReader.SequencesRead / (double)Settings.ReadLimit;
}

Console.Error.WriteLine($"{sequenceReader.SequencesRead.WithSsiUnits()} sequences completed ({approximateCompletion:0.0}%)");
}
});
}
Expand Down

0 comments on commit 29819cb

Please sign in to comment.