Skip to content

Commit

Permalink
Tag outputs with assembler name (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
dfornika authored Dec 1, 2021
1 parent 0c7c16b commit 7b2c6f6
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 34 deletions.
22 changes: 11 additions & 11 deletions modules/bakta.nf
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@ process bakta {
publishDir "${params.outdir}/${sample_id}", pattern: "${sample_id}*.{gbk,gff,json,log}", mode: 'copy'

input:
tuple val(sample_id), path(assembly)
tuple val(sample_id), path(assembly), val(assembler)

output:
tuple val(sample_id), path("${sample_id}_bakta.gbk"), emit: gbk
tuple val(sample_id), path("${sample_id}_bakta.gff"), emit: gff
tuple val(sample_id), path("${sample_id}_bakta.json"), emit: json
tuple val(sample_id), path("${sample_id}_bakta.log"), emit: log
tuple val(sample_id), path("${sample_id}_bakta_provenance.yml"), emit: provenance
tuple val(sample_id), path("${sample_id}_${assembler}_bakta.gbk"), emit: gbk
tuple val(sample_id), path("${sample_id}_${assembler}_bakta.gff"), emit: gff
tuple val(sample_id), path("${sample_id}_${assembler}_bakta.json"), emit: json
tuple val(sample_id), path("${sample_id}_${assembler}_bakta.log"), emit: log
tuple val(sample_id), path("${sample_id}_${assembler}_bakta_provenance.yml"), emit: provenance

script:
"""
printf -- "- tool_name: bakta\\n tool_version: \$(bakta --version | cut -d ' ' -f 2)\\n" > ${sample_id}_bakta_provenance.yml
printf -- "- tool_name: bakta\\n tool_version: \$(bakta --version | cut -d ' ' -f 2)\\n" > ${sample_id}_${assembler}_bakta_provenance.yml
bakta --db ${params.bakta_db} --threads ${task.cpus} --compliant --keep-contig-headers --locus-tag ${sample_id} --prefix "${sample_id}" ${assembly}
cp ${sample_id}.gff3 ${sample_id}_bakta.gff
cp ${sample_id}.gbff ${sample_id}_bakta.gbk
cp ${sample_id}.json ${sample_id}_bakta.json
cp ${sample_id}.log ${sample_id}_bakta.log
cp ${sample_id}.gff3 ${sample_id}_${assembler}_bakta.gff
cp ${sample_id}.gbff ${sample_id}_${assembler}_bakta.gbk
cp ${sample_id}.json ${sample_id}_${assembler}_bakta.json
cp ${sample_id}.log ${sample_id}_${assembler}_bakta.log
"""
}
16 changes: 8 additions & 8 deletions modules/prokka.nf
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@ process prokka {

tag { sample_id }

publishDir "${params.outdir}/${sample_id}", pattern: "${sample_id}_prokka.{gbk,gff}", mode: 'copy'
publishDir "${params.outdir}/${sample_id}", pattern: "${sample_id}_${assembler}_prokka.{gbk,gff}", mode: 'copy'

input:
tuple val(sample_id), path(assembly)
tuple val(sample_id), path(assembly), val(assembler)

output:
tuple val(sample_id), path("${sample_id}_prokka.gbk"), emit: gbk
tuple val(sample_id), path("${sample_id}_prokka.gff"), emit: gff
tuple val(sample_id), path("${sample_id}_prokka_provenance.yml"), emit: provenance
tuple val(sample_id), path("${sample_id}_${assembler}_prokka.gbk"), emit: gbk
tuple val(sample_id), path("${sample_id}_${assembler}_prokka.gff"), emit: gff
tuple val(sample_id), path("${sample_id}_${assembler}_prokka_provenance.yml"), emit: provenance

script:
"""
printf -- "- tool_name: prokka\\n tool_version: \$(prokka --version 2>&1 | cut -d ' ' -f 2)\\n" > ${sample_id}_prokka_provenance.yml
printf -- "- tool_name: prokka\\n tool_version: \$(prokka --version 2>&1 | cut -d ' ' -f 2)\\n" > ${sample_id}_${assembler}_prokka_provenance.yml
prokka --cpus ${task.cpus} --compliant --locustag ${sample_id} --centre "BCCDC-PHL" --prefix "${sample_id}" ${assembly}
cp ${sample_id}/${sample_id}.gbk ${sample_id}_prokka.gbk
cp ${sample_id}/${sample_id}.gff ${sample_id}_prokka.gff
cp ${sample_id}/${sample_id}.gbk ${sample_id}_${assembler}_prokka.gbk
cp ${sample_id}/${sample_id}.gff ${sample_id}_${assembler}_prokka.gff
"""
}
22 changes: 10 additions & 12 deletions modules/quast.nf
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,20 @@ process quast {

tag { sample_id }

publishDir "${params.outdir}/${sample_id}", pattern: "${sample_id}_quast.tsv", mode: 'copy'

cpus 2
publishDir "${params.outdir}/${sample_id}", pattern: "${sample_id}_${assembler}_quast.tsv", mode: 'copy'

input:
tuple val(sample_id), path(assembly)
tuple val(sample_id), path(assembly), val(assembler)

output:
tuple val(sample_id), path("${sample_id}_quast.tsv"), emit: tsv
tuple val(sample_id), path("${sample_id}_quast_provenance.yml"), emit: provenance
tuple val(sample_id), path("${sample_id}_${assembler}_quast.tsv"), val(assembler), emit: tsv
tuple val(sample_id), path("${sample_id}_${assembler}_quast_provenance.yml"), emit: provenance

script:
"""
printf -- "- tool_name: quast\\n tool_version: \$(quast --version | cut -d ' ' -f 2)\\n" > ${sample_id}_quast_provenance.yml
printf -- "- tool_name: quast\\n tool_version: \$(quast --version | cut -d ' ' -f 2)\\n" > ${sample_id}_${assembler}_quast_provenance.yml
quast --threads ${task.cpus} ${assembly} --space-efficient --fast --output-dir ${sample_id}
mv ${sample_id}/transposed_report.tsv ${sample_id}_quast.tsv
mv ${sample_id}/transposed_report.tsv ${sample_id}_${assembler}_quast.tsv
"""
}

Expand All @@ -27,16 +25,16 @@ process parse_quast_report {

executor 'local'

publishDir "${params.outdir}/${sample_id}", pattern: "${sample_id}_quast.json", mode: 'copy'
publishDir "${params.outdir}/${sample_id}", pattern: "${sample_id}_${assembler}_quast.json", mode: 'copy'

input:
tuple val(sample_id), path(quast_report)
tuple val(sample_id), path(quast_report), val(assembler)

output:
tuple val(sample_id), path("${sample_id}_quast.json")
tuple val(sample_id), path("${sample_id}_${assembler}_quast.json")

script:
"""
parse_quast_report.py ${quast_report} > ${sample_id}_quast.json
parse_quast_report.py ${quast_report} > ${sample_id}_${assembler}_quast.json
"""
}
2 changes: 1 addition & 1 deletion modules/shovill.nf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ process shovill {
tuple val(sample_id), path(reads_1), path(reads_2)

output:
tuple val(sample_id), path("${sample_id}_shovill.fa"), emit: assembly
tuple val(sample_id), path("${sample_id}_shovill.fa"), val("shovill"), emit: assembly
tuple val(sample_id), path("${sample_id}_shovill.log"), emit: log
tuple val(sample_id), path("${sample_id}_shovill_provenance.yml"), emit: provenance

Expand Down
2 changes: 1 addition & 1 deletion modules/unicycler.nf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ process unicycler {
tuple val(sample_id), path(reads_1), path(reads_2)

output:
tuple val(sample_id), path("${sample_id}_unicycler.fa"), emit: assembly
tuple val(sample_id), path("${sample_id}_unicycler.fa"), val("unicycler"), emit: assembly
tuple val(sample_id), path("${sample_id}_unicycler.gfa"), emit: assembly_graph
tuple val(sample_id), path("${sample_id}_unicycler.log"), emit: log
tuple val(sample_id), path("${sample_id}_unicycler_provenance.yml"), emit: provenance
Expand Down
5 changes: 4 additions & 1 deletion nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ profiles {
process.shell = ['/bin/bash', '-euo', 'pipefail']

process {
withName: quast {
cpus = 2
}
withName: fastp {
cpus = 4
}
Expand All @@ -57,7 +60,7 @@ process {
manifest {
author = 'Dan Fornika'
name = 'BCCDC-PHL/routine-assembly'
version = '0.2.0'
version = '0.2.1'
description = 'BCCDC-PHL Routine Assembly'
mainScript = 'main.nf'
nextflowVersion = '>=20.01.0'
Expand Down

0 comments on commit 7b2c6f6

Please sign in to comment.