Skip to content

Commit

Permalink
Merge pull request #210 from UPHL-BioNGS/update20240626
Browse files Browse the repository at this point in the history
Update20240626
  • Loading branch information
erinyoung authored Jun 27, 2024
2 parents 582df26 + 1a34385 commit 036787a
Show file tree
Hide file tree
Showing 17 changed files with 221 additions and 166 deletions.
2 changes: 1 addition & 1 deletion modules/local/bbduk.nf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ process bbduk {
label "process_medium"
publishDir params.outdir, mode: 'copy', saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
container 'staphb/bbtools:39.01'
//errorStrategy { task.attempt < 2 ? 'retry' : 'ignore'}
errorStrategy { task.attempt < 2 ? 'retry' : 'ignore'}
time '10m'

input:
Expand Down
2 changes: 1 addition & 1 deletion modules/local/datasets.nf
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ process datasets_download {
// because there's no way to specify threads
label "process_medium"
publishDir path: "${params.outdir}", mode: 'copy', pattern: "logs/*/*log"
container 'staphb/ncbi-datasets:16.10.3'
container 'staphb/ncbi-datasets:16.15.0'
time '5h'
errorStrategy { task.attempt < 2 ? 'retry' : 'ignore'}

Expand Down
6 changes: 3 additions & 3 deletions modules/local/drprg.nf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ process drprg {
errorStrategy { task.attempt < 2 ? 'retry' : 'ignore'}

input:
tuple val(meta), file(contigs), val(flag)
tuple val(meta), file(contigs)

output:
tuple val(meta), val("drprg"), file("drprg/*/*.drprg.json"), emit: json
Expand All @@ -17,7 +17,7 @@ process drprg {
path "versions.yml", emit: versions

when:
(task.ext.when == null || task.ext.when) && flag =~ 'found'
(task.ext.when == null || task.ext.when)

shell:
def args = task.ext.args ?: ''
Expand All @@ -35,7 +35,7 @@ process drprg {
cat <<-END_VERSIONS > versions.yml
"${task.process}":
drprg: \$( drprg --version )
drprg: \$( drprg --version | awk '{print \$NF}')
END_VERSIONS
"""
}
4 changes: 2 additions & 2 deletions modules/local/elgato.nf
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ process elgato {
errorStrategy { task.attempt < 2 ? 'retry' : 'ignore'}

input:
tuple val(meta), file(contigs), val(flag)
tuple val(meta), file(contigs)

output:
path "elgato/*/possible_mlsts.txt", emit: collect
path "logs/${task.process}/*.log" , emit: log
path "versions.yml" , emit: versions

when:
(task.ext.when == null || task.ext.when) && flag =~ 'found'
(task.ext.when == null || task.ext.when)

shell:
def args = task.ext.args ?: ''
Expand Down
4 changes: 2 additions & 2 deletions modules/local/emmtyper.nf
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ process emmtyper {
errorStrategy { task.attempt < 2 ? 'retry' : 'ignore'}

when:
(task.ext.when == null || task.ext.when) && flag =~ 'found'
(task.ext.when == null || task.ext.when)

input:
tuple val(meta), file(contigs), val(flag), file(script)
tuple val(meta), file(contigs), file(script)

output:
path "emmtyper/*_emmtyper.txt" , emit: collect
Expand Down
2 changes: 1 addition & 1 deletion modules/local/iqtree2.nf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ process iqtree2 {
tag "Phylogenetic analysis"
label "process_high"
publishDir params.outdir, mode: 'copy', saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
container 'staphb/iqtree2:2.3.1'
container 'staphb/iqtree2:2.3.4'
time '24h'
errorStrategy { task.attempt < 2 ? 'retry' : 'ignore'}

Expand Down
4 changes: 2 additions & 2 deletions modules/local/kaptive.nf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ process kaptive {
errorStrategy { task.attempt < 2 ? 'retry' : 'ignore'}

input:
tuple val(meta), file(contigs), val(flag)
tuple val(meta), file(contigs)

output:
path "kaptive/${meta.id}_table.txt", emit: collect
Expand All @@ -17,7 +17,7 @@ process kaptive {
path "versions.yml", emit: versions

when:
(task.ext.when == null || task.ext.when) && flag =~ 'found'
(task.ext.when == null || task.ext.when)

shell:
def args = task.ext.args ?: ''
Expand Down
4 changes: 2 additions & 2 deletions modules/local/kleborate.nf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ process kleborate {
errorStrategy { task.attempt < 2 ? 'retry' : 'ignore'}

input:
tuple val(meta), file(contig), val(flag), file(script)
tuple val(meta), file(contig), file(script)

output:
path "kleborate/*_results.tsv" , emit: collect, optional: true
Expand All @@ -16,7 +16,7 @@ process kleborate {
path "versions.yml" , emit: versions

when:
(task.ext.when == null || task.ext.when) && flag =~ 'found'
(task.ext.when == null || task.ext.when)

shell:
def args = task.ext.args ?: '--all'
Expand Down
106 changes: 1 addition & 105 deletions modules/local/local.nf
Original file line number Diff line number Diff line change
Expand Up @@ -65,110 +65,6 @@ process download_sra {
"""
}

process flag {
tag "${meta.id}"
label "process_single"
//no publishDir params.outdir, mode: 'copy'
container 'quay.io/biocontainers/pandas:1.5.2'
time '10m'
errorStrategy { task.attempt < 2 ? 'retry' : 'ignore'}

input:
tuple val(meta), file(files)

output:
tuple val(meta), file("${files[0]}"), env(salmonella_flag) , emit: salmonella_flag
tuple val(meta), file("${files[0]}"), env(klebsiella_flag) , emit: klebsiella_flag
tuple val(meta), file("${files[0]}"), env(ecoli_flag) , emit: ecoli_flag
tuple val(meta), file("${files[0]}"), env(streppneu_flag) , emit: streppneu_flag
tuple val(meta), file("${files[0]}"), env(legionella_flag) , emit: legionella_flag
tuple val(meta), file("${files[0]}"), env(klebacin_flag) , emit: klebacin_flag
tuple val(meta), file("${files[0]}"), env(strepa_flag) , emit: strepa_flag
tuple val(meta), file("${files[0]}"), env(vibrio_flag) , emit: vibrio_flag
tuple val(meta), file("${files[0]}"), env(myco_flag) , emit: myco_flag
tuple val(meta), file("${files[0]}"), env(genus), env(species), emit: organism
path "flag/*_flag.csv", emit: collect
path "logs/${task.process}/*.log", emit: log_files

shell:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
mkdir -p flag logs/${task.process}
log_file=logs/${task.process}/${prefix}.${workflow.sessionId}.log
if [ -f "${prefix}_fastani.csv" ]
then
awk -F "," '{if (\$4 > 90) print \$0}' ${prefix}_fastani.csv > smaller_fastani.csv
genus=\$(head -n 2 ${prefix}_fastani.csv | tail -n 1 | cut -f 3 -d , | cut -f 1 -d "_")
species=\$(head -n 2 ${prefix}_fastani.csv | tail -n 1 | cut -f 3 -d , | cut -f 2 -d "_")
else
touch smaller_fastani.csv
genus="unknown"
species="unknown"
fi
touch ${prefix}_reads_summary_kraken2.csv ${prefix}.summary.mash.csv ${prefix}_blobtools.txt
files="smaller_fastani.csv ${prefix}_reads_summary_kraken2.csv ${prefix}.summary.mash.csv ${prefix}_blobtools.txt"
echo "Looking for Salmonella:" >> \$log_file
salmonella_flag=''
find_salmonella=\$(head -n 10 \$files | grep "Salmonella" | tee -a \$log_file | head -n 1 )
if [ -n "\$find_salmonella" ] ; then salmonella_flag="found" ; else salmonella_flag="not" ; fi
echo "Looking for E. coli and Shigella:" >> \$log_file
ecoli_flag=''
find_ecoli=\$(head -n 10 \$files | grep -e "Escherichia" -e "Shigella" | tee -a \$log_file | head -n 1 )
if [ -n "\$find_ecoli" ] ; then ecoli_flag="found" ; else ecoli_flag="not" ; fi
echo "Looking for Klebsiella:" >> \$log_file
klebsiella_flag=''
find_klebsiella=\$(head -n 10 \$files | grep -e "Klebsiella" -e "Enterobacter" -e "Serratia" | tee -a \$log_file | head -n 1 )
if [ -n "\$find_klebsiella" ] ; then klebsiella_flag="found" ; else klebsiella_flag="not" ; fi
echo "Looking for Strep A organisms:" >> \$log_file
strepa_flag=''
find_strepa=\$(head -n 10 \$files | grep "Streptococcus" | grep -e "pyogenes" -e "dysgalactiae" -e "anginosus" | tee -a \$log_file | head -n 1 )
if [ -n "\$find_strepa" ] ; then strepa_flag='found' ; else strepa_flag='not' ; fi
echo "Looking for Streptococcus pneumoniae organisms:" >> \$log_file
streppneu_flag_flag=''
find_streppneu=\$(head -n 10 \$files | grep "Streptococcus" | grep "pneumoniae" | tee -a \$log_file | head -n 1 )
if [ -n "\$find_streppneu" ] ; then streppneu_flag='found' ; else streppneu_flag='not' ; fi
echo "Looking for Legionella organisms:" >> \$log_file
legionella_flag=''
find_legionella=\$(head -n 10 \$files | grep "Legionella" | tee -a \$log_file | head -n 1 )
if [ -n "\$find_legionella" ] ; then legionella_flag='found' ; else legionella_flag='not' ; fi
echo "Looking for Vibrio organisms:" >> \$log_file
vibrio_flag=''
find_vibrio=\$(head -n 10 \$files | grep "Vibrio" | tee -a \$log_file | head -n 1 )
if [ -n "\$find_vibrio" ] ; then vibrio_flag='found' ; else vibrio_flag='not' ; fi
echo "Looking for Klebsiella or Acinetobacter:" >> \$log_file
klebacin_flag=''
if [ -n "\$find_klebsiella" ]
then
klebacin_flag='found'
else
find_acin=\$(head -n 10 \$files | grep "Acinetobacter" | tee -a \$log_file | head -n 1 )
if [ -n "\$find_acin" ] ; then klebacin_flag='found' ; else klebacin_flag='not' ; fi
fi
echo "Looking for Mycobacterium/Mycobacteria"
myco_flag=''
find_myco=\$(head -n 10 \$files | grep "Mycobacteri" | tee -a \$log_file | head -n 1 )
if [ -n "\$find_myco" ] ; then myco_flag='found' ; else myco_flag='not' ; fi
if [ -z "\$genus" ] ; then genus=unknown ; fi
if [ -z "\$species" ] ; then species=unknown ; fi
echo "sample,genus,species,salmonella_flag,ecoli_flag,klebsiella_flag,klebacin_flag,myco_flag,strepa_flag,streppneu_flag,legionella_flag,vibrio_flag" > flag/${prefix}_flag.csv
echo "${prefix},\$genus,\$species,\$salmonella_flag,\$ecoli_flag,\$klebsiella_flag,\$klebacin_flag,\$myco_flag,\$strepa_flag,\$streppneu_flag,\$legionella_flag,\$vibrio_flag" >> flag/${prefix}_flag.csv
"""
}

process json_convert {
tag "${meta.id}"
label "process_single"
Expand Down Expand Up @@ -278,7 +174,7 @@ process references {
tag "Preparing references"
// no publishDir
label "process_single"
container 'quay.io/uphl/grandeur_ref:2024-03-07'
container 'quay.io/uphl/grandeur_ref:2024-06-26'
time '10m'
errorStrategy { task.attempt < 2 ? 'retry' : 'ignore'}

Expand Down
2 changes: 1 addition & 1 deletion modules/local/mlst.nf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ process mlst {
tag "${meta.id}"
label "process_medium"
publishDir params.outdir, mode: 'copy', saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
container 'staphb/mlst:2.23.0-2024-05-01'
container 'staphb/mlst:2.23.0-2024-06-01'
maxForks 10
errorStrategy { task.attempt < 2 ? 'retry' : 'ignore'}
time '10m'
Expand Down
4 changes: 2 additions & 2 deletions modules/local/mykrobe.nf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ process mykrobe {
errorStrategy { task.attempt < 2 ? 'retry' : 'ignore'}

input:
tuple val(meta), file(contigs), val(flag)
tuple val(meta), file(contigs)

output:
path "mykrobe/*.csv", emit: collect
Expand All @@ -17,7 +17,7 @@ process mykrobe {
path "versions.yml", emit: versions

when:
(task.ext.when == null || task.ext.when) && flag =~ 'found'
(task.ext.when == null || task.ext.when)

shell:
def args = task.ext.args ?: ''
Expand Down
4 changes: 2 additions & 2 deletions modules/local/pbptyper.nf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ process pbptyper {
errorStrategy { task.attempt < 2 ? 'retry' : 'ignore'}

input:
tuple val(meta), file(contigs), val(flag)
tuple val(meta), file(contigs)

output:
path "pbptyper/${meta.id}.tsv" , emit: collect
Expand All @@ -17,7 +17,7 @@ process pbptyper {
path "versions.yml" , emit: versions

when:
(task.ext.when == null || task.ext.when) && flag =~ 'found'
(task.ext.when == null || task.ext.when)

shell:
def args = task.ext.args ?: ''
Expand Down
4 changes: 2 additions & 2 deletions modules/local/seqsero2.nf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ process seqsero2 {
errorStrategy { task.attempt < 2 ? 'retry' : 'ignore'}

input:
tuple val(meta), file(file), val(flag)
tuple val(meta), file(file)

output:
path "seqsero2/*/*" , emit: files
Expand All @@ -16,7 +16,7 @@ process seqsero2 {
path "versions.yml" , emit: versions

when:
(task.ext.when == null || task.ext.when) && flag =~ 'found'
(task.ext.when == null || task.ext.when)

shell:
def args = task.ext.args ?: '-m a -b mem'
Expand Down
4 changes: 2 additions & 2 deletions modules/local/serotypefinder.nf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ process serotypefinder {
errorStrategy { task.attempt < 2 ? 'retry' : 'ignore'}

input:
tuple val(meta), file(file), val(flag), file(script)
tuple val(meta), file(file), file(script)

output:
path "serotypefinder/*/*" , emit: files
Expand All @@ -17,7 +17,7 @@ process serotypefinder {
path "versions.yml" , emit: versions

when:
(task.ext.when == null || task.ext.when) && flag =~ 'found'
(task.ext.when == null || task.ext.when)

shell:
def args = task.ext.args ?: ''
Expand Down
4 changes: 2 additions & 2 deletions modules/local/shigatyper.nf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ process shigatyper {
time '10m'

input:
tuple val(meta), file(input), val(flag), file(script)
tuple val(meta), file(input), file(script)

output:
path "shigatyper/*_shigatyper.tsv", optional: true, emit: files
Expand All @@ -17,7 +17,7 @@ process shigatyper {
path "versions.yml", emit: versions

when:
(task.ext.when == null || task.ext.when) && flag =~ 'found'
(task.ext.when == null || task.ext.when)

shell:
def args = task.ext.args ?: ''
Expand Down
2 changes: 1 addition & 1 deletion nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ manifest {
author = 'Erin Young'
homePage = 'https://github.com/UPHL-BioNGS/Grandeur'
mainScript = 'main.nf'
version = '4.4.240521'
version = '4.5.240626'
defaultBranch = 'main'
description = 'Grandeur is short-read de novo assembly pipeline with serotyping.'
nextflowVersion = '!>=22.10.1'
Expand Down
Loading

0 comments on commit 036787a

Please sign in to comment.