Merge branch 'template-updates-sorting' into 'dev'

Template updates: sort threads param

See merge request epi2melabs/workflows/wf-transcriptomes!311
This commit is contained in:
Natalia Garcia 2026-05-27 11:59:12 +00:00
commit c96be955b5
3 changed files with 8 additions and 4 deletions

View File

@ -93,7 +93,7 @@ process minimap2_alignment {
def fastq_input_cmd = "touch reads.header && fastcat --reheader reads/*"
def bam_or_fastq_input = params.bam ? bam_input_cmd : fastq_input_cmd
def minimap2_opts = bsargs["minimap2_opts"]
def sort_threads = bsargs["sort_threads"]
"""
rm -rf bamstats_results
mkdir bamstats_results
@ -103,7 +103,7 @@ process minimap2_alignment {
| workflow-glue reheader_samstream reads.header \
--insert \$'@PG\\tID:reset\\tPN:samtools\\tCL:${reset_cmd_body}' \
--insert \$'@PG\\tID:fastq\\tPN:samtools\\tCL:${fastq_cmd_body}' \
| samtools sort -u -O BAM - \
| samtools sort -@ ${sort_threads} -u -O BAM - \
| tee >(samtools view --reference ${reference} \
--write-index -o reads.${align_ext}##idx##reads.${align_ext}.${index_ext} -) \
| bamstats -s ${meta.alias} -u \

View File

@ -182,6 +182,7 @@ def add_number_of_reads_to_meta(ch, String input_type_format) {
* - "alignment_threads": number of threads to use for alignment process (default: 6)
* - "output_xam_fmt": alignment output format, `bam` outputs a BAM file with index (.bam, .bai),
`cram` outputs a CRAM file with index (.cram, .crai)
* - "sort_threads": number of threads to use for sorting aligned reads (default: 1)
* @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]`.
@ -337,6 +338,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)
* - "sort_threads": number of threads to use for sorting aligned reads (default: 1)
* - "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.
@ -985,7 +987,8 @@ Map parse_arguments(String func_name, Map arguments, Map extra_kwargs=[:]) {
"minimap2_memory": ["8GB", "15GB", "31GB"],
"minimap2_opts": "-x lr:hq",
"alignment_threads": 6,
"output_xam_fmt": "bam" // or cram
"output_xam_fmt": "bam", // or cram
"sort_threads": 1 // TODO hook this up for ingress sorts as well
]
ArgumentParser parser = new ArgumentParser(
args: required_args,

View File

@ -232,6 +232,7 @@ workflow {
"analyse_fail": params.analyse_fail,
"fastcat_extra_args": "",
"required_sample_types": [],
"sort_threads": 3,
]
if (params.fastq) {