Skip to content

Commit

Permalink
first draft push with TODOs
Browse files Browse the repository at this point in the history
  • Loading branch information
vagkaratzas committed Oct 10, 2024
1 parent 1d3eff9 commit 2a48e7f
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 11 deletions.
3 changes: 3 additions & 0 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@ params {
validationShowHiddenParams = false
validate_params = true

// Generate downstream samplesheets
generate_samplesheet = false
downstream_pipeline = 'taxprofiler'
}

// Load base.config by default for all pipelines
Expand Down
46 changes: 46 additions & 0 deletions subworkflows/local/generate_downstream_samplesheets/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
//
// Subworkflow with functionality specific to the nf-core/createtaxdb pipeline
//

workflow GENERATE_DOWNSTREAM_SAMPLESHEETS {
take:
ch_databases

main:
ch_header = Channel.empty()
format = 'csv' // most common format in nf-core
format_sep = ','

// TODO --
// Make your samplesheet channel construct here depending on your downstream
// pipelines
if ( params.downstream_pipeline == 'taxprofiler' ) {
format = 'csv'
format_sep = ','
ch_list_for_samplesheet = ch_databases
.map {
meta, db ->
def tool = meta.tool
def db_name = meta.id + '-' + meta.tool
def db_params = ""
def db_type = ""
def db_path = file(params.outdir).getParent() + '/' + meta.tool + '/' + db.getName()
[ tool: tool, db_name: db_name, db_params: db_params, db_type: db_type, db_path: db_path ]
}
.tap{ ch_header }
}
// -- FINISH TODO

// Constructs the header string and then the strings of each row, and
// finally concatenates for saving.
ch_header
.first()
.map{ it.keySet().join(format_sep) }
.concat( ch_list_for_samplesheet.map{ it.values().join(format_sep) })
.collectFile(
name:"${params.outdir}/downstream_samplesheet/${params.downstream_pipeline}.${format}",
newLine: true,
sort: false
)

}
45 changes: 34 additions & 11 deletions workflows/mag.nf
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,18 @@ include { methodsDescriptionText } from '../subworkflows/local/utils_nfcore_mag_
//
// SUBWORKFLOW: Consisting of a mix of local and nf-core/modules
//
include { BINNING_PREPARATION } from '../subworkflows/local/binning_preparation'
include { BINNING } from '../subworkflows/local/binning'
include { BINNING_REFINEMENT } from '../subworkflows/local/binning_refinement'
include { BUSCO_QC } from '../subworkflows/local/busco_qc'
include { VIRUS_IDENTIFICATION } from '../subworkflows/local/virus_identification'
include { CHECKM_QC } from '../subworkflows/local/checkm_qc'
include { GUNC_QC } from '../subworkflows/local/gunc_qc'
include { GTDBTK } from '../subworkflows/local/gtdbtk'
include { ANCIENT_DNA_ASSEMBLY_VALIDATION } from '../subworkflows/local/ancient_dna'
include { DOMAIN_CLASSIFICATION } from '../subworkflows/local/domain_classification'
include { DEPTHS } from '../subworkflows/local/depths'
include { BINNING_PREPARATION } from '../subworkflows/local/binning_preparation'
include { BINNING } from '../subworkflows/local/binning'
include { BINNING_REFINEMENT } from '../subworkflows/local/binning_refinement'
include { BUSCO_QC } from '../subworkflows/local/busco_qc'
include { VIRUS_IDENTIFICATION } from '../subworkflows/local/virus_identification'
include { CHECKM_QC } from '../subworkflows/local/checkm_qc'
include { GUNC_QC } from '../subworkflows/local/gunc_qc'
include { GTDBTK } from '../subworkflows/local/gtdbtk'
include { ANCIENT_DNA_ASSEMBLY_VALIDATION } from '../subworkflows/local/ancient_dna'
include { DOMAIN_CLASSIFICATION } from '../subworkflows/local/domain_classification'
include { DEPTHS } from '../subworkflows/local/depths'
include { GENERATE_DOWNSTREAM_SAMPLESHEETS } from '../subworkflows/local/generate_downstream_samplesheets/main.nf'

//
// MODULE: Installed directly from nf-core/modules
Expand Down Expand Up @@ -356,6 +357,8 @@ workflow MAG {
}
}

// TODO remove ch_short_reads_assembly.view()

/*
================================================================================
Preprocessing and QC for long reads
Expand Down Expand Up @@ -1002,6 +1005,26 @@ workflow MAG {
}
}

//
// Samplesheet generation
//
ch_input_for_samplesheet = Channel
.empty()
// TODO
// .mix(
// ch_centrifuge_output.map {meta, db -> [ meta + [tool: "centrifuge"] , db ]},
// ch_diamond_output.map {meta, db -> [ meta + [tool: "diamond"] , db ]},
// ch_kaiju_output.map {meta, db -> [ meta + [tool: "kaiju"] , db ]},
// ch_kraken2_bracken_output.map{meta, db -> [ meta + [tool: "kraken2_bracken"], db ]},
// ch_krakenuniq_output.map {meta, db -> [ meta + [tool: "krakenuniq"] , db ]},
// ch_malt_output.map {meta, db -> [ meta + [tool: "malt"] , db ]}
// )
// .view()

if ( params.generate_samplesheet ) {
GENERATE_DOWNSTREAM_SAMPLESHEETS ( ch_input_for_samplesheet )
}

//
// Collate and save software versions
//
Expand Down

0 comments on commit 2a48e7f

Please sign in to comment.