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

Ensure checking dbs filepaths exist #442

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
119 changes: 61 additions & 58 deletions subworkflows/local/annotation.nf
Original file line number Diff line number Diff line change
Expand Up @@ -19,72 +19,75 @@ workflow ANNOTATION {
fasta // tuple val(meta), path(contigs)

main:
ch_versions = Channel.empty()
ch_versions = Channel.empty()
ch_multiqc_files = Channel.empty()

if ( params.annotation_tool == "pyrodigal" || ( params.annotation_tool == "prodigal" && params.run_bgc_screening == true && ( !params.bgc_skip_antismash || !params.bgc_skip_deepbgc || !params.bgc_skip_gecco ) ) || ( params.annotation_tool == "prodigal" && params.run_amp_screening == true ) ) { // Need to use Pyrodigal for most BGC tools and AMPcombi because Prodigal GBK annotation format is incompatible with them.
if (params.annotation_tool == "pyrodigal" || (params.annotation_tool == "prodigal" && params.run_bgc_screening == true && (!params.bgc_skip_antismash || !params.bgc_skip_deepbgc || !params.bgc_skip_gecco)) || (params.annotation_tool == "prodigal" && params.run_amp_screening == true)) {
// Need to use Pyrodigal for most BGC tools and AMPcombi because Prodigal GBK annotation format is incompatible with them.

if ( params.annotation_tool == "prodigal" && params.run_bgc_screening == true && ( !params.bgc_skip_antismash || !params.bgc_skip_deepbgc || !params.bgc_skip_gecco ) ) {
log.warn("[nf-core/funcscan] Switching annotation tool to: Pyrodigal. This is because Prodigal annotations (in GBK format) are incompatible with antiSMASH, DeepBGC, and GECCO. If you specifically wish to run Prodigal instead, please skip antiSMASH, DeepBGC, and GECCO or provide a pre-annotated GBK file in the samplesheet.")
} else if ( params.annotation_tool == "prodigal" && params.run_amp_screening == true ) {
log.warn("[nf-core/funcscan] Switching annotation tool to: Pyrodigal. This is because Prodigal annotations (in GBK format) are incompatible with AMPcombi. If you specifically wish to run Prodigal instead, please skip AMP workflow or provide a pre-annotated GBK file in the samplesheet.")
}

PYRODIGAL ( fasta, "gbk" )
GUNZIP_PYRODIGAL_FAA ( PYRODIGAL.out.faa )
GUNZIP_PYRODIGAL_FNA ( PYRODIGAL.out.fna)
GUNZIP_PYRODIGAL_GBK ( PYRODIGAL.out.annotations )
ch_versions = ch_versions.mix(PYRODIGAL.out.versions)
ch_versions = ch_versions.mix(GUNZIP_PYRODIGAL_FAA.out.versions)
ch_versions = ch_versions.mix(GUNZIP_PYRODIGAL_FNA.out.versions)
ch_versions = ch_versions.mix(GUNZIP_PYRODIGAL_GBK.out.versions)
ch_annotation_faa = GUNZIP_PYRODIGAL_FAA.out.gunzip
ch_annotation_fna = GUNZIP_PYRODIGAL_FNA.out.gunzip
ch_annotation_gbk = GUNZIP_PYRODIGAL_GBK.out.gunzip

} else if ( params.annotation_tool == "prodigal" ) {

PRODIGAL ( fasta, "gbk" )
GUNZIP_PRODIGAL_FAA ( PRODIGAL.out.amino_acid_fasta )
GUNZIP_PRODIGAL_FNA ( PRODIGAL.out.nucleotide_fasta)
GUNZIP_PRODIGAL_GBK ( PRODIGAL.out.gene_annotations )
ch_versions = ch_versions.mix(PRODIGAL.out.versions)
ch_versions = ch_versions.mix(GUNZIP_PRODIGAL_FAA.out.versions)
ch_versions = ch_versions.mix(GUNZIP_PRODIGAL_FNA.out.versions)
ch_versions = ch_versions.mix(GUNZIP_PRODIGAL_GBK.out.versions)
ch_annotation_faa = GUNZIP_PRODIGAL_FAA.out.gunzip
ch_annotation_fna = GUNZIP_PRODIGAL_FNA.out.gunzip
ch_annotation_gbk = GUNZIP_PRODIGAL_GBK.out.gunzip

} else if ( params.annotation_tool == "prokka" ) {
if (params.annotation_tool == "prodigal" && params.run_bgc_screening == true && (!params.bgc_skip_antismash || !params.bgc_skip_deepbgc || !params.bgc_skip_gecco)) {
log.warn("[nf-core/funcscan] Switching annotation tool to: Pyrodigal. This is because Prodigal annotations (in GBK format) are incompatible with antiSMASH, DeepBGC, and GECCO. If you specifically wish to run Prodigal instead, please skip antiSMASH, DeepBGC, and GECCO or provide a pre-annotated GBK file in the samplesheet.")
}
else if (params.annotation_tool == "prodigal" && params.run_amp_screening == true) {
log.warn("[nf-core/funcscan] Switching annotation tool to: Pyrodigal. This is because Prodigal annotations (in GBK format) are incompatible with AMPcombi. If you specifically wish to run Prodigal instead, please skip AMP workflow or provide a pre-annotated GBK file in the samplesheet.")
}

PROKKA ( fasta, [], [] )
ch_versions = ch_versions.mix(PROKKA.out.versions)
ch_multiqc_files = PROKKA.out.txt.collect{it[1]}.ifEmpty([])
ch_annotation_faa = PROKKA.out.faa
ch_annotation_fna = PROKKA.out.fna
ch_annotation_gbk = PROKKA.out.gbk
PYRODIGAL(fasta, "gbk")
GUNZIP_PYRODIGAL_FAA(PYRODIGAL.out.faa)
GUNZIP_PYRODIGAL_FNA(PYRODIGAL.out.fna)
GUNZIP_PYRODIGAL_GBK(PYRODIGAL.out.annotations)
ch_versions = ch_versions.mix(PYRODIGAL.out.versions)
ch_versions = ch_versions.mix(GUNZIP_PYRODIGAL_FAA.out.versions)
ch_versions = ch_versions.mix(GUNZIP_PYRODIGAL_FNA.out.versions)
ch_versions = ch_versions.mix(GUNZIP_PYRODIGAL_GBK.out.versions)
ch_annotation_faa = GUNZIP_PYRODIGAL_FAA.out.gunzip
ch_annotation_fna = GUNZIP_PYRODIGAL_FNA.out.gunzip
ch_annotation_gbk = GUNZIP_PYRODIGAL_GBK.out.gunzip
}
else if (params.annotation_tool == "prodigal") {

} else if ( params.annotation_tool == "bakta" ) {
PRODIGAL(fasta, "gbk")
GUNZIP_PRODIGAL_FAA(PRODIGAL.out.amino_acid_fasta)
GUNZIP_PRODIGAL_FNA(PRODIGAL.out.nucleotide_fasta)
GUNZIP_PRODIGAL_GBK(PRODIGAL.out.gene_annotations)
ch_versions = ch_versions.mix(PRODIGAL.out.versions)
ch_versions = ch_versions.mix(GUNZIP_PRODIGAL_FAA.out.versions)
ch_versions = ch_versions.mix(GUNZIP_PRODIGAL_FNA.out.versions)
ch_versions = ch_versions.mix(GUNZIP_PRODIGAL_GBK.out.versions)
ch_annotation_faa = GUNZIP_PRODIGAL_FAA.out.gunzip
ch_annotation_fna = GUNZIP_PRODIGAL_FNA.out.gunzip
ch_annotation_gbk = GUNZIP_PRODIGAL_GBK.out.gunzip
}
else if (params.annotation_tool == "prokka") {

// BAKTA prepare download
if ( params.annotation_bakta_db ) {
ch_bakta_db = Channel
.fromPath( params.annotation_bakta_db )
.first()
} else {
BAKTA_BAKTADBDOWNLOAD ( )
ch_versions = ch_versions.mix( BAKTA_BAKTADBDOWNLOAD.out.versions )
ch_bakta_db = ( BAKTA_BAKTADBDOWNLOAD.out.db )
}
PROKKA(fasta, [], [])
ch_versions = ch_versions.mix(PROKKA.out.versions)
ch_multiqc_files = PROKKA.out.txt.collect { it[1] }.ifEmpty([])
ch_annotation_faa = PROKKA.out.faa
ch_annotation_fna = PROKKA.out.fna
ch_annotation_gbk = PROKKA.out.gbk
}
else if (params.annotation_tool == "bakta") {

BAKTA_BAKTA ( fasta, ch_bakta_db, [], [] )
ch_versions = ch_versions.mix(BAKTA_BAKTA.out.versions)
ch_multiqc_files = BAKTA_BAKTA.out.txt.collect{it[1]}.ifEmpty([])
ch_annotation_faa = BAKTA_BAKTA.out.faa
ch_annotation_fna = BAKTA_BAKTA.out.fna
ch_annotation_gbk = BAKTA_BAKTA.out.gbff
// BAKTA prepare download
if (params.annotation_bakta_db) {
ch_bakta_db = Channel
.fromPath(params.annotation_bakta_db, checkIfExists: true)
.first()
}
else {
BAKTA_BAKTADBDOWNLOAD()
ch_versions = ch_versions.mix(BAKTA_BAKTADBDOWNLOAD.out.versions)
ch_bakta_db = BAKTA_BAKTADBDOWNLOAD.out.db
}

BAKTA_BAKTA(fasta, ch_bakta_db, [], [])
ch_versions = ch_versions.mix(BAKTA_BAKTA.out.versions)
ch_multiqc_files = BAKTA_BAKTA.out.txt.collect { it[1] }.ifEmpty([])
ch_annotation_faa = BAKTA_BAKTA.out.faa
ch_annotation_fna = BAKTA_BAKTA.out.fna
ch_annotation_gbk = BAKTA_BAKTA.out.gbff
}

emit:
versions = ch_versions
Expand Down
Loading
Loading