diff --git a/modules/nextflow/isotools/align/main.nf b/modules/nextflow/isotools/align/main.nf new file mode 100644 index 0000000..358ddb2 --- /dev/null +++ b/modules/nextflow/isotools/align/main.nf @@ -0,0 +1,66 @@ +/* +Copyright (c) 2026 The Hiller Lab at the Senckenberg Gessellschaft für Naturforschung +Distributed under the terms of the Apache License, Version 2.0. +*/ + +/* +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ISOTOOLS_ALIGN — Select long reads whose pass-1 split alignment suggests a + re-align with a larger minimap2 intron cap, and emit them as FASTA / FASTQ / names. +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +*/ + +process ISOTOOLS_ALIGN { + tag "$meta.id" + label 'custom_process_low' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + '' : + 'ghcr.io/alejandrogzi/isotools:latest' }" + + input: + tuple val(meta), path(bam), path(bai) + + output: + tuple val(meta), path("*.fragments.fasta"), optional: true, emit: fasta + tuple val(meta), path("*.report.tsv"), optional: true, emit: report + path "versions.yml", emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + iso-align \\ + $args \\ + --threads ${task.cpus} \\ + --bam $bam \\ + --output ${prefix}.fragments.fasta \\ + --output-format fasta \\ + --report ${prefix}.report.tsv + + if [ ! -s ${prefix}.fragments.fasta ]; then + rm ${prefix}.fragments.fasta + fi + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + iso-align: \$( iso-align --version | sed 's/iso-align //g' ) + END_VERSIONS + """ + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.fragments.fasta + touch ${prefix}.report.tsv + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + iso-align: \$( iso-align --version | sed 's/iso-align //g' ) + END_VERSIONS + """ +} diff --git a/modules/wdl/isotools/align/main.wdl b/modules/wdl/isotools/align/main.wdl new file mode 100644 index 0000000..9b4c37c --- /dev/null +++ b/modules/wdl/isotools/align/main.wdl @@ -0,0 +1,61 @@ +# Copyright (c) 2026 The Hiller Lab at the Senckenberg Gessellschaft für Naturforschung +# Distributed under the terms of the Apache License, Version 2.0. + +# ISOTOOLS_ALIGN — Select long reads whose pass-1 split alignment suggests a +# re-align with a larger minimap2 intron cap, and emit them as FASTA / FASTQ / names. + +version 1.3 + +task align { + input { + File bam + File bai + String args = "" + String prefix = sub(basename(bam), "\\.bam$", "") + } + + command <<< + set -euo pipefail + + iso-align \ + ~{args} \ + --threads ~{cpus} \ + --bam ~{bam} \ + --output ~{prefix}.fragments.fasta \ + --output-format fasta \ + --report ~{prefix}.report.tsv + + if [ ! -s ~{prefix}.fragments.fasta ]; then + rm ~{prefix}.fragments.fasta + fi + >>> + + output { + File? fragments = prefix + ".fragments.fasta" + File? report = prefix + ".report.tsv" + } + + requirements { + container: "ghcr.io/alejandrogzi/isotools:latest" + } +} + +workflow run { + input { + File bam + File bai + String args = "" + } + + call align { + input: + bam = bam, + bai = bai, + args = args + } + + output { + File? fragments = align.fragments + File? report = align.report + } +}