Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nftests custom modules #7201

Merged
merged 28 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
8f16c73
Added nf-tests
nschcolnicov Dec 11, 2024
22db11c
Add missing tags
nschcolnicov Dec 11, 2024
e54ce38
Fix conda tests
nschcolnicov Dec 11, 2024
3fe76eb
Merge branch 'master' of https://github.com/nf-core/modules into add_…
nschcolnicov Dec 12, 2024
3ae8c7c
Update versions.yml file
nschcolnicov Dec 12, 2024
35b031d
Update version generation
nschcolnicov Dec 12, 2024
96ee087
Update versions command
nschcolnicov Dec 12, 2024
b459baf
Removed quotes from versions
nschcolnicov Dec 12, 2024
816ff3b
add modules to pytest-workflow excludes
nschcolnicov Dec 12, 2024
b63fed2
Addressing PR comments
nschcolnicov Dec 13, 2024
75a029c
Addressing PR comments
nschcolnicov Dec 17, 2024
50e2138
Pull from master
nschcolnicov Dec 17, 2024
5c2e614
Addressing PR comments
nschcolnicov Dec 19, 2024
455c0fa
Update container for matrix
nschcolnicov Dec 19, 2024
452a354
Merge branch 'master' of https://github.com/nf-core/modules into add_…
nschcolnicov Dec 20, 2024
bb0f593
Update snaps
nschcolnicov Dec 20, 2024
2b8efa7
Merge branch 'master' into add_nftests_custom_modules
famosab Jan 7, 2025
68a4758
Merge branch 'master' into add_nftests_custom_modules
SPPearce Jan 8, 2025
2bb1baa
Fix linting
nschcolnicov Jan 9, 2025
d9b9443
Merge branch 'master' into add_nftests_custom_modules
famosab Jan 9, 2025
0d47f65
Merge branch 'master' of https://github.com/nf-core/modules into add_…
nschcolnicov Jan 13, 2025
300e476
Updated datasets paths
nschcolnicov Jan 13, 2025
b52c70b
Replace base path in datasets
nschcolnicov Jan 13, 2025
c20c9e2
Merge branch 'master' into add_nftests_custom_modules
famosab Jan 15, 2025
cb74b9f
Adjust indentation of test inputs
SPPearce Jan 15, 2025
3643983
Merge branch 'master' into add_nftests_custom_modules
SPPearce Jan 15, 2025
aa01ec7
Merge branch 'master' into add_nftests_custom_modules
SPPearce Jan 15, 2025
e19191a
Merge branch 'master' into add_nftests_custom_modules
atrigila Jan 16, 2025
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
6 changes: 6 additions & 0 deletions .github/workflows/pytest-workflow.yml
nschcolnicov marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ jobs:
tags: controlfreec/makegraph2
- profile: conda
tags: coreograph
- profile: conda
nschcolnicov marked this conversation as resolved.
Show resolved Hide resolved
tags: custom/matrixfilter
- profile: conda
tags: custom/tabulartogseacls
- profile: conda
tags: custom/tabulartogseagct
- profile: conda
tags: deepcell/mesmer
- profile: conda
Expand Down
12 changes: 9 additions & 3 deletions modules/nf-core/custom/matrixfilter/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ process CUSTOM_MATRIXFILTER {
tag "$meta"
label 'process_single'
conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/r-base:4.2.1' :
'biocontainers/r-base:4.2.1' }"
container "community.wave.seqera.io/library/r-base:4.2.1--b0b5476e2e7a0872"

input:
tuple val(meta), path(abundance)
Expand All @@ -27,4 +25,12 @@ process CUSTOM_MATRIXFILTER {
// (new variables defined here don't seem to be available in templates, so
// we have to access $task directly)
template 'matrixfilter.R'
nschcolnicov marked this conversation as resolved.
Show resolved Hide resolved

stub:
"""
touch mock.filtered.tsv
touch mock.tests.tsv
touch R_sessionInfo.log
nschcolnicov marked this conversation as resolved.
Show resolved Hide resolved
touch versions.yml
"""
}
57 changes: 57 additions & 0 deletions modules/nf-core/custom/matrixfilter/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
nextflow_process {

name "Test Process CUSTOM_MATRIXFILTER"
script "../main.nf"
process "CUSTOM_MATRIXFILTER"
config "./nextflow.config"
tag "modules"
tag "modules_nfcore"
tag "custom_matrixfilter"
tag "custom"
tag "custom/matrixfilter"

test("test_custom_matrixfilter") {

when {
process {
"""
input[0] = [ [id:"test"], file("https://github.com/nf-core/test-datasets/raw/refs/heads/differentialabundance/modules_testdata/SRP254919.salmon.merged.gene_counts.top1000cov.assay.tsv",checkIfExists: true) ]
input[1] = [ [id:"test"], file("https://github.com/nf-core/test-datasets/raw/refs/heads/differentialabundance/modules_testdata/SRP254919.samplesheet.sample_metadata.tsv",checkIfExists: true) ]
"""

}
}

then {
assertAll (
{ assert process.success },
{ assert snapshot(process.out.filtered).match("filtered") },
{ assert snapshot(process.out.tests).match("tests") },
{ assert snapshot(process.out.versions).match("versions") }
nschcolnicov marked this conversation as resolved.
Show resolved Hide resolved
)
}
}

test("test_custom_matrixfilter - stub") {

options "-stub"

when {
process {
"""
input[0] = [ [id:"test"], file("https://github.com/nf-core/test-datasets/raw/refs/heads/differentialabundance/modules_testdata/SRP254919.salmon.merged.gene_counts.top1000cov.assay.tsv",checkIfExists: true) ]
SPPearce marked this conversation as resolved.
Show resolved Hide resolved
input[1] = [ [id:"test"], file("https://github.com/nf-core/test-datasets/raw/refs/heads/differentialabundance/modules_testdata/SRP254919.samplesheet.sample_metadata.tsv",checkIfExists: true) ]
"""
}
}

then {
assertAll (
{ assert process.success },
{ assert snapshot(process.out.filtered).match("filtered_stub") },
{ assert snapshot(process.out.tests).match("tests_stub") },
{ assert snapshot(process.out.versions).match("versions_stub") }
nschcolnicov marked this conversation as resolved.
Show resolved Hide resolved
)
}
}
}
94 changes: 94 additions & 0 deletions modules/nf-core/custom/matrixfilter/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{
"filtered_stub": {
"content": [
[
[
{
"id": "test"
},
"mock.filtered.tsv:md5,d41d8cd98f00b204e9800998ecf8427e"
]
]
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.2"
},
"timestamp": "2024-12-11T20:24:23.270885558"
},
"versions_stub": {
"content": [
[
"versions.yml:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.2"
},
"timestamp": "2024-12-11T20:24:23.286233277"
},
"tests": {
"content": [
[
[
{
"id": "test"
},
"test.tests.tsv:md5,9a0f14988df8c1b8975039eed91b85e2"
]
]
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.2"
},
"timestamp": "2024-12-11T20:24:15.105582542"
},
"tests_stub": {
"content": [
[
[
{
"id": "test"
},
"mock.tests.tsv:md5,d41d8cd98f00b204e9800998ecf8427e"
]
]
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.2"
},
"timestamp": "2024-12-11T20:24:23.278625607"
},
"filtered": {
"content": [
[
[
{
"id": "test"
},
"test.filtered.tsv:md5,ecc3ca4c6538f9248dce844108474a66"
]
]
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.2"
},
"timestamp": "2024-12-11T20:24:15.091697173"
},
"versions": {
"content": [
[
"versions.yml:md5,275e382be9ca5bdd30ff5d6fc4340616"
]
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.2"
},
"timestamp": "2024-12-11T20:24:15.113337441"
}
}
21 changes: 21 additions & 0 deletions modules/nf-core/custom/matrixfilter/tests/nextflow.config
nschcolnicov marked this conversation as resolved.
Show resolved Hide resolved
famosab marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
params {
observations_id_col = 'sample'
filtering_min_samples = 1.0
filtering_min_abundance = 10
filtering_min_proportion = null
filtering_grouping_var = null
filtering_min_proportion_not_na = 0.5
filtering_min_samples_not_na = null
}
process {
ext.prefix = { "${meta.id}" }
ext.args = [
"--sample_id_col \"${params.observations_id_col}\"",
"--minimum_samples ${params.filtering_min_samples}",
"--minimum_abundance ${params.filtering_min_abundance}",
(params.filtering_min_proportion ? "--minimum_proportion ${params.filtering_min_proportion}" : ''),
(params.filtering_grouping_var ? "--grouping_variable \"${params.filtering_grouping_var}\"" : ''),
(params.filtering_min_proportion_not_na ? "--minimum_proportion_not_na \"${params.filtering_min_proportion_not_na}\"" : ''),
(params.filtering_min_samples_not_na ? "--minimum_samples_not_na \"${params.filtering_min_samples_not_na}\"" : '')
].join(' ').trim()
}
16 changes: 12 additions & 4 deletions modules/nf-core/custom/tabulartogseacls/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ process CUSTOM_TABULARTOGSEACLS {
label 'process_single'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/ubuntu:20.04' :
'nf-core/ubuntu:20.04' }"
container "community.wave.seqera.io/library/coreutils:8.30--b947da103164f84b"

input:
tuple val(meta), path(samples)
Expand Down Expand Up @@ -38,7 +36,17 @@ process CUSTOM_TABULARTOGSEACLS {

cat <<-END_VERSIONS > versions.yml
"${task.process}":
bash: \$(echo \$(bash --version | grep -Eo 'version [[:alnum:].]+' | sed 's/version //'))
awk: \$(mawk -W version | head -n 1 | awk '{print \$2}')
END_VERSIONS
"""

stub:
"""
touch mock.cls
nschcolnicov marked this conversation as resolved.
Show resolved Hide resolved
cat <<-END_VERSIONS > versions.yml
"${task.process}":
awk: \$(mawk -W version | head -n 1 | awk '{print \$2}')
END_VERSIONS
"""

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

name "Test Process CUSTOM_TABULARTOGSEACLS"
script "../main.nf"
process "CUSTOM_TABULARTOGSEACLS"
config "./nextflow.config"
tag "modules"
tag "modules_nfcore"
tag "custom_tabulartogseacls"
tag "custom"
tag "custom/tabulartogseacls"

test("test_custom_tabulartogseacls") {

when {
process {
"""
input[0] = [ [id:'treatment_mCherry_hND6_sample_number', variable:'treatment', reference:'mCherry', target:'hND6', blocking:'sample_number'], file("https://github.com/nf-core/test-datasets/raw/refs/heads/differentialabundance/modules_testdata/SRP254919.samplesheet.sample_metadata.tsv",checkIfExists: true) ]
"""

}
}

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

test("test_custom_tabulartogseacls - stub") {

options "-stub"

when {
process {
"""
input[0] = [ [id:'treatment_mCherry_hND6_sample_number', variable:'treatment', reference:'mCherry', target:'hND6', blocking:'sample_number'], file("https://github.com/nf-core/test-datasets/raw/refs/heads/differentialabundance/modules_testdata/SRP254919.samplesheet.sample_metadata.tsv",checkIfExists: true) ]
"""
}
}

then {
assertAll (
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}
}
84 changes: 84 additions & 0 deletions modules/nf-core/custom/tabulartogseacls/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"test_custom_tabulartogseacls - stub": {
"content": [
{
"0": [
[
{
"id": "treatment_mCherry_hND6_sample_number",
"variable": "treatment",
"reference": "mCherry",
"target": "hND6",
"blocking": "sample_number"
},
"mock.cls:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"1": [
"versions.yml:md5,bdeacaf3413865c27625dce2b7adcd9e"
],
"cls": [
[
{
"id": "treatment_mCherry_hND6_sample_number",
"variable": "treatment",
"reference": "mCherry",
"target": "hND6",
"blocking": "sample_number"
},
"mock.cls:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions": [
"versions.yml:md5,bdeacaf3413865c27625dce2b7adcd9e"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.2"
},
"timestamp": "2024-12-12T18:12:13.838536831"
},
"test_custom_tabulartogseacls": {
"content": [
{
"0": [
[
{
"id": "treatment_mCherry_hND6_sample_number",
"variable": "treatment",
"reference": "mCherry",
"target": "hND6",
"blocking": "sample_number"
},
"treatment_mCherry_hND6_sample_number.cls:md5,7b887159417842b1fe87afebe4f8c2b7"
]
],
"1": [
"versions.yml:md5,bdeacaf3413865c27625dce2b7adcd9e"
],
"cls": [
[
{
"id": "treatment_mCherry_hND6_sample_number",
"variable": "treatment",
"reference": "mCherry",
"target": "hND6",
"blocking": "sample_number"
},
"treatment_mCherry_hND6_sample_number.cls:md5,7b887159417842b1fe87afebe4f8c2b7"
]
],
"versions": [
"versions.yml:md5,bdeacaf3413865c27625dce2b7adcd9e"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.2"
},
"timestamp": "2024-12-12T18:12:07.37704262"
}
}
3 changes: 3 additions & 0 deletions modules/nf-core/custom/tabulartogseacls/tests/nextflow.config
nschcolnicov marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

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

see comment above

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
process {
ext.args = { [ "separator": "\t", "variable": "$meta.variable" ] }
}
Loading
Loading