Align with dorado's native --reference aligner instead of piping SAM to minimap2

htslib rejected minimap2's re-emitted dorado SAM records on the runner
('CIGAR and query sequence are of different length'), killing the
label_pod5_batch pipe. dorado aligns during basecalling (--reference
<mmi> + --mm2-opts '-x map-ont -N 10'), is documented to cost no
basecalling throughput, and its own writer preserves the per-record
BC/RG barcode tags that bam2annotation needs for source_run. The rocm
fallback keeps the fastq->minimap2 chain.
This commit is contained in:
Tom Kasper
2026-10-16 20:03:34 +01:00
parent 49f1f396c6
commit 2ce1435a96
2 changed files with 15 additions and 13 deletions
+2 -1
View File
@@ -17,7 +17,8 @@ hac_min_q: 9 # "" or 0 to disable
fast_model_name: "dna_r10.4.1_e8.2_400bps_fast@v5.2.0" # v2 alignment baseline
fast_benchmarks_file: "" # add path if available
fast_min_q: 8 # "" or 0 to disable
minimap_extra: "-N 10" # secondary alignments kept for label-QC visibility
minimap_extra: "-N 10" # minimap2 secondary alignments kept for label-QC visibility (rocm branch)
dorado_mm2_opts: "-x map-ont -N 10" # mm2 options for dorado's native aligner (--reference; overrides the lr:hq default)
# dataset wiring
pod5_dataset: "nomiss_96BC_P2I_SUP_2026"
+13 -12
View File
@@ -1,14 +1,16 @@
"""Data pipeline: pod5 download -> dorado basecall (+ barcode classification)
-> alignment to the panel -> merged BAM per (dataset, model).
"""Data pipeline: pod5 download -> dorado basecall (+ barcode classification,
native alignment via --reference) -> merged BAM per (dataset, model).
The 'hac' arm supplies the probe labels (stores); the 'fast' arm is the E1-v2
alignment baseline (dorad-fast + minimap2 + LCA). On CUDA the label job
threads dorado's classified SAM (per-read barcode tags from --kit-name)
straight into minimap2 (tags survive alignment, verified on minimap2 2.31)
and samtools view; per-batch BAMs are merged per (dataset, model). On ROCm
(slorado, non-barcode) the original fastq->align->bam chain is kept as the
fallback; barcodes are then unavailable and labels fall back to the dataset
name as source_run.
alignment baseline (dorado-fast + minimap2 + LCA). On CUDA, alignment runs
inside dorado (--reference <mmi> + --mm2-opts): the external
minimap2-over-SAM pipe was dropped because htslib rejected minimap2's
re-emitted dorado records ("CIGAR and query sequence are of different
length"); dorado's own aligned writer keeps the per-record BC/RG barcode
tags that bam2annotation needs for source_run. Per-batch BAMs are merged
per (dataset, model) with samtools cat. On ROCm (slorado, non-barcode) the
fastq->minimap2->bam chain is kept as the fallback; barcodes are then
unavailable and labels fall back to the dataset name as source_run.
Host prerequisites: dorado on PATH, aws cli, curl; --resources gpu=N serialises
the GPU label jobs.
@@ -142,13 +144,12 @@ if GPU_STACK == "cuda":
benchmarking=get_benchmarking_file,
min_q=get_qscore,
kit_flag=get_kit_flag,
minimap_extra=config["minimap_extra"],
mm2_opts=config["dorado_mm2_opts"],
conda:
"../envs/minimap.yaml"
shell:
"""
dorado basecaller --models-directory {config[dorado_model_dir]} --emit-sam {params.benchmarking} {params.min_q} {params.kit_flag} {params.dorado_model} {input.pod5} \
| minimap2 -a -x map-ont {params.minimap_extra} -t {threads} {input.ref} - \
dorado basecaller --models-directory {config[dorado_model_dir]} --emit-sam {params.benchmarking} {params.min_q} {params.kit_flag} --reference {input.ref} --mm2-opts "{params.mm2_opts}" {params.dorado_model} {input.pod5} \
| samtools view -b -@ {threads} > {output}
"""