Skip to content

Commit

Permalink
Swap hicpca to nf-test (#7281)
Browse files Browse the repository at this point in the history
* Swap hicpca to nf-test

* Fix test

* Update snapshot
  • Loading branch information
SPPearce authored Jan 9, 2025
1 parent 667f74c commit 99b8a61
Show file tree
Hide file tree
Showing 7 changed files with 225 additions and 37 deletions.
26 changes: 23 additions & 3 deletions modules/nf-core/hicexplorer/hicpca/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,40 @@ process HICEXPLORER_HICPCA {
args.remove(idx+1)
args.remove(idx)
}
outfilenames = eigenvectors.tokenize()
.collect{"${prefix}_pca${it}.${format}"}.join(' ')
outfilenames = eigenvectors.tokenize().collect{"${prefix}_pca${it}.${format}"}.join(' ')
args = args.join(' ')
"""
hicPCA \\
-m $matrix \\
$args \\
--format $format \\
--whichEigenvectors $eigenvectors \\
--outputFileName $outfilenames
--outputFileName ${outfilenames}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
hicexplorer: \$(hicPCA --version 2>&1 | sed 's/hicPCA //')
END_VERSIONS
"""
stub:
def args = task.ext.args ?: ''
prefix = task.ext.prefix ?: "${meta.id}"
args = args.tokenize()
def idx = args.findIndexOf{ it == '--format' | it == '-f' }
format = 'bigwig'
if (idx>=0) {
format = args[idx+1]
args.remove(idx+1)
args.remove(idx)
}
"""
touch ${prefix}_pca1.${format}
touch ${prefix}_pca2.${format}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
hicexplorer: \$(hicPCA --version 2>&1 | sed 's/hicPCA //')
END_VERSIONS
"""

}
58 changes: 58 additions & 0 deletions modules/nf-core/hicexplorer/hicpca/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "hicexplorer"
tag "hicexplorer/hicpca"

test("mm9 chr1") {

when {
process {
"""
input[0] = [
[ id:'test' ], // meta map
file('https://github.com/deeptools/HiCExplorer/raw/master/hicexplorer/test/test_data/hicPCA/mm9_reduced_chr1.cool', checkIfExists: true)
]
"""
}
}

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

}

test("mm9 chr1 - stub") {

options "-stub"

when {
process {
"""
input[0] = [
[ id:'test' ], // meta map
file('https://github.com/deeptools/HiCExplorer/raw/master/hicexplorer/test/test_data/hicPCA/mm9_reduced_chr1.cool', checkIfExists: true)
]
"""
}
}

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

}

}
144 changes: 144 additions & 0 deletions modules/nf-core/hicexplorer/hicpca/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
{
"mm9 chr1": {
"content": [
{
"0": [
[
{
"id": "test"
},
[
"test_pca1.bigwig:md5,e228fde481bedea641bcd0204bb663a4",
"test_pca2.bigwig:md5,109c0d3cc70ecaf3647f3293504a9683"
]
]
],
"1": [
[
{
"id": "test"
},
"test_pca1.bigwig:md5,e228fde481bedea641bcd0204bb663a4"
]
],
"2": [
[
{
"id": "test"
},
"test_pca2.bigwig:md5,109c0d3cc70ecaf3647f3293504a9683"
]
],
"3": [
"versions.yml:md5,54775e8cd6ce193be8705000c3279192"
],
"pca1": [
[
{
"id": "test"
},
"test_pca1.bigwig:md5,e228fde481bedea641bcd0204bb663a4"
]
],
"pca2": [
[
{
"id": "test"
},
"test_pca2.bigwig:md5,109c0d3cc70ecaf3647f3293504a9683"
]
],
"results": [
[
{
"id": "test"
},
[
"test_pca1.bigwig:md5,e228fde481bedea641bcd0204bb663a4",
"test_pca2.bigwig:md5,109c0d3cc70ecaf3647f3293504a9683"
]
]
],
"versions": [
"versions.yml:md5,54775e8cd6ce193be8705000c3279192"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.3"
},
"timestamp": "2025-01-09T11:04:14.308469361"
},
"mm9 chr1 - stub": {
"content": [
{
"0": [
[
{
"id": "test"
},
[
"test_pca1.bigwig:md5,d41d8cd98f00b204e9800998ecf8427e",
"test_pca2.bigwig:md5,d41d8cd98f00b204e9800998ecf8427e"
]
]
],
"1": [
[
{
"id": "test"
},
"test_pca1.bigwig:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"2": [
[
{
"id": "test"
},
"test_pca2.bigwig:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"3": [
"versions.yml:md5,54775e8cd6ce193be8705000c3279192"
],
"pca1": [
[
{
"id": "test"
},
"test_pca1.bigwig:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"pca2": [
[
{
"id": "test"
},
"test_pca2.bigwig:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"results": [
[
{
"id": "test"
},
[
"test_pca1.bigwig:md5,d41d8cd98f00b204e9800998ecf8427e",
"test_pca2.bigwig:md5,d41d8cd98f00b204e9800998ecf8427e"
]
]
],
"versions": [
"versions.yml:md5,54775e8cd6ce193be8705000c3279192"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.3"
},
"timestamp": "2025-01-09T11:04:26.856478191"
}
}
3 changes: 0 additions & 3 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,6 @@ gridss/gridssgenerateponbedpe:
gsea/gsea:
- modules/nf-core/gsea/gsea/**
- tests/modules/nf-core/gsea/gsea/**
hicexplorer/hicpca:
- modules/nf-core/hicexplorer/hicpca/**
- tests/modules/nf-core/hicexplorer/hicpca/**
hlala/preparegraph:
- modules/nf-core/hlala/preparegraph/**
- tests/modules/nf-core/hlala/preparegraph/**
Expand Down
15 changes: 0 additions & 15 deletions tests/modules/nf-core/hicexplorer/hicpca/main.nf

This file was deleted.

5 changes: 0 additions & 5 deletions tests/modules/nf-core/hicexplorer/hicpca/nextflow.config

This file was deleted.

11 changes: 0 additions & 11 deletions tests/modules/nf-core/hicexplorer/hicpca/test.yml

This file was deleted.

0 comments on commit 99b8a61

Please sign in to comment.