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

adding chewbbaca/createschema module #4512

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
61406f5
adding chewbbaca/createschema module
anwarMZ Nov 29, 2023
4a7895c
updated for handling a mix of uncompressed and compressed files
anwarMZ Nov 29, 2023
519a572
update the formatting
anwarMZ Nov 29, 2023
a2e9a15
update the formatting
anwarMZ Nov 29, 2023
9bb5f43
Merge branch 'master' into 4480-new-module-chewbbacacreateschema
ggabernet Dec 6, 2023
f507c31
updated module to emit meta
anwarMZ Dec 6, 2023
1570c80
updated test.yml
anwarMZ Dec 6, 2023
6113a21
update pytest
anwarMZ Dec 6, 2023
313b1e4
clean the meta.yml
anwarMZ Jan 5, 2024
e9f4aad
clean the meta.yml
anwarMZ Jan 5, 2024
90fb055
clean the meta.yml
anwarMZ Jan 5, 2024
ecbaa63
replaced conda package with environment.yml file
anwarMZ Jan 5, 2024
09adb41
py-test to nf-test migration
anwarMZ Jan 5, 2024
8e0a159
Merge branch 'master' into 4480-new-module-chewbbacacreateschema
anwarMZ Jan 5, 2024
7440455
add stub and update tests, snapshot
sateeshperi Jan 6, 2024
bf830ed
updated stub
anwarMZ Jan 8, 2024
36248be
Merge branch 'master' into 4480-new-module-chewbbacacreateschema
anwarMZ Jan 8, 2024
447baee
update stub test
anwarMZ Jan 8, 2024
210db7a
update stub test
anwarMZ Jan 8, 2024
e0dd0ed
Merge branch 'master' into 4480-new-module-chewbbacacreateschema
anwarMZ Jan 8, 2024
44e6f0b
Merge branch 'master' into 4480-new-module-chewbbacacreateschema
anwarMZ Jan 25, 2024
ac04372
bump the version
anwarMZ Jan 25, 2024
77c6a38
update
anwarMZ Jan 25, 2024
6589238
Merge branch 'master' into 4480-new-module-chewbbacacreateschema
anwarMZ Jan 26, 2024
289d79a
Merge branch 'master' into 4480-new-module-chewbbacacreateschema
anwarMZ Jan 26, 2024
8c89550
updating container version
anwarMZ Jan 26, 2024
fc23220
updated test snapshot
anwarMZ Jan 26, 2024
f03ed0d
updated nf-test snapshot
anwarMZ Jan 26, 2024
fc6abd0
added libmamba to environment file
anwarMZ Jan 30, 2024
551485d
Merge branch 'master' into 4480-new-module-chewbbacacreateschema
SPPearce May 6, 2024
f53b8e0
Merge branch 'master' into 4480-new-module-chewbbacacreateschema
SPPearce Jun 3, 2024
be3e472
Merge branch 'master' into 4480-new-module-chewbbacacreateschema
SPPearce Jun 11, 2024
736b183
Fix tests and linting
SPPearce Jun 11, 2024
d16dd9d
Merge branch 'master' into 4480-new-module-chewbbacacreateschema
SPPearce Jun 13, 2024
7c6cf54
Update modules/nf-core/chewbbaca/createschema/main.nf
SPPearce Jul 2, 2024
9131d1e
Apply suggestions from code review
SPPearce Jul 2, 2024
8a88ace
Merge branch 'master' into 4480-new-module-chewbbacacreateschema
JoseEspinosa Jul 2, 2024
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
63 changes: 63 additions & 0 deletions modules/nf-core/chewbbaca/createschema/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
process CHEWBBACA_CREATESCHEMA {
tag "$meta.id"
label 'process_low'

conda "bioconda::chewbbaca=3.3.1"
sateeshperi marked this conversation as resolved.
Show resolved Hide resolved
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/chewbbaca:3.3.1--pyhdfd78af_0':
'biocontainers/chewbbaca:3.3.1--pyhdfd78af_0' }"

input:
tuple val(meta), path(fasta, stageAs: "input_genomes/*")
path prodigal_tf
path cds

output:
path 'results/*' , emit: schema
path "results/cds_coordinates.tsv" , emit: cds_coordinates
path "results/invalid_cds.txt" , emit: invalid_cds
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 schema = "--n ${prefix}"
def prodigal_tf = prodigal_tf ? "--ptf ${prodigal_tf}" : ""
def cds = cds ? "--cds ${cds}" : ""

"""
find ./input_genomes/ -name "*.gz" | sed 's/.gz//' | xargs -I {} bash -c 'gzip -cdf {}.gz > {}'

chewie \\
CreateSchema \\
-i input_genomes/ \\
-o results \\
$schema \\
$args \\
$prodigal_tf \\
$cds \\
--cpu $task.cpus
sateeshperi marked this conversation as resolved.
Show resolved Hide resolved

cat <<-END_VERSIONS > versions.yml
"${task.process}":
chewbbaca: \$(echo \$(chewie --version 2>&1 | sed 's/^.*chewBBACA version: //g; s/Using.*\$//' ))
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def schema = "--n ${prefix}"

"""
mkdir -p results/$schema

cat <<-END_VERSIONS > versions.yml
"${task.process}":
chewbbaca: \$(echo \$(chewie --version 2>&1 | sed 's/^.*chewBBACA version: //g; s/Using.*\$//' ))
END_VERSIONS
"""
}
63 changes: 63 additions & 0 deletions modules/nf-core/chewbbaca/createschema/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
sateeshperi marked this conversation as resolved.
Show resolved Hide resolved
name: "chewbbaca_createschema"
sateeshperi marked this conversation as resolved.
Show resolved Hide resolved
description: Create a schema to determine the allelic profiles of a genome
keywords:
- cgMLST
- WGS
- genomics
tools:
- "chewbbaca":
sateeshperi marked this conversation as resolved.
Show resolved Hide resolved
description: "A complete suite for gene-by-gene schema creation and strain identification."
homepage: "https://chewbbaca.readthedocs.io/en/latest/index.html"
documentation: "https://chewbbaca.readthedocs.io/en/latest/index.html"
tool_dev_url: "https://github.com/B-UMMI/chewBBACA"
doi: "10.1099/mgen.0.000166"
licence: ["GPL v3"]

## TODO nf-core: Add a description of all of the variables used as input
input:
# Only when we have meta
sateeshperi marked this conversation as resolved.
Show resolved Hide resolved
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'test', single_end:false ]`

- fasta:
type: directory
description: One or multiple FASTA files to create schema from
pattern: "*.{fasta,fa,fas,fna,fasta.gz,fa.gz,fas.gz,fna.gz}"

- prodigal_tf:
type: file
description: File containing the prodigal training file
pattern: "*.ptf"

- cds:
type: file
description: File containing the prodigal cds file
pattern: "*.cds"

## TODO nf-core: Add a description of all of the variables used as output
anwarMZ marked this conversation as resolved.
Show resolved Hide resolved
output:
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"

- schema_dir:
type: directory
description: schema directory
SPPearce marked this conversation as resolved.
Show resolved Hide resolved
pattern: "*/"

- tsv:
type: file
description: file contains the coordinates of the CDS in the input sample
SPPearce marked this conversation as resolved.
Show resolved Hide resolved
pattern: "*_cds_coordinates.tsv"
- txt:
type: file
description: file contains the list of alleles predicted by Prodigal that were excluded
SPPearce marked this conversation as resolved.
Show resolved Hide resolved
pattern: "*_invalid_cds.txt"

authors:
- "@anwarMZ"
4 changes: 4 additions & 0 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,10 @@ checkv/updatedatabase:
- modules/nf-core/checkv/updatedatabase/**
- tests/modules/nf-core/checkv/updatedatabase/**

chewbbaca/createschema:
- modules/nf-core/chewbbaca/createschema/**
- tests/modules/nf-core/chewbbaca/createschema/**

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

sateeshperi marked this conversation as resolved.
Show resolved Hide resolved
nextflow.enable.dsl = 2

include { CHEWBBACA_CREATESCHEMA } from '../../../../../modules/nf-core/chewbbaca/createschema/main.nf'

workflow test_chewbbaca_createschema {

input = [
[ id:'test', single_end:false ], // meta map
file(params.test_data['sarscov2']['illumina']['contigs_fasta'], checkIfExists: true)]
ptf = []
cds = []

CHEWBBACA_CREATESCHEMA ( input, ptf, cds)
}

workflow test_chewbbaca_createschema_multi {

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

CHEWBBACA_CREATESCHEMA ( input, ptf, cds)
}

workflow test_chewbbaca_createschema_gz {

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

CHEWBBACA_CREATESCHEMA ( input, ptf, cds)
}
5 changes: 5 additions & 0 deletions tests/modules/nf-core/chewbbaca/createschema/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()}" }

}
Loading
Loading