Skip to content

adding parsing of the adapter_dimer field, for when it is present#10

Merged
bwlang merged 3 commits into
mainfrom
fastp_dimer
Jun 30, 2026
Merged

adding parsing of the adapter_dimer field, for when it is present#10
bwlang merged 3 commits into
mainfrom
fastp_dimer

Conversation

@mattsoup

Copy link
Copy Markdown
Contributor

No description provided.

@github-actions

Copy link
Copy Markdown
Contributor
file coverage covered missed_lines
src/bin/fastp-merge.rs 0.00% 0 / 23 24-54
src/fastp.rs 93.50% 633 / 677 72, 89, 107, 122-123, 146, 166, 266, 276, 309-311, 330, 427-429, 433, 436-437, 484, 594, 600, 611, 617, 643, 649, 652, 656-657, 659, 713, 719, 725, 762, 799, 805-807, 811-814, 817-818
src/lib.rs 92.20% 532 / 577 64, 72, 74, 77, 79, 135-137, 213, 230, 232, 242, 244, 250, 252, 264, 410, 414-418, 438-439, 443, 457, 461, 472, 541, 545, 572-577, 579-580, 583, 630, 636, 642, 659, 667, 686, 698
src/main.rs 0.00% 0 / 27 34-77

Total coverage: 89.34%

@github-actions

Copy link
Copy Markdown
Contributor

Benchmark Results

Benchmark Throughput Summary
============================

fastq/small_500kb: 31.71 MiB/s (15036770 ns/iter)
fastq/medium_1mb: 31.85 MiB/s (29940184 ns/iter)
fastq/large_5mb: 31.98 MiB/s (149100367 ns/iter)
bam/small_500kb: 16.72 MiB/s (28523801 ns/iter)
bam/medium_1mb: 16.73 MiB/s (56994645 ns/iter)
bam/large_5mb: 16.48 MiB/s (289354556 ns/iter)

Full details available in the workflow artifacts.

@github-actions

Copy link
Copy Markdown
Contributor
file coverage covered missed_lines
src/bin/fastp-merge.rs 0.00% 0 / 23 24-54
src/fastp.rs 94.36% 653 / 692 72, 89, 107, 122-123, 146, 166, 259-260, 303, 343-344, 440, 443, 475, 488-489, 594, 611, 614, 624, 627, 642, 650, 656, 731, 761-762, 800, 806, 810-813, 819-825
src/lib.rs 92.20% 532 / 577 64, 72, 74, 77, 79, 135-137, 213, 230, 232, 242, 244, 250, 252, 264, 410, 414-418, 438-439, 443, 457, 461, 472, 541, 545, 572-577, 579-580, 583, 630, 636, 642, 659, 667, 686, 698
src/main.rs 0.00% 0 / 27 34-77

Total coverage: 89.84%

@github-actions

Copy link
Copy Markdown
Contributor

Benchmark Results

Benchmark Throughput Summary
============================

fastq/small_500kb: 31.20 MiB/s (15284982 ns/iter)
fastq/medium_1mb: 31.22 MiB/s (30543495 ns/iter)
fastq/large_5mb: 31.40 MiB/s (151865721 ns/iter)
bam/small_500kb: 16.57 MiB/s (28768879 ns/iter)
bam/medium_1mb: 16.70 MiB/s (57098240 ns/iter)
bam/large_5mb: 16.47 MiB/s (289490332 ns/iter)

Full details available in the workflow artifacts.

@github-actions

Copy link
Copy Markdown
Contributor
file coverage covered missed_lines
src/bin/fastp-merge.rs 0.00% 0 / 23 24-54
src/fastp.rs 94.91% 653 / 688 72, 89, 107, 122-123, 146, 166, 259-260, 271, 431, 439-440, 443, 488, 490, 611, 614, 649, 654, 686, 698, 719, 731, 761, 773, 799, 809-812, 818-824
src/lib.rs 92.20% 532 / 577 64, 72, 74, 77, 79, 135-137, 213, 230, 232, 242, 244, 250, 252, 264, 410, 414-418, 438-439, 443, 457, 461, 472, 541, 545, 572-577, 579-580, 583, 630, 636, 642, 659, 667, 686, 698
src/main.rs 0.00% 0 / 27 34-77

Total coverage: 90.11%

@github-actions

Copy link
Copy Markdown
Contributor

Benchmark Results

Benchmark Throughput Summary
============================

fastq/small_500kb: 30.03 MiB/s (15879165 ns/iter)
fastq/medium_1mb: 30.16 MiB/s (31616313 ns/iter)
fastq/large_5mb: 30.66 MiB/s (155522188 ns/iter)
bam/small_500kb: 15.51 MiB/s (30748877 ns/iter)
bam/medium_1mb: 15.53 MiB/s (61423874 ns/iter)
bam/large_5mb: 15.29 MiB/s (311836527 ns/iter)

Full details available in the workflow artifacts.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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_reads to filtering_result merging 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_reads sum 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 thread tests/fastp_test.rs
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));
}
@bwlang
bwlang merged commit 187fb8c into main Jun 30, 2026
4 checks passed
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.

3 participants