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-03-23 13:57:56 +00:00
|
|
|
ch_multiqc_config = file("$projectDir/assets/multiqc_config.yml", checkIfExists: true)
|
2022-02-18 06:55:14 +00:00
|
|
|
ch_multiqc_custom_config = params.multiqc_config ? Channel.fromPath(params.multiqc_config) : Channel.empty()
|
|
|
|
|
|
|
|
/*
|
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
|
|
|
|
//
|
|
|
|
include { FASTQC } from '../modules/nf-core/modules/fastqc/main'
|
|
|
|
include { MULTIQC } from '../modules/nf-core/modules/multiqc/main'
|
|
|
|
include { CUSTOM_DUMPSOFTWAREVERSIONS } from '../modules/nf-core/modules/custom/dumpsoftwareversions/main'
|
|
|
|
|
|
|
|
/*
|
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 (
|
|
|
|
ch_versions.unique().collectFile(name: 'collated_versions.yml')
|
|
|
|
)
|
|
|
|
|
|
|
|
//
|
|
|
|
// MODULE: MultiQC
|
|
|
|
//
|
|
|
|
workflow_summary = WorkflowTaxprofiler.paramsSummaryMultiqc(workflow, summary_params)
|
|
|
|
ch_workflow_summary = Channel.value(workflow_summary)
|
|
|
|
|
|
|
|
ch_multiqc_files = Channel.empty()
|
|
|
|
ch_multiqc_files = ch_multiqc_files.mix(Channel.from(ch_multiqc_config))
|
|
|
|
ch_multiqc_files = ch_multiqc_files.mix(ch_multiqc_custom_config.collect().ifEmpty([]))
|
|
|
|
ch_multiqc_files = ch_multiqc_files.mix(ch_workflow_summary.collectFile(name: 'workflow_summary_mqc.yaml'))
|
|
|
|
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 (
|
|
|
|
ch_multiqc_files.collect()
|
|
|
|
)
|
|
|
|
multiqc_report = MULTIQC.out.report.toList()
|
|
|
|
ch_versions = ch_versions.mix(MULTIQC.out.versions)
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
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-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
|
|
|
*/
|