Skip to content

Commit

Permalink
add new module for conifer (nf-core#3763)
Browse files Browse the repository at this point in the history
* add new module for conifer

* fixing CI

* fix test

* Update main.nf

---------

Co-authored-by: Robert A. Petit III <[email protected]>
  • Loading branch information
icaromsc and rpetit3 authored Sep 25, 2023
1 parent 6a37f9f commit f9c512b
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 0 deletions.
47 changes: 47 additions & 0 deletions modules/nf-core/conifer/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
process CONIFER {
tag "$meta.id"
label 'process_single'

conda "bioconda::conifer=1.0.2"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/conifer%3A1.0.2--he4a0461_0':
'biocontainers/conifer:1.0.2--he4a0461_0' }"

input:
tuple val(meta), path(kraken_result)
path kraken_taxon_db

output:
tuple val(meta), path("*.score"), emit: score
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}"
"""
conifer \\
$args \\
--input $kraken_result \\
--db $kraken_taxon_db > ${prefix}.score
cat <<-END_VERSIONS > versions.yml
"${task.process}":
conifer: \$(echo \$(conifer --version 2>&1) | sed 's/^.*Conifer //')
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}.score
cat <<-END_VERSIONS > versions.yml
"${task.process}":
conifer: \$(echo \$(conifer --version 2>&1) | sed 's/^.*Conifer //')
END_VERSIONS
"""
}
46 changes: 46 additions & 0 deletions modules/nf-core/conifer/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: conifer
description: Calculate confidence scores from Kraken2 output
keywords:
- classify
- metagenomics
- kraken2
- confidence
tools:
- conifer:
description: "Calculate confidence scores from Kraken2 output"
homepage: "https://github.com/Ivarz/Conifer"
documentation: "https://github.com/Ivarz/Conifer"
tool_dev_url: "https://github.com/Ivarz/Conifer"
licence: ["BSD / BSD-2-Clause"]
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- kraken_result:
type: file
description: |
Raw Kraken2 standard output file
- kraken_taxon_db:
type: file
description: Kraken2 taxo.k2d database file

output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- score:
type: file
description: |
Conifer report file containing confidence scores of Kraken2 classified reads.
pattern: "*.score"
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
authors:
- "@icaromsc"
- "@rpetit3"
4 changes: 4 additions & 0 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,10 @@ concoct/mergecutupclustering:
- modules/nf-core/concoct/mergecutupclustering/**
- tests/modules/nf-core/concoct/mergecutupclustering/**

conifer:
- modules/nf-core/conifer/**
- tests/modules/nf-core/conifer/**

controlfreec/assesssignificance:
- modules/nf-core/controlfreec/assesssignificance/**
- tests/modules/nf-core/controlfreec/assesssignificance/**
Expand Down
15 changes: 15 additions & 0 deletions tests/modules/nf-core/conifer/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env nextflow

nextflow.enable.dsl = 2

include { CONIFER } from '../../../../modules/nf-core/conifer/main.nf'

workflow test_conifer {

input = [
[ id:'test', single_end:false ], // meta map
file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
]

CONIFER ( input, [] )
}
5 changes: 5 additions & 0 deletions tests/modules/nf-core/conifer/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
process {

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

}
6 changes: 6 additions & 0 deletions tests/modules/nf-core/conifer/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- name: conifer test_conifer
command: nextflow run ./tests/modules/nf-core/conifer -entry test_conifer -c ./tests/config/nextflow.config -stub-run
tags:
- conifer
files:
- path: output/conifer/test.score

0 comments on commit f9c512b

Please sign in to comment.