Emit per-batch CRAM from dorado's native aligner; drop the merge step

--emit-cram (reference FASTA required) shrinks the per-chunk alignment
artifacts to roughly half of BAM, and the label job now consumes the
per-batch CRAMs directly, so the dataset-sized merged BAM intermediate
is gone entirely. pysam opens the CRAMs with reference_filename; the
rocm fallback keeps the fastq->minimap2->bam chain and the merged BAM.
This commit is contained in:
Tom Kasper
2026-10-16 20:05:43 +01:00
parent 2ce1435a96
commit b53ddf0962
4 changed files with 95 additions and 89 deletions
+16 -1
View File
@@ -134,9 +134,24 @@ wildcard_constraints:
stride=r"4|8",
model="hac|fast"
def label_alignments(w):
"""Input function: alignment artifacts feeding the label parquet.
CUDA branch: the per-batch CRAMs written by dorado's native aligner
(consumed directly, no merge step -> no dataset-sized intermediate).
ROCm fallback: the single merged BAM from the fastq->minimap2 chain.
"""
if GPU_STACK == "cuda":
return [
f"../data/aligned_reads/{w.dataset}/{w.model}/{run_name(w.dataset)}_{b}.cram"
for b in batch_names(w.dataset)
]
return f"../data/aligned_reads/{w.dataset}_{w.model}_to_genome.bam"
rule prepare_read_labels:
input:
bamfile="../data/aligned_reads/{dataset}_{model}_to_genome.bam",
alignments=label_alignments,
reference="../data/reference_genomes/full_reference.fasta",
output:
"../data/ml_inputs/{dataset}_{model}_label_store.pq",