diff --git a/.vscode/launch.json b/.vscode/launch.json index 5315e07..6aa53df 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -14,6 +14,8 @@ "args": [ "-v", "-d", + "-l", + "1000000", "-f", "sam", "-i", diff --git a/Program.cs b/Program.cs index 80b5bba..6732278 100644 --- a/Program.cs +++ b/Program.cs @@ -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}%)"); } }); }