Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e349b36
added new portello module
sofiademmou Apr 2, 2026
3d96a2d
fixed linting
sofiademmou Apr 2, 2026
4ce59f3
added snapshots for every test
sofiademmou Apr 2, 2026
8ca28c1
removed comments
sofiademmou Apr 2, 2026
1bb77f0
put all input in same tuple and updated snapshots and meta
sofiademmou Apr 7, 2026
bf6ee8d
Merge branch 'master' into portello
sofiademmou Apr 7, 2026
de592e9
put all inputs in one tuple
sofiademmou Apr 9, 2026
2bb0a67
replaced big setup with nf-core dataset
sofiademmou Apr 9, 2026
3d8873c
Merge branch 'portello' of github.com:sofiademmou/modules into portello
sofiademmou Apr 9, 2026
c14b136
Merge branch 'master' into portello
sofiademmou Apr 9, 2026
0ef0fbb
updated meta
sofiademmou Apr 9, 2026
4887f58
Merge branch 'portello' of github.com:sofiademmou/modules into portello
sofiademmou Apr 9, 2026
c0ea5c4
Update modules/nf-core/portello/meta.yml
sofiademmou Apr 9, 2026
633af72
Update modules/nf-core/portello/main.nf
sofiademmou Apr 9, 2026
212d1cc
Update modules/nf-core/portello/main.nf
sofiademmou Apr 9, 2026
068f4f0
updated version emission
sofiademmou Apr 9, 2026
5bdae62
added missing ontologies and licence URL
sofiademmou Apr 9, 2026
5a2b020
Merge branch 'master' into portello
sofiademmou Apr 9, 2026
4041d95
fixed linting
sofiademmou Apr 9, 2026
d34acbd
Merge branch 'portello' of github.com:sofiademmou/modules into portello
sofiademmou Apr 9, 2026
216ef51
removed unused setup and added md5 in snapshots
sofiademmou Apr 9, 2026
7690f4e
Merge branch 'master' into portello
sofiademmou Apr 9, 2026
e456107
fixed linting problem in snapshots
sofiademmou Apr 9, 2026
20b8a2d
Merge branch 'portello' of github.com:sofiademmou/modules into portello
sofiademmou Apr 9, 2026
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
5 changes: 5 additions & 0 deletions modules/nf-core/portello/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
channels:
- conda-forge
- bioconda
dependencies:
- "bioconda::portello=0.7.0"
51 changes: 51 additions & 0 deletions modules/nf-core/portello/main.nf
Comment thread
sofiademmou marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
process PORTELLO {
tag "${meta.id}"
label 'process_high'

conda "${moduleDir}/environment.yml"
container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container
? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/b7/b7a7ecbc4e475e2b0a339facbda324068cab503a58261d6a235169ce04bf25d8/data'
: 'community.wave.seqera.io/library/portello:0.7.0--e30f230f4d2812dd'}"

input:
tuple val(meta), path(asm_to_ref_bam), path(asm_to_ref_bai), path(read_to_asm_bam), path(read_to_asm_bai), path(ref_fasta), val(assembly_mode), val(output_vcf)

output:
tuple val(meta), path("*_remapped.bam"), emit: bam
tuple val(meta), path("*_unassembled.bam"), emit: unassembled_bam
tuple val(meta), path("*.vcf.gz"), emit: vcf, optional: true
tuple val(meta), path("*.vcf.gz.tbi"), emit: tbi, optional: true
tuple val("${task.process}"), val('portello'), eval("portello --version | sed -e 's/portello //'"), topic: versions, emit: versions_portello

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

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def vcf_output = output_vcf ? "--phased-het-vcf-prefix ${prefix}" : ""
"""
portello \
${args} \
--threads ${task.cpus} \
--ref ${ref_fasta} \
--assembly-to-ref ${asm_to_ref_bam} \
--read-to-assembly ${read_to_asm_bam} \
--input-assembly-mode ${assembly_mode} \
--unassembled-read-output ${prefix}_unassembled.bam \
${vcf_output} \
--remapped-read-output ${prefix}_remapped.bam
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def vcf_output = output_vcf ? "echo | gzip -c > ${prefix}.vcf.gz; touch ${prefix}.vcf.gz.tbi" : ''
"""
echo ${args}

${vcf_output}
touch ${prefix}_unassembled.bam
touch ${prefix}_remapped.bam
"""
}
142 changes: 142 additions & 0 deletions modules/nf-core/portello/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
name: "portello"
description: Transfer HiFi read mappings from their own assembly contigs to a
standard reference
keywords:
- assembly
- transfer
- pacbio
- genomics
tools:
- "portello":
description: "Method to transfer HiFi read mappings from de novo assembly to reference"
homepage: "https://github.com/PacificBiosciences/portello"
documentation: "https://github.com/PacificBiosciences/portello"
tool_dev_url: "https://github.com/PacificBiosciences/portello"
licence:
- "Pacific Biosciences Software License (https://github.com/PacificBiosciences/portello/blob/main/LICENSE.md)"
identifier: biotools:portello
input:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1' ]`
- asm_to_ref_bam:
type: file
description: Assembly contig to reference genome alignment file in
BAM/CRAM format
pattern: "*.{bam,cram}"
ontologies:
- edam: "http://edamontology.org/format_2572"
- edam: "http://edamontology.org/format_2573"
- asm_to_ref_bai:
type: file
description: BAM/CRAM index file
pattern: "*.{bam.bai,cram.crai}"
ontologies:
- edam: "http://edamontology.org/format_2572"
- edam: "http://edamontology.org/format_2573"
- read_to_asm_bam:
type: file
description: Read to assembly alignment file in BAM/CRAM format
pattern: "*.{bam,cram}"
ontologies:
- edam: "http://edamontology.org/format_2572"
- edam: "http://edamontology.org/format_2573"
- read_to_asm_bai:
type: file
description: BAM/CRAM/SAM index file
pattern: "*.{bam,cram}.bai"
ontologies:
- edam: "http://edamontology.org/format_2572"
- edam: "http://edamontology.org/format_2573"
- ref_fasta:
type: file
description: Reference genome FASTA file
pattern: "*.fa*"
ontologies:
- edam: "http://edamontology.org/format_1929"
- assembly_mode:
type: string
description: The assembly mode used for the input BAM files
enum:
- fully-phased
- partially-phased
- output_vcf:
type: boolean
description: Whether to output phased variant calls in VCF format
output:
bam:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1' ]`
- "*_remapped.bam":
type: file
description: Remapped BAM file
pattern: "*_remapped.{bam}"
ontologies:
- edam: "http://edamontology.org/format_2572"
unassembled_bam:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1' ]`
- "*_unassembled.bam":
type: file
description: Unassembled BAM file
pattern: "*_unassembled.{bam}"
ontologies:
- edam: "http://edamontology.org/format_2572"
vcf:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1' ]`
- "*.vcf.gz":
type: file
description: VCF file with phased heterozygous small variant calls from
the input assembly contigs
pattern: "*.{vcf.gz}"
ontologies:
- edam: "http://edamontology.org/format_3989"
tbi:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1' ]`
- "*.vcf.gz.tbi":
type: file
description: VCF index file
pattern: "*.{vcf.gz.tbi}"
ontologies:
- edam: "http://edamontology.org/format_3616"
versions_portello:
- - ${task.process}:
type: string
description: The name of the process
- portello:
type: string
description: The name of the tool
- portello --version | sed -e 's/portello //':
type: eval
description: The expression to obtain the version of the tool
topics:
versions:
- - ${task.process}:
type: string
description: The name of the process
- portello:
type: string
description: The name of the tool
- portello --version | sed -e 's/portello //':
type: eval
description: The expression to obtain the version of the tool
authors:
- "@sofiademmou"
maintainers:
- "@sofiademmou"
185 changes: 185 additions & 0 deletions modules/nf-core/portello/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
nextflow_process {

name "Test Process PORTELLO"
script "../main.nf"
process "PORTELLO"

tag "modules"
tag "modules_nfcore"
tag "portello"

test("portello - [bam, bai, bam, bai], fasta, partially-phased, false") {
when {
process {
"""
input[0] = [
[ id:'test'], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/test_hifi_aligned_assembly.bam'),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/test_hifi_aligned_assembly.bam.bai'),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/test_hifi_aligned_to_assembly.bam'),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/test_hifi_aligned_to_assembly.bam.bai'),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome3.fasta', checkIfExists: true),
"partially-phased",
false
]
"""
}
}

then {
assert process.success
assert snapshot(
process.out.bam.collect { meta, bam_file -> [ meta, file(bam_file).name + ":md5," + bam(bam_file, stringency: "silent").getReadsMD5() ] },
// no unmapped reads in the test, so only check file name here (empty file)
process.out.unassembled_bam.collect { meta, bam_file -> [ meta, file(bam_file).name ] },
process.out.findAll { key, val -> key.startsWith('versions') }
).match()
}
}


test("portello - [bam, bai, bam, bai], fasta, partially-phased, true") {
when {
process {
"""
input[0] = [
[ id:'test'], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/test_hifi_aligned_assembly.bam'),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/test_hifi_aligned_assembly.bam.bai'),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/test_hifi_aligned_to_assembly.bam'),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/test_hifi_aligned_to_assembly.bam.bai'),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome3.fasta', checkIfExists: true),
"partially-phased",
true
]
"""
}
}

then {
assert process.success
assert snapshot(
process.out.bam.collect { meta, bam_file -> [ meta, file(bam_file).name + ":md5," + bam(bam_file, stringency: "silent").getReadsMD5() ] },
// no unmapped reads in the test, so only check file name here (empty file)
process.out.unassembled_bam.collect { meta, bam_file -> [ meta, file(bam_file).name ] },
process.out.vcf.collect { meta, vcf_file -> [ meta, file(vcf_file).name ] },
process.out.tbi.collect { meta, tbi_file -> [ meta, file(tbi_file).name ] },
process.out.findAll { key, val -> key.startsWith('versions') }
).match()
assert process.out.vcf.size() > 0
assert process.out.tbi.size() > 0
}
}


test("portello - [bam, bai, bam, bai], fasta, fully-phased, false") {
when {
process {
"""
input[0] = [
[ id:'test'], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/test_hifi_aligned_assembly.bam'),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/test_hifi_aligned_assembly.bam.bai'),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/test_hifi_aligned_to_assembly.bam'),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/test_hifi_aligned_to_assembly.bam.bai'),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome3.fasta', checkIfExists: true),
"fully-phased",
false
]
"""
}
}

then {
assert process.success
assert snapshot(
process.out.bam.collect { meta, bam_file -> [ meta, file(bam_file).name + ":md5," + bam(bam_file, stringency: "silent").getReadsMD5() ] },
// no unmapped reads in the test, so only check file name here (empty file)
process.out.unassembled_bam.collect { meta, bam_file -> [ meta, file(bam_file).name ] },
process.out.findAll { key, val -> key.startsWith('versions') }
).match()
}
}

test("portello - [bam, bai, bam, bai], fasta, partially-phased, false - stub") {

options "-stub"

when {
process {
"""
input[0] = [
[ id:'test'], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/test_hifi_aligned_assembly.bam'),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/test_hifi_aligned_assembly.bam.bai'),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/test_hifi_aligned_to_assembly.bam'),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/test_hifi_aligned_to_assembly.bam.bai'),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome3.fasta', checkIfExists: true),
"partially-phased",
false
]
"""
}
}

then {
assert process.success
assert snapshot(sanitizeOutput(process.out)).match()
}
}

test("portello - [bam, bai, bam, bai], fasta, fully-phased, false - stub") {

options "-stub"

when {
process {
"""
input[0] = [
[ id:'test'], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/test_hifi_aligned_assembly.bam'),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/test_hifi_aligned_assembly.bam.bai'),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/test_hifi_aligned_to_assembly.bam'),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/test_hifi_aligned_to_assembly.bam.bai'),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome3.fasta', checkIfExists: true),
"fully-phased",
false
]
"""
}
}

then {
assert process.success
assert snapshot(sanitizeOutput(process.out)).match()
}
}

test("portello - [bam, bai, bam, bai], fasta, partially-phased, true - stub") {

options "-stub"

when {
process {
"""
input[0] = [
[ id:'test'], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/test_hifi_aligned_assembly.bam'),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/test_hifi_aligned_assembly.bam.bai'),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/test_hifi_aligned_to_assembly.bam'),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/test_hifi_aligned_to_assembly.bam.bai'),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome3.fasta', checkIfExists: true),
"partially-phased",
true
]
"""
}
}

then {
assert process.success
assert snapshot(sanitizeOutput(process.out)).match()
}
}

}
Loading
Loading