Skip to content

Commit

Permalink
Add wittyer as module (nf-core#5171)
Browse files Browse the repository at this point in the history
* feat: add wittyer as module

* fix: adjust output and version

* fix: copy output and script from local

* feat: fill in in meta file

* fix: remove config file input

* fix: run prettier

* feat: explain how to create docker image

* fix: README for Docker image

* fix: modify environment file

* fix: stub and file extensions

* fix: remove custom extensions

* feat: add test file - failing

* fix: correct input for tests

* fix: licence

* fix: container name

* fix: finally correct container

* fix syntax errors

* normal test works, stub fails

* fix expected outputs

* fix: mention making image public

* fix add stageAs, use dotnet

* run prettier

* [automated] Fix linting with Prettier

* add comment for run

* fix trailing whitespace

* add dependencies to fix linting

* fix harmonize inputs in meta and main

* fix: run prettier

* [automated] Fix linting with Prettier

* fix index names

* fix version to stub_version in stub test

Co-authored-by: Nicolas Vannieuwkerke <[email protected]>

* extend tests to capture as much as possible

* test with bed file

* fix: remove stageAs

* fix tests for stageAs removal

* remove '' in meta file

* exclude conda test for wittyer

---------

Co-authored-by: nf-core-bot <[email protected]>
Co-authored-by: Nicolas Vannieuwkerke <[email protected]>
  • Loading branch information
3 people authored and jennylsmith committed Mar 20, 2024
1 parent 8091d0a commit dd61350
Show file tree
Hide file tree
Showing 8 changed files with 621 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,8 @@ jobs:
tags: subworkflows/vcf_annotate_ensemblvep
- profile: singularity
tags: bases2fastq
- profile: conda
tags: wittyer
env:
NXF_ANSI_LOG: false
SENTIEON_LICENSE_BASE64: ${{ secrets.SENTIEON_LICENSE_BASE64 }}
Expand Down
28 changes: 28 additions & 0 deletions modules/nf-core/wittyer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Updating the docker container and making a new module release

witty.er is a commercial tool from Illumina. The container provided for the witty.er nf-core module is not provided nor supported by Illumina. Updating the witty.er versions in the container and pushing the update to Dockerhub needs to be done manually.

1. Navigate to the witty.er github repository. - [witty.er](https://github.com/Illumina/witty.er)
2. Download the latest release.
```bash
wget https://github.com/Illumina/witty.er/archive/refs/tags/<VERSION>.tar.gz
```
3. Uncompress the released package.
```bash
tar -xvf <VERSION>.tar.gz
```
4. Change to the uncompressed directory.
5. Build docker image using provided Dockerfile.

```bash
docker build -t wittyer:<VERSION> --platform linux/amd64 .
```

6. Access rights are needed to push the container to the Dockerhub nfcore organization, please ask a core team member to do so.

```bash
docker tag wittyer:<VERSION> quay.io/nf-core/wittyer:<VERSION>
docker push quay.io/nf-core/wittyer:<VERSION>
```

7. Make the image public.
7 changes: 7 additions & 0 deletions modules/nf-core/wittyer/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: wittyer
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- tabix
69 changes: 69 additions & 0 deletions modules/nf-core/wittyer/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
process WITTYER {
tag "$meta.id"
label 'process_single'

container "nf-core/wittyer:0.3.3.0"

// Exit if running this module with -profile conda / -profile mamba
if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) {
error "WITTYER module does not support Conda. Please use Docker / Singularity / Podman instead."
}

input:
tuple val(meta), path(query_vcf), path(query_vcf_index), path(truth_vcf), path(truth_vcf_index), path(bed)

output:
tuple val(meta), path("*.json") , emit: report
tuple val(meta), path("*.vcf.gz") , emit: bench_vcf
tuple val(meta), path("*.vcf.gz.tbi") , emit: bench_vcf_tbi
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}"
def regions = bed ? "--includeBed=$bed" : ""
if ("$truth_vcf" == "${prefix}.vcf.gz") error "Input and output names are the same, set prefix in module configuration to disambiguate!"
if ("$query_vcf" == "${prefix}.vcf.gz") error "Input and output names are the same, set prefix in module configuration to disambiguate!"
if ("$query_vcf_index" == "${prefix}.vcf.gz.tbi") error "Input and output names are the same, set prefix in module configuration to disambiguate!"
if ("$query_vcf_index" == "${prefix}.vcf.gz.tbi") error "Input and output names are the same, set prefix in module configuration to disambiguate!"

// dotnet /opt/Wittyer/Wittyer.dll might need to be replaced with new docker image
"""
mkdir bench
dotnet /opt/Wittyer/Wittyer.dll \\
--truthVcf=${truth_vcf} \\
--inputVcf=${query_vcf} \\
--outputDirectory=bench \\
${regions} \\
${args}
mv bench/Wittyer.Stats.json ${prefix}.json
mv bench/*.vcf.gz ${prefix}.vcf.gz
mv bench/*.vcf.gz.tbi ${prefix}.vcf.gz.tbi
rm -rf bench
cat <<-END_VERSIONS > versions.yml
"${task.process}":
wittyer: \$(dotnet /opt/Wittyer/Wittyer.dll --version |& sed '1!d ; s/witty.er //')
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}.json
echo "" | gzip > ${prefix}.vcf.gz
touch ${prefix}.vcf.gz.tbi
cat <<-END_VERSIONS > versions.yml
"${task.process}":
wittyer: \$(dotnet /opt/Wittyer/Wittyer.dll --version |& sed '1!d ; s/witty.er //')
END_VERSIONS
"""
}
66 changes: 66 additions & 0 deletions modules/nf-core/wittyer/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: wittyer
description: A large variant benchmarking tool analogous to hap.py for small variants.
keywords:
- structural-variants
- benchmarking
- vcf
tools:
- wittyer:
description: "Illumina tool for large variant benchmarking"
homepage: "https://github.com/Illumina/witty.er"
documentation: "https://github.com/Illumina/witty.er"
tool_dev_url: "https://github.com/Illumina/witty.er"
licence: ["BSD-2"]
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- query_vcf:
type: file
description: A VCF with called variants to benchmark against the standard
pattern: "*.{vcf,vcf.gz}"
- query_vcf_index:
type: file
description: The index of the called VCF (optional)
pattern: "*.tbi"
- truth_vcf:
type: file
description: A standard VCF to compare against
pattern: "*.{vcf,vcf.gz}"
- truth_vcf_index:
type: file
description: The index of the standard VCF (optional)
pattern: "*.tbi"
- bed:
type: file
description: A BED file specifying regions to be included in the analysis (optional)
pattern: "*.bed"
output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
- report:
type: file
description: Detailed per-sample-pair, per-svtype, per-bin stats
pattern: "*.json"
- bench_vcf:
type: file
description: Updated query and truth entries merged into one file
pattern: "*.vcf.gz"
- bench_vcf_tbi:
type: file
description: Index of merged query and truth entries VCF file
pattern: "*.vcf.gz.tbi"
authors:
- "@famosab"
maintainers:
- "@famosab"
100 changes: 100 additions & 0 deletions modules/nf-core/wittyer/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "wittyer"

test("human - simulatedSV - vcf_gz") {

when {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
file(params.test_data['homo_sapiens']['illumina']['simulated_sv'], checkIfExists: true),
file(params.test_data['homo_sapiens']['illumina']['simulated_sv_tbi'], checkIfExists: true),
file(params.test_data['homo_sapiens']['illumina']['simulated_sv2'], checkIfExists: true),
file(params.test_data['homo_sapiens']['illumina']['simulated_sv2_tbi'], checkIfExists: true),
[]
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() },
{ assert snapshot(process.out.bench_vcf).match("bench_vcf") },
{ assert snapshot(process.out.bench_vcf_tbi).match("bench_vcf_tbi") },
{ assert snapshot(process.out.report).match("report") },
{ assert snapshot(process.out.version).match("version") }
)
}

}

test("human - simulatedSV - vcf_gz - bed") {

when {
process {
"""
input[0] = [
[ id:'test_bed', single_end:false ], // meta map
file(params.test_data['homo_sapiens']['illumina']['simulated_sv'], checkIfExists: true),
file(params.test_data['homo_sapiens']['illumina']['simulated_sv_tbi'], checkIfExists: true),
file(params.test_data['homo_sapiens']['illumina']['simulated_sv2'], checkIfExists: true),
file(params.test_data['homo_sapiens']['illumina']['simulated_sv2_tbi'], checkIfExists: true),
file(params.test_data['homo_sapiens']['genome']['genome_21_multi_interval_bed'], checkIfExists: true)
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() },
{ assert snapshot(process.out.bench_vcf).match("bed_bench_vcf") },
{ assert snapshot(process.out.bench_vcf_tbi).match("bed_bench_vcf_tbi") },
{ assert snapshot(process.out.report).match("bed_report") },
{ assert snapshot(process.out.version).match("bed_version") }
)
}

}

test("human - simulatedSV - vcf_gz - stub") {

options "-stub"

when {
process {
"""
input[0] = [
[ id:'test_stub', single_end:false ], // meta map
file(params.test_data['homo_sapiens']['illumina']['simulated_sv'], checkIfExists: true),
file(params.test_data['homo_sapiens']['illumina']['simulated_sv_tbi'], checkIfExists: true),
file(params.test_data['homo_sapiens']['illumina']['simulated_sv2'], checkIfExists: true),
file(params.test_data['homo_sapiens']['illumina']['simulated_sv2_tbi'], checkIfExists: true),
[]
]
"""
}
}

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

}

}
Loading

0 comments on commit dd61350

Please sign in to comment.