Add Scaffold N50 and Contig N50 to the assembly summary report - #6
Merged
Conversation
printSummary now reports Scaffold N50 (over path/scaffold sizes) and Contig N50 (over gap-split contig lengths), next to the existing Total gaps line. computeSummaryCounts accumulates per-path scaffold and contig lengths; a small computeN50() helper returns the standard N50. Adds scripts/test_n50.sh and a test-n50 make target validating both on a crafted two-scaffold, one-gap assembly.
The Scaffold N50 / Contig N50 additions to the assembly summary report change every report-bearing golden .tst. Regenerated via teloscope-generate-tests (make all); same command-hash filenames, only the two N50 lines added. val.sh now passes 227/0.
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.
Summary
Adds Scaffold N50 and Contig N50 to the per-assembly summary report (
*_report.tsv/ stdout), next to the existingTotal gapsline. This completes the structural-QC fields Teloscope already emits (gaps, scaffold length) so downstream analyses can read N50 straight from the freeze instead of a separate gfastats pass.Details
computeSummaryCounts()accumulates per-path scaffold lengths (pathData.pathSize) and contig lengths (path runs split atgapInfos).computeN50()helper returns the standard N50 (sort desc, length crossing 50% of total).gfalibssubmodule change.Report
Tests
scripts/test_n50.sh(+make test-n50): two-scaffold, one-gap assembly → asserts Scaffold N50 = 1650, Contig N50 = 800.make test-gapsregression: 12/12 pass.