adding parsing of the adapter_dimer field, for when it is present#10
Merged
Conversation
Contributor
Total coverage: 89.34% |
Contributor
Benchmark ResultsFull details available in the workflow artifacts. |
Contributor
Total coverage: 89.84% |
Contributor
Benchmark ResultsFull details available in the workflow artifacts. |
Contributor
Total coverage: 90.11% |
Contributor
Benchmark ResultsFull details available in the workflow artifacts. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the fastp JSON merger to recognize and correctly merge the newer adapter_dimer_reads counter in filtering_result, while keeping output compatible with older fastp JSON that lacks the field.
Changes:
- Add
adapter_dimer_readstofiltering_resultmerging when present, and omit it when absent across all chunks. - Update fixture JSON files to include
adapter_dimer_reads. - Extend tests to validate the merged
adapter_dimer_readssum and confirm key ordering matches fastp output.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/fixtures/fastp_chunk2.json | Adds adapter_dimer_reads to the fixture’s filtering_result. |
| tests/fixtures/fastp_chunk1.json | Adds adapter_dimer_reads to the fixture’s filtering_result. |
| tests/fastp_test.rs | Asserts merged adapter_dimer_reads, verifies key ordering, and adds a test for omission when absent. |
| src/fastp.rs | Implements conditional merge/omit behavior for adapter_dimer_reads in merge_filtering_result. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+214
to
236
| #[test] | ||
| fn test_merge_filtering_result_omits_adapter_dimer_when_absent() { | ||
| // Older fastp versions predate adapter_dimer_reads; merging must not invent it. | ||
| let chunk = json!({ | ||
| "summary": { | ||
| "before_filtering": {"total_reads": 10, "total_bases": 100, "q20_bases": 90, "q30_bases": 80}, | ||
| "after_filtering": {"total_reads": 10, "total_bases": 100, "q20_bases": 90, "q30_bases": 80} | ||
| }, | ||
| "filtering_result": { | ||
| "passed_filter_reads": 10, | ||
| "low_quality_reads": 0, | ||
| "too_many_N_reads": 0, | ||
| "too_short_reads": 0, | ||
| "too_long_reads": 0 | ||
| }, | ||
| "duplication": {"rate": 0.0}, | ||
| "adapter_cutting": {"adapter_trimmed_reads": 0, "adapter_trimmed_bases": 0} | ||
| }); | ||
| let merged = merge_jsons(&[chunk.clone(), chunk]).expect("merge should succeed"); | ||
| let fr = &merged["filtering_result"]; | ||
| assert!(fr.get("adapter_dimer_reads").is_none()); | ||
| assert_eq!(fr["passed_filter_reads"].as_i64(), Some(20)); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.