Skip to content

Tag the H2009 ONT test uBAM with its read group (merge right after lrsomatic#207) - #5

Merged
ljwharbers merged 2 commits into
mainfrom
rgtagged-ont-ubam
Oct 7, 2026
Merged

ljwharbers merged 2 commits into
mainfrom
rgtagged-ont-ubam

Conversation

@ljwharbers

@ljwharbers ljwharbers commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

Tags every record of data/aligned/headered_H2009_ONT_UL_chr19_downsampled.bam with the read group already declared in its header (RG:Z:df8348f0…_dna_r10.4.1_e8.2_400bps_sup@v5.0.0), as real dorado output does, and replaces the file (+ .bai) in place.

⚠️ Merge only right after IntGenomicsLab/lrsomatic#207 is merged into dev. Before that, dev has no samtools reset -x RG in MINIMAP2_ALIGN: the uBAM's RG tag would be carried through next to the pipeline's -R read group, so dev's aligned BAMs (and their snapshot md5s) change, and every open lrsomatic PR's default test would fail.

Why: lrsomatic #207 drops the uBAM's own RG tag before alignment. Without that, each aligned record carried two RG tags; CRAM keeps one per record, and it kept dorado's, which has no @RG line in the aligned header. None of the test uBAMs had a record-level RG tag (the ONT ones have dorado's @RG in the header only), so no test could see it. This file is sample1's tumour and sample3 in samplesheet_lr-somatic.csv (all -profile test tests) and sample1/3/5 in test_sheet_2.csv (clair_only, which asserts every record's RG is declared in its header).

What: samtools addreplacerg -m overwrite_all -R <ID> --no-PG, re-indexed. 2305 records before and after; read names, sequences, qualities and all other tags are identical; the header is unchanged.

Validated on Mindwell (apptainer): with lrsomatic#207, clair_only passes on the tagged file with its snapshot byte-identical to the untagged run; with -x RG removed, the read-group assertion fails (all 3122 sample3 records carry the undeclared dorado RG) while no snapshot entry changes.

(An earlier version of this PR added the tagged file as a copy plus a test_sheet_2_rgtagged.csv; replaced by tagging the original in place.)

🤖 Generated with Claude Code

Every record of headered_H2009_ONT_UL_chr19_downsampled.bam now carries
RG:Z:<the @rg ID already in its header>, as real dorado output does
(samtools addreplacerg -m overwrite_all -R <ID>). Reads, qualities and all
other tags are unchanged. test_sheet_2_rgtagged.csv is test_sheet_2.csv with
sample3 reading this file.

lrsomatic needs it to regression-test MINIMAP2_ALIGN's `samtools reset -x RG`
(IntGenomicsLab/lrsomatic#207): none of the existing test uBAMs has a
record-level RG tag, so dropping it could not be detected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ljwharbers added a commit to IntGenomicsLab/lrsomatic that referenced this pull request Sep 30, 2026
clair_only now reads test_sheet_2_rgtagged.csv (IntGenomicsLab/test-datasets#5,
must be merged first): test_sheet_2 with sample3's uBAM carrying dorado's RG on
every record, as real dorado output does. None of the existing test uBAMs has a
record-level RG tag, so the read-group assertion could not see a
MINIMAP2_ALIGN that keeps it.

Checked on Mindwell from dd3127f: with -x RG the test passes and the snapshot
is byte-identical to the one from test_sheet_2; with ext.args3 = "" the
read-group assertion fails, with all 3122 sample3 records carrying the
undeclared dorado RG, while no other sample or snapshot entry changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ljwharbers added a commit to IntGenomicsLab/lrsomatic that referenced this pull request Sep 30, 2026
All six pipeline tests pass on Mindwell (apptainer) with 382ba38. The only
change in every snapshot is LONGPHASE_MODCALL's longphase version (2.0.1 ->
2.0.2) plus the timestamp; no output md5 moves. So the chr19 test data is
too small to trigger 2.0.1's CRAM misread, which is why the tests never
showed it. clair_only was run on a local copy of test_sheet_2_rgtagged.csv,
as IntGenomicsLab/test-datasets#5 is not merged yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
headered_H2009_ONT_UL_chr19_downsampled.bam (+ .bai) itself now carries
RG:Z:<its header's dorado @rg ID> on every record, and the separate
_rgtagged copy and test_sheet_2_rgtagged.csv are gone. Every lrsomatic
pipeline test that reads this file (sample1 tumour and sample3 in
samplesheet_lr-somatic.csv, sample1/3/5 in test_sheet_2.csv) now gets an
RG-tagged uBAM, as real dorado output is.

Merge only once IntGenomicsLab/lrsomatic#207 is in dev: without its
`samtools reset -x RG`, the aligned records carry two RG tags and dev's
BAM snapshots change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ljwharbers ljwharbers changed the title Add an RG-tagged copy of the H2009 ONT test uBAM Tag the H2009 ONT test uBAM with its read group (merge right after lrsomatic#207) Oct 1, 2026
@ljwharbers
ljwharbers merged commit be5d0ff into main Oct 7, 2026
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.

1 participant