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

feat: Add annotation tools param #134

Merged
merged 2 commits into from
Jun 16, 2023
Merged
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
3 changes: 1 addition & 2 deletions conf/test.config
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ params {
use_prokka = true
skip_kraken = true
skip_poppunk = true
skip_phispy = true
light = true
annotation_tools = 'mobsuite,rgi,vfdb'
}

process {
Expand Down
3 changes: 1 addition & 2 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ params {
// Annotation parameters
use_prokka = false
bakta_db = null
light = false
run_integronfinder = false
annotation_tools = 'mobsuite,rgi,cazy,vfdb,iceberg,bacmet,islandpath,phispy'
min_pident = 60
min_qcover = 0.6
skip_phispy = false
Expand Down
18 changes: 7 additions & 11 deletions nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,28 +82,24 @@
"default": "",
"fa_icon": "fas fa-edit",
"properties": {
"annotation_tools": {
"type": "string",
"default": "mobsuite,rgi,cazy,vfdb,iceberg,bacmet,islandpath,phispy",
"fa_icon": "fas fa-tools",
"description": "Comma-separated list of annotation tools to run",
"pattern": "^((rgi|mobsuite|islandpath|phispy|vfdb|cazy|bacmet|iceberg|integronfinder)?,?)*(?<!,)$"
},
"bakta_db": {
"type": "string",
"default": "None",
"fa_icon": "fas fa-database",
"description": "Path to the BAKTA database"
},
"light": {
"type": "boolean",
"description": "Only run one DIAMOND annotation step - against VFDB",
"hidden": true,
"fa_icon": "fas fa-feather-alt"
},
"use_prokka": {
"type": "boolean",
"fa_icon": "fas fa-bacterium",
"description": "Use Prokka (not Bakta) for annotating assemblies"
},
"run_integronfinder": {
"type": "boolean",
"fa_icon": "fas fa-puzzle-piece",
"description": "Run Integron Finder as part of the annotation workflow"
},
"min_pident": {
"type": "integer",
"default": 60,
Expand Down
158 changes: 86 additions & 72 deletions subworkflows/local/annotation.nf
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ workflow ANNOTATE_ASSEMBLIES {
ch_multiqc_files = Channel.empty()
ch_software_versions = Channel.empty()

tools_to_run = params.annotation_tools.split(',')
min_pident = params.min_pident
min_qcover = params.min_qcover
/*
Expand All @@ -83,32 +84,34 @@ workflow ANNOTATE_ASSEMBLIES {
if (vfdb_cache){
vfdb_cache.set { ch_vfdb }
}
else{
else if (tools_to_run.contains('vfdb')) {
GET_VFDB()
GET_VFDB.out.vfdb.set { ch_vfdb }
}
if (!params.light) {
if(bacmet_cache){
bacmet_cache.set { ch_bacmet_db }
}
else{
GET_BACMET()
GET_BACMET.out.bacmet.set { ch_bacmet_db }
}
if (cazydb_cache){
cazydb_cache.set{ ch_cazy_db }
}
else{
GET_CAZYDB()
GET_CAZYDB.out.cazydb.set { ch_cazy_db }
}
if (icebergdb_cache){
icebergdb_cache.set{ ch_iceberg_db }
}
else{
GET_ICEBERG()
GET_ICEBERG.out.iceberg.set { ch_iceberg_db }
}

if(bacmet_cache){
bacmet_cache.set { ch_bacmet_db }
}
else if (tools_to_run.contains('bacmet')) {
GET_BACMET()
GET_BACMET.out.bacmet.set { ch_bacmet_db }
}

if (cazydb_cache){
cazydb_cache.set{ ch_cazy_db }
}
else if (tools_to_run.contains('cazy')) {
GET_CAZYDB()
GET_CAZYDB.out.cazydb.set { ch_cazy_db }
}

if (icebergdb_cache){
icebergdb_cache.set{ ch_iceberg_db }
}

else if (tools_to_run.contains('iceberg')){
GET_ICEBERG()
GET_ICEBERG.out.iceberg.set { ch_iceberg_db }
}
/*
* Load RGI for AMR annotation
Expand All @@ -117,7 +120,7 @@ workflow ANNOTATE_ASSEMBLIES {
card_json_cache.set { ch_card_json }
ch_software_versions = ch_software_versions.mix(card_version_cache)
}
else{
else if (tools_to_run.contains('rgi')) {
UPDATE_RGI_DB()
UPDATE_RGI_DB.out.card_json.set { ch_card_json }
ch_software_versions = ch_software_versions.mix(UPDATE_RGI_DB.out.card_version.ifEmpty(null))
Expand Down Expand Up @@ -184,34 +187,37 @@ workflow ANNOTATE_ASSEMBLIES {
/*
* Run RGI
*/
RGI(ch_ffn_files, ch_card_json)
ch_software_versions = ch_software_versions.mix(RGI.out.version.first().ifEmpty(null))

RGI_ADD_COLUMN(
RGI.out.tsv,
"RGI",
0
)
if (tools_to_run.contains('rgi')) {
RGI(ch_ffn_files, ch_card_json)
ch_software_versions = ch_software_versions.mix(RGI.out.version.first().ifEmpty(null))

RGI_ADD_COLUMN(
RGI.out.tsv,
"RGI",
0
)

RGI_ADD_COLUMN.out.txt
.collect{ id, paths -> paths }
.set { rgi_tsvs }
RGI_ADD_COLUMN.out.txt
.collect{ id, paths -> paths }
.set { rgi_tsvs }

CONCAT_RGI(rgi_tsvs, "RGI", 1)
CONCAT_RGI(rgi_tsvs, "RGI", 1)
}

/*
* Module: Mob-Suite. Database is included in singularity container
*/
MOB_RECON(assemblies)
ch_software_versions = ch_software_versions.mix(MOB_RECON.out.version.first().ifEmpty(null))

MOB_RECON.out.contig_report
.collect{ id, paths -> paths }
.set { mobrecon_tsvs }
if (tools_to_run.contains('mobsuite')) {
MOB_RECON(assemblies)
ch_software_versions = ch_software_versions.mix(MOB_RECON.out.version.first().ifEmpty(null))

CONCAT_MOBSUITE(mobrecon_tsvs, "MOBSUITE", 1)
MOB_RECON.out.contig_report
.collect{ id, paths -> paths }
.set { mobrecon_tsvs }

if (params.run_integronfinder){
CONCAT_MOBSUITE(mobrecon_tsvs, "MOBSUITE", 1)
}
if (tools_to_run.contains('integronfinder')){
INTEGRON_FINDER(assemblies)
ch_software_versions = ch_software_versions.mix(INTEGRON_FINDER.out.versions.first())

Expand All @@ -223,7 +229,7 @@ workflow ANNOTATE_ASSEMBLIES {
}

ch_phispy_out = []
if (!params.skip_phispy) {
if (tools_to_run.contains('phispy')) {
PHISPY(ch_gbk_files)
ch_software_versions = ch_software_versions.mix(PHISPY.out.versions.first())

Expand All @@ -239,36 +245,39 @@ workflow ANNOTATE_ASSEMBLIES {

CONCAT_PHISPY(phispy_tsvs, "PHISPY", 1)
}
if (tools_to_run.contains('islandpath')) {
ISLANDPATH(ch_gbk_files)
ch_software_versions = ch_software_versions.mix(ISLANDPATH.out.versions.first())

ISLANDPATH(ch_gbk_files)
ch_software_versions = ch_software_versions.mix(ISLANDPATH.out.versions.first())

ISLANDPATH.out.gff
.collect{ id, paths -> paths }
.set { islandpath_gffs }

CONCAT_ISLANDS(islandpath_gffs, "ISLANDPATH", 1)
ISLANDPATH.out.gff
.collect{ id, paths -> paths }
.set { islandpath_gffs }

CONCAT_ISLANDS(islandpath_gffs, "ISLANDPATH", 1)
}
/*
* Run DIAMOND blast annotation with databases
*/
ch_diamond_outs = Channel.empty()
def blast_columns = "qseqid sseqid pident slen qlen length mismatch gapopen qstart qend sstart send evalue bitscore full_qseq"

if (tools_to_run.contains('vfdb')) {
DIAMOND_MAKE_VFDB(ch_vfdb)
DIAMOND_BLAST_VFDB(ch_ffn_files, DIAMOND_MAKE_VFDB.out.db, "txt", blast_columns)
VFDB_FILTER(
DIAMOND_BLAST_VFDB.out.txt,
"VFDB",
blast_columns,
min_pident,
min_qcover
)

DIAMOND_MAKE_VFDB(ch_vfdb)
DIAMOND_BLAST_VFDB(ch_ffn_files, DIAMOND_MAKE_VFDB.out.db, "txt", blast_columns)
VFDB_FILTER(
DIAMOND_BLAST_VFDB.out.txt,
"VFDB",
blast_columns,
min_pident,
min_qcover
)

ch_diamond_outs.mix(VFDB_FILTER.out.concatenated).set{ ch_diamond_outs }
ch_diamond_outs.mix(VFDB_FILTER.out.concatenated)
.set{ ch_diamond_outs }

if (!params.light) {
ch_software_versions = ch_software_versions.mix(DIAMOND_MAKE_VFDB.out.versions.ifEmpty(null))
}
if (tools_to_run.contains('bacmet')) {
DIAMOND_MAKE_BACMET(ch_bacmet_db)
DIAMOND_BLAST_BACMET(ch_ffn_files, DIAMOND_MAKE_BACMET.out.db, "txt", blast_columns)
BACMET_FILTER(
Expand All @@ -279,6 +288,10 @@ workflow ANNOTATE_ASSEMBLIES {
min_qcover
)

ch_diamond_outs.mix(BACMET_FILTER.out.concatenated)
.set{ ch_diamond_outs }
}
if (tools_to_run.contains('cazy')) {
DIAMOND_MAKE_CAZY(ch_cazy_db)
DIAMOND_BLAST_CAZY(ch_ffn_files, DIAMOND_MAKE_CAZY.out.db, "txt", blast_columns)
CAZY_FILTER(
Expand All @@ -289,6 +302,10 @@ workflow ANNOTATE_ASSEMBLIES {
min_qcover
)

ch_diamond_outs.mix(CAZY_FILTER.out.concatenated)
.set{ ch_diamond_outs }
}
if (tools_to_run.contains('iceberg')) {
DIAMOND_MAKE_ICEBERG(ch_iceberg_db)
DIAMOND_BLAST_ICEBERG(ch_ffn_files, DIAMOND_MAKE_ICEBERG.out.db, "txt", blast_columns)
ICEBERG_FILTER(
Expand All @@ -299,16 +316,13 @@ workflow ANNOTATE_ASSEMBLIES {
min_qcover
)

ch_diamond_outs
.mix(BACMET_FILTER.out.concatenated)
.mix(CAZY_FILTER.out.concatenated)
.mix(ICEBERG_FILTER.out.concatenated)
ch_diamond_outs.mix(ICEBERG_FILTER.out.concatenated)
.set { ch_diamond_outs }
}

ch_software_versions = ch_software_versions.mix(DIAMOND_MAKE_VFDB.out.versions.ifEmpty(null))

if (!params.use_prokka) {
needed_for_report = ['vfdb', 'rgi', 'mobsuite']
if (!params.use_prokka && needed_for_report.every { it in tools_to_run }) {
CREATE_REPORT(
CONCAT_BAKTA.out.txt,
ch_diamond_outs.collect(),
Expand All @@ -317,7 +331,7 @@ workflow ANNOTATE_ASSEMBLIES {
ch_phispy_out,
CONCAT_MOBSUITE.out.txt
)
} else {
} else if (needed_for_report.every { it in tools_to_run }) {
CREATE_REPORT(
CONCAT_PROKKA.out.txt,
ch_diamond_outs.collect(),
Expand Down
2 changes: 1 addition & 1 deletion tests/subworkflows/local/annotation.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ nextflow_workflow {
when {
params {
// define parameters here. Example:
light = true
annotation_tools = 'mobsuite,rgi,vfdb,islandpath'
use_prokka = true
min_pident = 80
min_qcover = 0.8
Expand Down