From c38a976b66151cf0a5420ffeed488ebc4911c047 Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Fri, 29 May 2026 11:10:57 +0200 Subject: [PATCH] Refine mean/median sequence length output Builds on the mean/median sequence length feature (#203): - Report Mean Length to 1 decimal place rather than truncating to an integer, so e.g. a 150.7 bp mean is no longer shown as 150. - Calculate the median with standard tie-breaking: for an even number of reads, average the two central values and round up, rather than taking only the upper-middle value. - Update the FileContentsTest approved snapshots (data + HTML) for the new rows. HTML snapshots are edited in place so the embedded chart images are left untouched. Co-Authored-By: Claude Opus 4.8 (1M context) --- ...tentsTest_complex_fastqc_data.approved.txt | 3 +- ...tsTest_complex_fastqc_report.approved.html | 10 ++++-- ...tentsTest_minimal_fastqc_data.approved.txt | 3 +- ...tsTest_minimal_fastqc_report.approved.html | 10 ++++-- uk/ac/babraham/FastQC/Modules/BasicStats.java | 4 ++- .../Modules/SequenceLengthDistribution.java | 36 +++++++++++-------- 6 files changed, 43 insertions(+), 23 deletions(-) diff --git a/test/integration/FileContentsTest_complex_fastqc_data.approved.txt b/test/integration/FileContentsTest_complex_fastqc_data.approved.txt index b967956..bac5c2c 100644 --- a/test/integration/FileContentsTest_complex_fastqc_data.approved.txt +++ b/test/integration/FileContentsTest_complex_fastqc_data.approved.txt @@ -6,8 +6,9 @@ File type Conventional base calls Encoding Illumina 1.5 Total Sequences 5 Total Bases 80 bp -Sequences flagged as poor quality 0 Sequence length 16 +Mean Length 16.0 +Median 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..a1cea06 100644 --- a/test/integration/FileContentsTest_complex_fastqc_report.approved.html +++ b/test/integration/FileContentsTest_complex_fastqc_report.approved.html @@ -248,11 +248,15 @@

rank50) { - return(i); - } - runningCount += lengthCounts[i]; + if (runningCount > rank) { + return i; + } } - - throw new RuntimeException("Should never fail to find a value above the 50th percentile"); - } - + throw new RuntimeException("Should never fail to find a value above the rank"); + } + private synchronized void calculateDistribution () { int maxLen = 0; int minLen = -1;