Skip to content

Return a nonzero exit status for detected paired-end read-count mismatches - #719

Open
thierrygosselin wants to merge 2 commits into
OpenGene:masterfrom
thierrygosselin:fix-paired-read-count-mismatch
Open

thierrygosselin wants to merge 2 commits into
OpenGene:masterfrom
thierrygosselin:fix-paired-read-count-mismatch

Conversation

@thierrygosselin

Copy link
Copy Markdown

Summary

When paired input packs contain different numbers of reads, fastp currently warns, discards unmatched reads, and can finish with exit status 0.

This PR changes the existing mismatch check to fail explicitly and identify both input files.

Changes

  • Use error_exit() when paired-pack counts differ.
  • Preserve the existing pack-count diagnostics.
  • Include both input filenames in the fatal error.

Regression tests

Added synthetic tests covering:

  • Both shorter-mate directions.
  • Counts around the 1,000-read pack boundary.
  • Inputs exceeding 40,000 reads.
  • One and four processing threads.
  • Equal inputs and intentional --reads_to_process limits.

Run with:

python3 scripts/test_paired_read_counts.py ./fastp

On macOS ARM64, all 20 cases pass with the patch. Unmodified Conda fastp 1.3.6 returns success for all 12 unequal-input cases.

Relationship to #694

Related to #694: this addresses failure reporting when a count mismatch is detected. I did not reproduce the historical hang in these tests, so this PR does not claim to resolve every deadlock scenario described there.

Scope

This patch concerns the existing count check for separate paired-end files. It does not validate read identifiers, change interleaved input handling, or scan beyond an intentional processing limit.

Linux execution has not been tested.

Replace the warning-and-stop behaviour at the existing paired-pack
count check with an explicit error and nonzero exit status.

Include both input filenames in the error message instead of silently
discarding unmatched reads.

This addresses detected count mismatches in separate paired-end files.
It does not add identifier validation or change interleaved input handling.
Test both shorter-mate directions around pack boundaries and with
inputs exceeding 40,000 reads, using one and four threads.

Require a nonzero exit status and an explicit count-mismatch diagnostic.
Verify that equal inputs and intentional reads_to_process limits
continue to succeed.

All 20 cases pass with the fix. Unmodified Conda fastp 1.3.6 returns
success for all 12 unequal-input cases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant