Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 7 additions & 0 deletions modules/nf-core/homer/mergepeaks/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
dependencies:
- "bioconda::homer=5.1"
47 changes: 47 additions & 0 deletions modules/nf-core/homer/mergepeaks/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
process HOMER_MERGEPEAKS {
tag "$meta.id"
label 'process_single'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'oras://community.wave.seqera.io/library/homer:5.1--586e112615c26ca1':
'community.wave.seqera.io/library/homer:5.1--851c883b9d1473f9' }"

input:
tuple val(meta), path(peaks) // peaks can be a list of peak files

output:
tuple val(meta), path("*.txt"), emit: txt
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}" + "_merged_peaks"
def peak_files = peaks instanceof List ? peaks.join(' ') : peaks
"""
mergePeaks \\
$args \\
-prefix ${prefix} \\
$peak_files \\
> ${prefix}.txt

cat <<-END_VERSIONS > versions.yml
"${task.process}":
homer: \$(mergePeaks 2>&1 | grep -i "version" | sed 's/.*version //i' || echo "4.11")
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
Copy link

Copilot AI Oct 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The stub section uses a different default prefix pattern than the main script. The main script uses ${meta.id}_merged_peaks while the stub uses just ${meta.id}, which could cause inconsistent behavior between normal execution and stub mode.

Suggested change
def prefix = task.ext.prefix ?: "${meta.id}"
def prefix = task.ext.prefix ?: "${meta.id}_merged_peaks"

Copilot uses AI. Check for mistakes.
"""
touch ${prefix}.txt

cat <<-END_VERSIONS > versions.yml
"${task.process}":
homer: 4.11
END_VERSIONS
"""
}
55 changes: 55 additions & 0 deletions modules/nf-core/homer/mergepeaks/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: "homer_mergepeaks"
description: Merge peak files from multiple experiments or replicates into a unified peak set
keywords:
- peaks
- merge
- chipseq
- chipexo
- consensus
tools:
- homer:
description: |
HOMER (Hypergeometric Optimization of Motif EnRichment) is a suite of tools for Motif Discovery and next-gen sequencing analysis.
homepage: "http://homer.ucsd.edu/homer/index.html"
documentation: "http://homer.ucsd.edu/homer/"
tool_dev_url: "http://homer.ucsd.edu/homer/ngs/peaks.html"
doi: 10.1016/j.molcel.2010.05.004.
licence: ["GPL-3.0-or-later"]
identifier: biotools:homer
input:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'merged_peaks' ]
- peaks:
type: file
description: Peak files from HOMER findPeaks in HOMER peak format (*.txt). Can be a single file or list of files.
pattern: "*.txt"

output:
txt:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'merged_peaks' ]
- "*.txt":
type: file
description: Merged peak file in HOMER peak format
pattern: "*.txt"
ontologies:
- edam: https://bioportal.bioontology.org/ontologies/EDAM?p=classes&conceptid=format_3475 # tsv
versions:
- versions.yml:
type: file
description: File containing software versions
pattern: "versions.yml"
ontologies:
- edam: http://edamontology.org/format_3750 # YAML

authors:
- "@cmatKhan"
maintainers:
- "@cmatKhan"
124 changes: 124 additions & 0 deletions modules/nf-core/homer/mergepeaks/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
nextflow_process {

name "Test Process HOMER_MERGEPEAKS"
script "../main.nf"
process "HOMER_MERGEPEAKS"
config "./nextflow.config"

tag "modules"
tag "modules_nfcore"
tag "homer"
tag "homer/mergepeaks"
tag "homer/findpeaks"
tag "homer/maketagdirectory"

setup {
run("HOMER_MAKETAGDIRECTORY", alias: "MAKETAGDIR_SAMPLE1") {
script "../../maketagdirectory/main.nf"
config "../../maketagdirectory/tests/bed.config"
process {
"""
input[0] = [
[ id:'sample1' ],
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/bed/test.bed', checkIfExists: true)
]
input[1] = file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)
"""
}
}

run("HOMER_MAKETAGDIRECTORY", alias: "MAKETAGDIR_SAMPLE2") {
script "../../maketagdirectory/main.nf"
config "../../maketagdirectory/tests/bed.config"
process {
"""
input[0] = [
[ id:'sample2' ],
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/bed/test2.bed', checkIfExists: true)
]
input[1] = file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)
"""
}
}

run("HOMER_FINDPEAKS", alias: "FINDPEAKS_SAMPLE1") {
script "../../findpeaks/main.nf"
config "./nextflow.config"
process {
"""
input[0] = MAKETAGDIR_SAMPLE1.out.tagdir
input[1] = []
"""
}
}

run("HOMER_FINDPEAKS", alias: "FINDPEAKS_SAMPLE2") {
script "../../findpeaks/main.nf"
config "./nextflow.config"
process {
"""
input[0] = MAKETAGDIR_SAMPLE2.out.tagdir
input[1] = []
"""
}
}
}

test("sarscov2 - bed - merge two peak files") {

when {
process {
"""
peaks = Channel.empty()
.mix(
FINDPEAKS_SAMPLE1.out.txt.map { it[1] },
FINDPEAKS_SAMPLE2.out.txt.map { it[1] }
)
.collect()
.map { [ [id:'merged'], it ] }

input[0] = peaks
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
file(process.out.txt[0][1]).name,
process.out.versions
).match()
}
)
}
}

test("sarscov2 - bed - merge two peak files - stub") {

options "-stub"

when {
process {
"""
peaks = Channel.empty()
.mix(
FINDPEAKS_SAMPLE1.out.txt.map { it[1] },
FINDPEAKS_SAMPLE2.out.txt.map { it[1] }
)
.collect()
.map { [ [id:'merged'], it ] }

input[0] = peaks
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match("stub") }
)
}
}
}
48 changes: 48 additions & 0 deletions modules/nf-core/homer/mergepeaks/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"sarscov2 - bed - merge two peak files": {
"content": [
"merged_peaks.txt",
[
"versions.yml:md5,a383523aae5048d4b28718f7ba1d8526"
]
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "25.04.7"
},
"timestamp": "2025-10-05T13:14:52.683370026"
},
"stub": {
"content": [
{
"0": [
[
{
"id": "merged"
},
"merged_peaks.txt:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"1": [
"versions.yml:md5,5985f7630d53ae0605c2f459e43439c2"
],
"txt": [
[
{
"id": "merged"
},
"merged_peaks.txt:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions": [
"versions.yml:md5,5985f7630d53ae0605c2f459e43439c2"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "25.04.7"
},
"timestamp": "2025-10-05T13:14:58.514229717"
}
}
11 changes: 11 additions & 0 deletions modules/nf-core/homer/mergepeaks/tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
process {
withName: 'FINDPEAKS_SAMPLE1' {
ext.args = '-style factor'
}
withName: 'FINDPEAKS_SAMPLE2' {
ext.args = '-style factor'
}
withName: 'HOMER_MERGEPEAKS' {
ext.prefix = 'merged_peaks'
}
}
Loading
Loading