Add force alignment option [CW-7274]

This commit is contained in:
Sarah Griffiths 2026-05-26 14:44:50 +00:00
parent 6e72a4538c
commit 3ca4511b5b
7 changed files with 14 additions and 2 deletions

View File

@ -356,6 +356,7 @@ directories:
| threads | integer | Thread count to use for the core workflow processes. | | 4 |
| mod_codes | string | Comma-separated modified base codes to pass to modkit pileup. | Provide values accepted by `modkit pileup --modified-bases`, for example `A:a,C:m`. If omitted, the workflow infers `primary_base:mod_code` pairs from the BAM with `modkit modbam check-tags`. | |
| minimap2_opts | string | Extra command-line options to pass to minimap2. | | |
| force_alignment | boolean | Force re-alignment of input BAM files. | Read alignment is skipped if the existing sequence names in the aligned BAM match the provided reference. Enable this if the existing alignments used incorrect minimap2 presets (e.g. missing --splice or direct RNA settings). | False |
| ndr | number | Optional bambu novel discovery rate override. | | |
| skip_sqanti | boolean | Skip SQANTI3 transcript classification and QC. | | False |
| sqanti_skip_orf | boolean | Skip ORF prediction during SQANTI3 QC. | | True |

View File

@ -52,6 +52,7 @@
| threads | integer | Thread count to use for the core workflow processes. | | 4 |
| mod_codes | string | Comma-separated modified base codes to pass to modkit pileup. | Provide values accepted by `modkit pileup --modified-bases`, for example `A:a,C:m`. If omitted, the workflow infers `primary_base:mod_code` pairs from the BAM with `modkit modbam check-tags`. | |
| minimap2_opts | string | Extra command-line options to pass to minimap2. | | |
| force_alignment | boolean | Force re-alignment of input BAM files. | Read alignment is skipped if the existing sequence names in the aligned BAM match the provided reference. Enable this if the existing alignments used incorrect minimap2 presets (e.g. missing --splice or direct RNA settings). | False |
| ndr | number | Optional bambu novel discovery rate override. | | |
| skip_sqanti | boolean | Skip SQANTI3 transcript classification and QC. | | False |
| sqanti_skip_orf | boolean | Skip ORF prediction during SQANTI3 QC. | | True |

View File

@ -80,7 +80,7 @@ process minimap2_alignment {
path("bamstats_results"),
emit: alignment
script:
String reset_cmd_body = "samtools reset -x tp,cm,s1,s2,NM,MD,AS,SA,ms,nn,ts,cg,cs,dv,de,rl"
String reset_cmd_body = "samtools reset -x tp,cm,s1,s2,NM,MD,AS,SA,ms,nn,ts,cg,cs,dv,de,rl,zd"
String fastq_cmd_body = "samtools fastq -T '*'"
// Default required threads is 6
// Samtools x3 and bamstats will all be single threaded

View File

@ -337,6 +337,7 @@ def fastq_ingress(Map arguments, aln_ref_ch = null)
* - "alignment_threads": number of threads to use for alignment process (default: 6)
* - "output_xam_fmt": alignment output format, `bam` outputs an BAM file with index (.bam, .bai),
`cram` outputs a CRAM file with index (.cram, .crai)
* - "force_alignment": boolean. Run alignment regardless of inputs.
* @param aln_ref_ch: optional channel with a reference tuple (ref, ref_idx) to align against.
* If provided alignment will be attempted if inputs are unaligned or not already aligned to this ref.
* @return: channel of `[Map(alias, barcode, type, ...), Path|null, Path|null]`.
@ -357,6 +358,7 @@ def xam_ingress(Map arguments, aln_ref_ch = null)
"return_fastq": false,
"fastcat_extra_args": "",
"fastq_chunk": null,
"force_alignment": false,
]
)
margs["fastq_chunk"] ?= 0 // cant pass null through channel
@ -427,7 +429,7 @@ def xam_ingress(Map arguments, aln_ref_ch = null)
alignment_fork = ch_check_bams
| branch {
meta, paths ->
to_align: (meta.is_unaligned == true) && (meta.has_reads == true)
to_align: (meta.is_unaligned || margs.force_alignment) && meta.has_reads
noalign: true
}
if (margs["output_xam_fmt"] == "bam"){

View File

@ -304,6 +304,7 @@ workflow {
} else {
samples = xam_ingress([
"input": params.bam,
"force_alignment": params.force_alignment,
] + ingress_args, ref_genome)
}
analysis_samples = samples

View File

@ -27,6 +27,7 @@ params {
mod_codes = null
minimap2_index_opts = ""
minimap2_opts = ""
force_alignment = false
ndr = null
skip_sqanti = false
sqanti_skip_orf = true

View File

@ -194,6 +194,12 @@
"default": "",
"description": "Extra command-line options to pass to minimap2."
},
"force_alignment" : {
"type": "boolean",
"default": false,
"description": "Force re-alignment of input BAM files.",
"help_text": "Read alignment is skipped if the existing sequence names in the aligned BAM match the provided reference. Enable this if the existing alignments used incorrect minimap2 presets (e.g. missing --splice or direct RNA settings)."
},
"ndr": {
"type": "number",
"description": "Optional bambu novel discovery rate override."