2022-02-18 06:55:14 +00:00
|
|
|
/*
|
2022-03-15 21:05:37 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2022-02-18 06:55:14 +00:00
|
|
|
VALIDATE INPUTS
|
2022-03-15 21:05:37 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2022-02-18 06:55:14 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
def summary_params = NfcoreSchema.paramsSummaryMap(workflow, params)
|
|
|
|
|
|
|
|
// Validate input parameters
|
|
|
|
WorkflowTaxprofiler.initialise(params, log)
|
|
|
|
|
|
|
|
// TODO nf-core: Add all file path parameters for the pipeline to the list below
|
|
|
|
// Check input path parameters to see if they exist
|
|
|
|
def checkPathParamList = [ params.input, params.multiqc_config, params.fasta ]
|
|
|
|
for (param in checkPathParamList) { if (param) { file(param, checkIfExists: true) } }
|
|
|
|
|
|
|
|
// Check mandatory parameters
|
|
|
|
if (params.input) { ch_input = file(params.input) } else { exit 1, 'Input samplesheet not specified!' }
|
|
|
|
|
|
|
|
/*
|
2022-03-15 21:05:37 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2022-02-18 06:55:14 +00:00
|
|
|
CONFIG FILES
|
2022-03-15 21:05:37 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2022-02-18 06:55:14 +00:00
|
|
|
*/
|
|
|
|
|
2022-10-05 03:30:53 +00:00
|
|
|
ch_multiqc_config = Channel.fromPath("$projectDir/assets/multiqc_config.yml", checkIfExists: true)
|
|
|
|
ch_multiqc_custom_config = params.multiqc_config ? Channel.fromPath( params.multiqc_config, checkIfExists: true ) : Channel.empty()
|
|
|
|
ch_multiqc_logo = params.multiqc_logo ? Channel.fromPath( params.multiqc_logo, checkIfExists: true ) : Channel.empty()
|
|
|
|
ch_multiqc_custom_methods_description = params.multiqc_methods_description ? file(params.multiqc_methods_description, checkIfExists: true) : file("$projectDir/assets/methods_description_template.yml", checkIfExists: true)
|
2022-02-18 06:55:14 +00:00
|
|
|
|
|
|
|
/*
|
2022-03-15 21:05:37 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2022-02-18 06:55:14 +00:00
|
|
|
IMPORT LOCAL MODULES/SUBWORKFLOWS
|
2022-03-15 21:05:37 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2022-02-18 06:55:14 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
//
|
|
|
|
// SUBWORKFLOW: Consisting of a mix of local and nf-core/modules
|
|
|
|
//
|
|
|
|
include { INPUT_CHECK } from '../subworkflows/local/input_check'
|
|
|
|
|
|
|
|
/*
|
2022-03-15 21:05:37 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2022-02-18 06:55:14 +00:00
|
|
|
IMPORT NF-CORE MODULES/SUBWORKFLOWS
|
2022-03-15 21:05:37 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2022-02-18 06:55:14 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
//
|
|
|
|
// MODULE: Installed directly from nf-core/modules
|
|
|
|
//
|
2022-10-05 03:30:53 +00:00
|
|
|
include { FASTQC } from '../modules/nf-core/fastqc/main'
|
|
|
|
include { MULTIQC } from '../modules/nf-core/multiqc/main'
|
|
|
|
include { CUSTOM_DUMPSOFTWAREVERSIONS } from '../modules/nf-core/custom/dumpsoftwareversions/main'
|
2022-02-18 06:55:14 +00:00
|
|
|
|
|
|
|
/*
|
2022-03-15 21:05:37 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2022-02-18 06:55:14 +00:00
|
|
|
RUN MAIN WORKFLOW
|
2022-03-15 21:05:37 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2022-02-18 06:55:14 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
// Info required for completion email and summary
|
|
|
|
def multiqc_report = []
|
|
|
|
|
|
|
|
workflow TAXPROFILER {
|
|
|
|
|
|
|
|
ch_versions = Channel.empty()
|
|
|
|
|
|
|
|
//
|
|
|
|
// SUBWORKFLOW: Read in samplesheet, validate and stage input files
|
|
|
|
//
|
|
|
|
INPUT_CHECK (
|
|
|
|
ch_input
|
|
|
|
)
|
|
|
|
ch_versions = ch_versions.mix(INPUT_CHECK.out.versions)
|
|
|
|
|
|
|
|
//
|
|
|
|
// MODULE: Run FastQC
|
|
|
|
//
|
|
|
|
FASTQC (
|
|
|
|
INPUT_CHECK.out.reads
|
|
|
|
)
|
|
|
|
ch_versions = ch_versions.mix(FASTQC.out.versions.first())
|
|
|
|
|
|
|
|
CUSTOM_DUMPSOFTWAREVERSIONS (
|
2022-12-19 12:10:58 +00:00
|
|
|
ch_versions.unique().collectFile(name: 'collated_versions.yml')
|
2022-02-18 06:55:14 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
//
|
|
|
|
// MODULE: MultiQC
|
|
|
|
//
|
|
|
|
workflow_summary = WorkflowTaxprofiler.paramsSummaryMultiqc(workflow, summary_params)
|
|
|
|
ch_workflow_summary = Channel.value(workflow_summary)
|
|
|
|
|
2022-10-05 03:30:53 +00:00
|
|
|
methods_description = WorkflowTaxprofiler.methodsDescriptionText(workflow, ch_multiqc_custom_methods_description)
|
|
|
|
ch_methods_description = Channel.value(methods_description)
|
|
|
|
|
2022-02-18 06:55:14 +00:00
|
|
|
ch_multiqc_files = Channel.empty()
|
|
|
|
ch_multiqc_files = ch_multiqc_files.mix(ch_workflow_summary.collectFile(name: 'workflow_summary_mqc.yaml'))
|
2022-10-05 03:30:53 +00:00
|
|
|
ch_multiqc_files = ch_multiqc_files.mix(ch_methods_description.collectFile(name: 'methods_description_mqc.yaml'))
|
2022-02-18 06:55:14 +00:00
|
|
|
ch_multiqc_files = ch_multiqc_files.mix(CUSTOM_DUMPSOFTWAREVERSIONS.out.mqc_yml.collect())
|
|
|
|
ch_multiqc_files = ch_multiqc_files.mix(FASTQC.out.zip.collect{it[1]}.ifEmpty([]))
|
|
|
|
|
|
|
|
MULTIQC (
|
2022-10-05 03:30:53 +00:00
|
|
|
ch_multiqc_files.collect(),
|
2022-12-08 13:18:23 +00:00
|
|
|
ch_multiqc_config.toList(),
|
|
|
|
ch_multiqc_custom_config.toList(),
|
|
|
|
ch_multiqc_logo.toList()
|
2022-02-18 06:55:14 +00:00
|
|
|
)
|
|
|
|
multiqc_report = MULTIQC.out.report.toList()
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2022-03-15 21:05:37 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2022-02-18 06:55:14 +00:00
|
|
|
COMPLETION EMAIL AND SUMMARY
|
2022-03-15 21:05:37 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2022-02-18 06:55:14 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
workflow.onComplete {
|
|
|
|
if (params.email || params.email_on_fail) {
|
|
|
|
NfcoreTemplate.email(workflow, params, summary_params, projectDir, log, multiqc_report)
|
|
|
|
}
|
|
|
|
NfcoreTemplate.summary(workflow, params, log)
|
2022-10-05 03:30:53 +00:00
|
|
|
if (params.hook_url) {
|
2022-12-08 13:18:23 +00:00
|
|
|
NfcoreTemplate.IM_notification(workflow, params, summary_params, projectDir, log)
|
2022-10-05 03:30:53 +00:00
|
|
|
}
|
2022-02-18 06:55:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2022-03-15 21:05:37 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2022-02-18 06:55:14 +00:00
|
|
|
THE END
|
2022-03-15 21:05:37 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2022-02-18 06:55:14 +00:00
|
|
|
*/
|