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

new module: datavzrd #5883

Merged
merged 14 commits into from
Jun 26, 2024
7 changes: 7 additions & 0 deletions modules/nf-core/datavzrd/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: datavzrd
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- conda-forge::datavzrd==2.36.12
63 changes: 63 additions & 0 deletions modules/nf-core/datavzrd/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
process DATAVZRD {
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/datavzrd:2.36.12--bb93c8c988b7a9af':
'community.wave.seqera.io/library/datavzrd:2.36.12--593eb75e566b7f2a' }"

input:
tuple val(meta), file(config_file), file(table)

output:
tuple val(meta), path("${prefix}"), emit: report
path "versions.yml" , emit: versions

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

script:
def args = task.ext.args ?: ''
prefix = task.ext.prefix ?: "${meta.id}"
"""
mkdir ${prefix}
datavzrd \\
${args} \\
${config_file} \\
--output ${prefix} \\

cat <<-END_VERSIONS > versions.yml
"${task.process}":
datavzrd: \$(echo \$( datavzrd --version | sed -e 's/[^0-9.]//g' ))
END_VERSIONS
"""

stub:
prefix = task.ext.prefix ?: "${meta.id}"
"""
mkdir ${prefix}
mkdir ${prefix}/static
mkdir ${prefix}/network
mkdir ${prefix}/network/data
mkdir ${prefix}/network/plots
touch ./${prefix}/index.html
touch ./${prefix}/static/bootstrap.min.css
touch ./${prefix}/static/bootstrap-select.min.css
touch ./${prefix}/static/bootstrap-table.min.css
touch ./${prefix}/static/bootstrap-table-fixed-columns.min.css
touch ./${prefix}/static/bundle.js
touch ./${prefix}/static/datavzrd.css
touch ./${prefix}/network/index_1.html
touch ./${prefix}/network/config.js
touch ./${prefix}/network/functions.js
touch ./${prefix}/network/heatmap.js
touch ./${prefix}/network/data/data_1.js
touch ./${prefix}/network/plots/plot_0.js

cat <<-END_VERSIONS > versions.yml
"${task.process}":
datavzrd: \$(echo \$( datavzrd --version | sed -e 's/[^0-9.]//g' ))
END_VERSIONS
"""
}
46 changes: 46 additions & 0 deletions modules/nf-core/datavzrd/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
# yaml-language-server: $schema=https://raw.github.com/nf-core/modules/master/modules/meta-schema.json
name: "datavzrd"
description: Datavzrd is a tool to create visual HTML reports from collections of CSV/TSV tables.
keywords:
- visualisation
- tsv
- csv
tools:
- datavzrd:
description: Datavzrd is a tool to create visual HTML reports from collections of CSV/TSV tables.
homepage: https://datavzrd.github.io/
documentation: https://datavzrd.github.io/docs/index.html
tool_dev_url: https://github.com/datavzrd/datavzrd
licence: ["MIT"]

input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- config_file:
type: file
description: configuration file used for visualisation
pattern: "*.{yml,yaml}"
- table:
type: file
description: file used for visualisation
pattern: "*.{tsv,csv}"

output:
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
- report:
type: directory
description: directory with HTML report of provided CSV/TSV files
pattern: "/output/"

authors:
- "@vickylaram"
- "@famosab"
maintainers:
- "@famosab"
112 changes: 112 additions & 0 deletions modules/nf-core/datavzrd/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
nextflow_process {
name "Test Process DATAVZRD"
script "../main.nf"
process "DATAVZRD"
tag "modules"
tag "modules_nfcore"
tag "datavzrd"

test("csv") {

when {
process {
"""
input[0] = [ [id: "csv_config"],
file(params.modules_testdata_base_path + 'generic/config/config_test.datavzrd.yaml', checkIfExists: true),
file(params.modules_testdata_base_path + 'generic/csv/test.csv', checkIfExists: true)
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.versions,
path(process.out.report[0][1])
.list()
.collect { getRecursiveFileNames(it, process.out.report[0][1]) }
.flatten()
).match("csv")
}
)
}
}

test("tsv") {

when {
process {
"""
input[0] = [ [id: "tsv_config"],
file(params.modules_testdata_base_path + 'generic/config/config_network.datavzrd.yaml', checkIfExists: true),
file(params.modules_testdata_base_path + 'generic/tsv/network.tsv', checkIfExists: true)
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.versions,
path(process.out.report[0][1])
.list()
.collect { getRecursiveFileNames(it, process.out.report[0][1]) }
.flatten()
).match("tsv")
}
)
}
}

test("csv - stub") {

options "-stub"

when {
process {
"""
input[0] = [ [id: "csv_config"],
file(params.modules_testdata_base_path + 'generic/config/config_test.datavzrd.yaml', checkIfExists: true),
file(params.modules_testdata_base_path + 'generic/csv/test.csv', checkIfExists: true)
]
"""
}
}

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

test("no_config_file") {
when {
process {
"""
input[0] = []
"""
}
}

then {
assertAll(
{ assert process.failed },
{ assert process.out['report'].isEmpty() },
{ assert snapshot(process.out).match() }
)
}
}
}

def getRecursiveFileNames(fileOrDir, outputDir) {
if(file(fileOrDir.toString()).isDirectory()) {
return fileOrDir.list().collect { getRecursiveFileNames(it, outputDir) }
}
return fileOrDir.toString().replace("${outputDir}/", "")
}
162 changes: 162 additions & 0 deletions modules/nf-core/datavzrd/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
{
"csv - stub": {
"content": [
{
"0": [
[
{
"id": "csv_config"
},
[
"index.html:md5,d41d8cd98f00b204e9800998ecf8427e",
[
"config.js:md5,d41d8cd98f00b204e9800998ecf8427e",
[
"data_1.js:md5,d41d8cd98f00b204e9800998ecf8427e"
],
"functions.js:md5,d41d8cd98f00b204e9800998ecf8427e",
"heatmap.js:md5,d41d8cd98f00b204e9800998ecf8427e",
"index_1.html:md5,d41d8cd98f00b204e9800998ecf8427e",
[
"plot_0.js:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
[
"bootstrap-select.min.css:md5,d41d8cd98f00b204e9800998ecf8427e",
"bootstrap-table-fixed-columns.min.css:md5,d41d8cd98f00b204e9800998ecf8427e",
"bootstrap-table.min.css:md5,d41d8cd98f00b204e9800998ecf8427e",
"bootstrap.min.css:md5,d41d8cd98f00b204e9800998ecf8427e",
"bundle.js:md5,d41d8cd98f00b204e9800998ecf8427e",
"datavzrd.css:md5,d41d8cd98f00b204e9800998ecf8427e"
]
]
]
],
"1": [
"versions.yml:md5,4c539593d78c0a07ede5759e0ce5ade8"
],
"report": [
[
{
"id": "csv_config"
},
[
"index.html:md5,d41d8cd98f00b204e9800998ecf8427e",
[
"config.js:md5,d41d8cd98f00b204e9800998ecf8427e",
[
"data_1.js:md5,d41d8cd98f00b204e9800998ecf8427e"
],
"functions.js:md5,d41d8cd98f00b204e9800998ecf8427e",
"heatmap.js:md5,d41d8cd98f00b204e9800998ecf8427e",
"index_1.html:md5,d41d8cd98f00b204e9800998ecf8427e",
[
"plot_0.js:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
[
"bootstrap-select.min.css:md5,d41d8cd98f00b204e9800998ecf8427e",
"bootstrap-table-fixed-columns.min.css:md5,d41d8cd98f00b204e9800998ecf8427e",
"bootstrap-table.min.css:md5,d41d8cd98f00b204e9800998ecf8427e",
"bootstrap.min.css:md5,d41d8cd98f00b204e9800998ecf8427e",
"bundle.js:md5,d41d8cd98f00b204e9800998ecf8427e",
"datavzrd.css:md5,d41d8cd98f00b204e9800998ecf8427e"
]
]
]
],
"versions": [
"versions.yml:md5,4c539593d78c0a07ede5759e0ce5ade8"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
},
"timestamp": "2024-06-26T10:16:55.267548327"
},
"tsv": {
"content": [
[
"versions.yml:md5,4c539593d78c0a07ede5759e0ce5ade8"
],
[
"index.html",
"network/config.js",
"network/data/data_1.js",
"network/functions.js",
"network/heatmap.js",
"network/index_1.html",
"network/plots/plot_0.js",
"network/plots/plot_1.js",
"network/plots/plot_2.js",
"network/plots/plot_3.js",
"static/bootstrap-select.min.css",
"static/bootstrap-table-fixed-columns.min.css",
"static/bootstrap-table.min.css",
"static/bootstrap.min.css",
"static/bundle.js",
"static/datavzrd.css"
]
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
},
"timestamp": "2024-06-26T10:15:02.495557702"
},
"no_config_file": {
"content": [
{
"0": [

],
"1": [

],
"report": [

],
"versions": [

]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
},
"timestamp": "2024-06-26T10:15:09.362847938"
},
"csv": {
"content": [
[
"versions.yml:md5,4c539593d78c0a07ede5759e0ce5ade8"
],
[
"index.html",
"static/bootstrap-select.min.css",
"static/bootstrap-table-fixed-columns.min.css",
"static/bootstrap-table.min.css",
"static/bootstrap.min.css",
"static/bundle.js",
"static/datavzrd.css",
"test/config.js",
"test/data/data_1.js",
"test/functions.js",
"test/heatmap.js",
"test/index_1.html",
"test/plots/plot_0.js",
"test/plots/plot_1.js",
"test/plots/plot_2.js",
"test/plots/plot_3.js"
]
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
},
"timestamp": "2024-06-26T10:14:58.495338891"
}
}
2 changes: 2 additions & 0 deletions modules/nf-core/datavzrd/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
datavzrd:
- "modules/nf-core/datavzrd/**"
Loading
Loading