Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions modules/nextflow/bed2gtf/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
Copyright (c) 2026 The Hiller Lab at the Senckenberg Gessellschaft für Naturforschung
Distributed under the terms of the Apache License, Version 2.0.
*/

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BED2GTF — Convert BED to GTF.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/


process BED2GTF {
tag "$meta.id"
label 'process_low'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'' :
'ghcr.io/alejandrogzi/bed2gtf:latest' }"

input:
tuple val(meta), path(bed)
tuple val(meta1), path(isoforms)

output:
tuple val(meta), path("*.gtf"), optional: true, emit: gtf
tuple val(meta), path("*.gtf.gz"), optional: true, emit: gtf_gz
tuple val(meta), path("*.gff"), optional: true, emit: gff
tuple val(meta), path("*.gff.gz"), optional: true, emit: gff_gz
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when

script:
def args = task.ext.args ?: ''
def format = task.ext.format ?: 'gtf'
def prefix = task.ext.prefix ?: bed.baseName + '.' + format
def isf = isoforms ? "--isoforms ${isoforms}" : ''
"""
bed2gtf \\
$args \\
$isf \\
-T ${task.cpus} \\
-i ${bed} \\
-o $prefix

cat <<-END_VERSIONS > versions.yml
"${task.process}":
bed2gtf: \$(bed2gtf --version | sed -e "s/bed2gtf v//g")
END_VERSIONS
"""

stub:
"""
touch *.gtf
touch *.gtf.gz
touch *.gff
touch *.gff.gz

cat <<-END_VERSIONS > versions.yml
"${task.process}":
bed2gtf: \$(bed2gtf --version | sed -e "s/bed2gtf v//g")
END_VERSIONS
"""
}
6 changes: 3 additions & 3 deletions modules/nextflow/isotools/fusion/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Distributed under the terms of the Apache License, Version 2.0.
*/

process ISOTOOLS_FUSION {
tag "$meta.id:$meta.chr"
tag "$meta.id"
label 'process_low'

conda "${moduleDir}/environment.yml"
Expand All @@ -22,7 +22,7 @@ process ISOTOOLS_FUSION {

input:
tuple val(meta), path(bed)
path(reference)
tuple val(meta1), path(reference)

output:
tuple val(meta), path("*/fusions.bed") , optional: true, emit: fusion
Expand All @@ -35,7 +35,7 @@ process ISOTOOLS_FUSION {

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}_${meta.chr}"
def prefix = task.ext.prefix ?: "${meta.id}"
def queries = (bed instanceof List) ? bed.join(',') : bed
"""
iso-fusion \\
Expand Down
35 changes: 8 additions & 27 deletions modules/nextflow/isotools/orphan/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -23,52 +23,33 @@ process ISOTOOLS_ORPHAN {
input:
tuple val(meta), path(bed)
tuple val(meta1), path(reference)
tuple val(meta2), path(splice_scores)

output:
tuple val(meta), path("*/*.hq.bed") , optional: true, emit: hq
tuple val(meta1), path("*/*.scraps.bed") , optional: true, emit: scraps
path "versions.yml" , emit: versions
tuple val(meta), path("*/*.hq.bed") , optional: true, emit: hq
tuple val(meta_scraps), path("*/*.scraps.bed") , optional: true, emit: scraps
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}"
def scores = splice_scores ? "--splicing-scores $splice_scores" : ''

meta1 = meta.clone()
meta1.id = meta.id.split('.')[0] + '.scraps'
meta_scraps = meta.clone()
meta_scraps.id = meta.id + '.scraps'
"""
cut -f1-12 ${bed} > tmp.bed

iso-orphan \\
$args \\
$scores \\
--ref $reference \\
--query tmp.bed \\
--all \\
--threads ${task.cpus} \\
--prefix ${prefix}

if [ ! -s orphans/${prefix}.hq.bed ]; then
rm orphans/${prefix}.hq.bed
else
grep -f \\
<(cut -f4 orphans/${prefix}.hq.bed) ${bed} \\
> tmp.bed && \\
mv tmp.bed orphans/${prefix}.hq.bed
fi

if [ ! -s orphans/${prefix}.scraps.bed ]; then
rm orphans/${prefix}.scraps.bed
else
grep -f \\
<(cut -f4 orphans/${prefix}.scraps.bed) ${bed} \\
> tmp.bed && \\
mv tmp.bed orphans/${prefix}.scraps.bed
fi

rm tmp.bed

cat <<-END_VERSIONS > versions.yml
"${task.process}":
iso-orphan: \$( iso-orphan --version | sed 's/iso-orphan //g' )
Expand Down
62 changes: 62 additions & 0 deletions modules/wdl/bed2gtf/main.wdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Copyright (c) 2026 The Hiller Lab at the Senckenberg Gessellschaft für Naturforschung
# Distributed under the terms of the Apache License, Version 2.0.

# BED2GTF — Convert BED to GTF.
# Transforms BED format files to GTF/GFF format for compatibility
# with downstream analysis tools.

version 1.3

task bed2gtf {
input {
File bed
File? isoforms
String args = ""
String format = "gtf"
Int cpus = 1
}

String prefix = sub(basename(bed), "\\.bed$", "") + "." + format

command <<<
set -euo pipefail

bed2gtf \
~{args} \
~{"--isoforms " + isoforms} \
-T ~{cpus} \
-i ~{bed} \
-o ~{prefix}
>>>

output {
File gtf = prefix
}

requirements {
container: "ghcr.io/alejandrogzi/bed2gtf:latest"
}
}

workflow run {
input {
File bed
File? isoforms
String args = ""
String format = "gtf"
Int cpus = 1
}

call bed2gtf {
input:
bed = bed,
isoforms = isoforms,
args = args,
format = format,
cpus = cpus
}

output {
File gtf = bed2gtf.gtf
}
}
Loading