From 17bcdb6227f8e934e1b1bdb11f6dab842e1a3d4b Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Fri, 29 May 2026 10:51:38 +0200 Subject: [PATCH] Add mean and median sequence length to Basic Statistics Implements #203. The Basic Statistics module currently reports only the range of read lengths; this adds "Mean sequence length" and "Median sequence length" rows so users (and downstream tools such as MultiQC) get accurate values straight from the source rather than estimating them. The mean is total bases / total sequences (2 d.p.); the median is derived from a per-length histogram over non-filtered sequences (for an even count, the two central values averaged and rounded up). Both are added to the ResultsTable model, so they appear in the interactive results panel, the HTML report, and fastqc_data.txt together. Integration test approved files updated accordingly. Co-Authored-By: Claude Opus 4.8 (1M context) --- ...tentsTest_complex_fastqc_data.approved.txt | 2 + ...tsTest_complex_fastqc_report.approved.html | 8 +++ ...tentsTest_minimal_fastqc_data.approved.txt | 2 + ...tsTest_minimal_fastqc_report.approved.html | 8 +++ uk/ac/babraham/FastQC/Modules/BasicStats.java | 63 +++++++++++++++++-- 5 files changed, 78 insertions(+), 5 deletions(-) diff --git a/test/integration/FileContentsTest_complex_fastqc_data.approved.txt b/test/integration/FileContentsTest_complex_fastqc_data.approved.txt index b967956..d4a75e7 100644 --- a/test/integration/FileContentsTest_complex_fastqc_data.approved.txt +++ b/test/integration/FileContentsTest_complex_fastqc_data.approved.txt @@ -8,6 +8,8 @@ Total Sequences 5 Total Bases 80 bp Sequences flagged as poor quality 0 Sequence length 16 +Mean sequence length 16.00 +Median sequence length 16 %GC 50 >>END_MODULE >>Per base sequence quality pass diff --git a/test/integration/FileContentsTest_complex_fastqc_report.approved.html b/test/integration/FileContentsTest_complex_fastqc_report.approved.html index 3e032bd..327775a 100644 --- a/test/integration/FileContentsTest_complex_fastqc_report.approved.html +++ b/test/integration/FileContentsTest_complex_fastqc_report.approved.html @@ -255,6 +255,14 @@

0) { return ""+(((gCount+cCount)*100)/(aCount+tCount+gCount+cCount)); } else { return 0; } - + } } return null;