Add hamronization/summarize (#1366)

* fix: remove left-over unnecessary code

* Add hamronizer/deeparg

* Add hamronisation/summarise

* Update test.yml

* Update modules/hamronization/summarize/meta.yml

Co-authored-by: Jasmin F <73216762+jasmezz@users.noreply.github.com>

* line up outputs

Co-authored-by: Robert A. Petit III <robbie.petit@gmail.com>
Co-authored-by: Jasmin F <73216762+jasmezz@users.noreply.github.com>
This commit is contained in:
James A. Fellows Yates 2022-03-03 08:02:04 +01:00 committed by GitHub
parent fba1b381f5
commit 61c88c6233
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 142 additions and 0 deletions

View file

@ -0,0 +1,38 @@
process HAMRONIZATION_SUMMARIZE {
label 'process_low'
conda (params.enable_conda ? "bioconda::hamronization=1.0.3" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/hamronization:1.0.3--py_0':
'quay.io/biocontainers/hamronization:1.0.3--py_0' }"
input:
path(reports)
val(format)
output:
path("hamronization_combined_report.json"), optional: true, emit: json
path("hamronization_combined_report.tsv") , optional: true, emit: tsv
path("hamronization_combined_report.html"), optional: true, emit: html
path "versions.yml" , emit: versions
when:
task.ext.when == null || task.ext.when
script:
def args = task.ext.args ?: ''
def outformat = format == 'interactive' ? 'html' : format
"""
hamronize \\
summarize \\
${reports.join(' ')} \\
-t ${format} \\
$args \\
-o hamronization_combined_report.${outformat}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
hamronization: \$(echo \$(hamronize --version 2>&1) | cut -f 2 -d ' ' )
END_VERSIONS
"""
}

View file

@ -0,0 +1,45 @@
name: hamronization_summarize
description: Tool to summarize and combine all hAMRonization reports into a single file
keywords:
- amr
- antimicrobial resistance
- reporting
tools:
- hamronization:
description: Tool to convert and summarize AMR gene detection outputs using the hAMRonization specification
homepage: https://github.com/pha4ge/hAMRonization/blob/master/README.md
documentation: https://github.com/pha4ge/hAMRonization/blob/master/README.md
tool_dev_url: https://github.com/pha4ge/hAMRonization
doi: ""
licence: ['GNU Lesser General Public v3 (LGPL v3)']
input:
- reports:
type: file
description: List of multiple hAMRonization reports in either JSON or TSV format
pattern: "*.{json,tsv}"
- format:
type: value
description: Type of final combined report file to be produced
pattern: "tsv|json|interactive"
output:
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
- json:
type: file
description: hAMRonised summary in JSON format
pattern: "*.json"
- tsv:
type: file
description: hAMRonised summary in TSV format
pattern: "*.json"
- html:
type: file
description: hAMRonised summary in HTML format
pattern: "*.html"
authors:
- "@jfy133"

View file

@ -756,6 +756,10 @@ hamronization/deeparg:
- modules/hamronization/deeparg/** - modules/hamronization/deeparg/**
- tests/modules/hamronization/deeparg/** - tests/modules/hamronization/deeparg/**
hamronization/summarize:
- modules/hamronization/summarize/**
- tests/modules/hamronization/summarize/**
hicap: hicap:
- modules/hicap/** - modules/hicap/**
- tests/modules/hicap/** - tests/modules/hicap/**

View file

@ -0,0 +1,36 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { HAMRONIZATION_DEEPARG } from '../../../../modules/hamronization/deeparg/main.nf'
include { HAMRONIZATION_DEEPARG as HAMRONIZATION_DEEPARG_SECOND } from '../../../../modules/hamronization/deeparg/main.nf'
include { HAMRONIZATION_SUMMARIZE } from '../../../../modules/hamronization/summarize/main.nf'
workflow test_hamronization_summarize {
input = [
[ id:'test', single_end:false ], // meta map
file(params.test_data['bacteroides_fragilis']['genome']['genome_mapping_potential_arg'], checkIfExists: true),
]
input2 = [
[ id:'test2', single_end:false ], // meta map
file(params.test_data['bacteroides_fragilis']['genome']['genome_mapping_potential_arg'], checkIfExists: true),
]
HAMRONIZATION_DEEPARG ( input, 'tsv', '1.0.2', '2' )
HAMRONIZATION_DEEPARG_SECOND ( input2, 'tsv', '1.0.2', '2' )
ch_deeparg_run_one = HAMRONIZATION_DEEPARG.out.tsv
ch_deeparg_run_two = HAMRONIZATION_DEEPARG_SECOND.out.tsv
ch_deeparg_run_one
.mix( ch_deeparg_run_two )
.map{
[ it[1] ]
}
.collect()
.set { ch_input_for_summarize }
HAMRONIZATION_SUMMARIZE ( ch_input_for_summarize , 'json' )
}

View file

@ -0,0 +1,5 @@
process {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
}

View file

@ -0,0 +1,14 @@
- name: hamronization summarize test_hamronization_summarize
command: nextflow run tests/modules/hamronization/summarize -entry test_hamronization_summarize -c tests/config/nextflow.config
tags:
- hamronization
- hamronization/summarize
files:
- path: output/hamronization/hamronization_combined_report.json
md5sum: 1623b6cc3b213208a425e023edd94691
- path: output/hamronization/test.tsv
md5sum: 3c315605aca0c5964796bb5fd4cdd522
- path: output/hamronization/test2.tsv
md5sum: 453f38502e35261a50a0849dca34f05b
- path: output/hamronization/versions.yml
md5sum: 99b5046fac643e16ca3362d1baf3284b