Skip to content

Commit

Permalink
Make GTDBTK explicitly optional, and more flexible with input databases
Browse files Browse the repository at this point in the history
  • Loading branch information
jfy133 committed Jul 29, 2023
1 parent 4f3a554 commit 1b829d6
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion modules/local/gtdbtk_db_preparation.nf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ process GTDBTK_DB_PREPARATION {
path(database)

output:
tuple val("${database.toString().replace(".tar.gz", "")}"), path("database/*")
tuple val("${database.toString().replace(".tar.gz", "")}"), path("database/*"), emit: db

script:
"""
Expand Down
2 changes: 1 addition & 1 deletion nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@
},
"gtdb_db": {
"type": "string",
"description": "Specify the location of a GTDBTK database. Can be either an uncompressed directory or a `.tar.gz` archive. If not specified will be downloaded for you.",
"description": "Specify the location of a GTDBTK database. Can be either an uncompressed directory or a `.tar.gz` archive. If not specified will be downloaded for you when GTDBTK or binning QC is not skipped.",
"default": "https://data.ace.uq.edu.au/public/gtdb/data/releases/release202/202.0/auxillary_files/gtdbtk_r202_data.tar.gz"
},
"gtdbtk_min_completeness": {
Expand Down
4 changes: 2 additions & 2 deletions subworkflows/local/binning.nf
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ workflow BINNING {
ch_versions = ch_versions.mix(GUNZIP_UNBINS.out.versions.first())

emit:
bins = ch_binning_results_gunzipped.dump(tag: "ch_binning_results_gunzipped")
bins = ch_binning_results_gunzipped
bins_gz = ch_binning_results_gzipped_final
unbinned = ch_splitfasta_results_gunzipped.dump(tag: "ch_splitfasta_results_gunzipped")
unbinned = ch_splitfasta_results_gunzipped
unbinned_gz = SPLIT_FASTA.out.unbinned
metabat2depths = METABAT2_JGISUMMARIZEBAMCONTIGDEPTHS.out.depth
versions = ch_versions
Expand Down
11 changes: 6 additions & 5 deletions subworkflows/local/gtdbtk.nf
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,13 @@ workflow GTDBTK {
return [it[0], it[1]]
}

if ( gtdb.extension == '.gz' ) {
if ( gtdb.extension == 'gz' ) {
// Expects to be tar.gz!
ch_db_for_gtdbtk = GTDBTK_DB_PREPARATION ( gtdb ).out
ch_db_for_gtdbtk = GTDBTK_DB_PREPARATION ( gtdb ).db
} else if ( gtdb.isDirectory() ) {
// Make up meta id to match expected channel cardinality for GTDBTK
ch_db_for_gtdbtk = gtdb
ch_db_for_gtdbtk = Channel
.of(gtdb)
.map{
[ it.toString().split('/').last(), it ]
}
Expand All @@ -74,8 +75,8 @@ workflow GTDBTK {
}

GTDBTK_CLASSIFYWF (
ch_filtered_bins.passed.groupTuple().dump(tag: "BINS"),
ch_db_for_gtdbtk.dump(tag: "SHOULD_BE_GTDB_DB")
ch_filtered_bins.passed.groupTuple(),
ch_db_for_gtdbtk
)

GTDBTK_SUMMARY (
Expand Down
11 changes: 5 additions & 6 deletions workflows/mag.nf
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,9 @@ if (params.genomad_db){
gtdb = ( params.skip_binqc || params.skip_gtdbtk ) ? false : params.gtdb_db

if (gtdb) {
ch_gtdb = Channel
.value(file( "${gtdb}", checkIfExists: true))
gtdb = file( "${gtdb}", checkIfExists: true)
} else {
ch_gtdb = Channel.empty()
gtdb = []
}

if(params.metaeuk_db && !params.skip_metaeuk) {
Expand Down Expand Up @@ -720,12 +719,12 @@ workflow MAG {


} else {
ch_binning_results_bins = BINNING.out.bins.dump(tag: 'BINNING.out.bins')
ch_binning_results_bins = BINNING.out.bins
.map { meta, bins ->
def meta_new = meta + [domain: 'unclassified']
[meta_new, bins]
}
ch_binning_results_unbins = BINNING.out.unbinned.dump(tag: 'BINNING.out.unbins')
ch_binning_results_unbins = BINNING.out.unbinned
.map { meta, bins ->
def meta_new = meta + [domain: 'unclassified']
[meta_new, bins]
Expand Down Expand Up @@ -892,7 +891,7 @@ workflow MAG {
ch_gtdb_bins,
ch_busco_summary,
ch_checkm_summary,
ch_gtdb
gtdb
)
ch_versions = ch_versions.mix(GTDBTK.out.versions.first())
ch_gtdbtk_summary = GTDBTK.out.summary
Expand Down

0 comments on commit 1b829d6

Please sign in to comment.