Commit 1c97acf7 authored by Celine Noirot's avatar Celine Noirot
Browse files

add software version

parent 38ffe0e6
...@@ -27,7 +27,7 @@ This script is based on : ...@@ -27,7 +27,7 @@ This script is based on :
======================================================================================== ========================================================================================
GeT/template Analysis Pipeline. GeT/template Analysis Pipeline.
#### Homepage / Documentation #### Homepage / Documentation
https://github.com/nf-core/template https://github.com/get-nf/template
---------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------
*/ */
...@@ -38,7 +38,7 @@ def helpMessage() { ...@@ -38,7 +38,7 @@ def helpMessage() {
The typical command for running the pipeline is as follows: The typical command for running the pipeline is as follows:
nextflow run nf-core/template --inputdir '/path/to/data' --samplesheet 'samples.csv' -profile docker nextflow run get-nf/template --inputdir '/path/to/data' --samplesheet 'samples.csv' -profile docker
Mandatory arguments: Mandatory arguments:
--inputdir Path to input directory --inputdir Path to input directory
...@@ -52,6 +52,7 @@ def helpMessage() { ...@@ -52,6 +52,7 @@ def helpMessage() {
--email Set this parameter to your e-mail address to get a summary e-mail with details of the run sent to you when the workflow exits --email Set this parameter to your e-mail address to get a summary e-mail with details of the run sent to you when the workflow exits
--email_on_fail Same as --email, except only send mail if the workflow is not successful --email_on_fail Same as --email, except only send mail if the workflow is not successful
--maxMultiqcEmailFileSize Theshold size for MultiQC report to be attached in notification email. If file generated by pipeline exceeds the threshold, it will not be attached (Default: 25MB) --maxMultiqcEmailFileSize Theshold size for MultiQC report to be attached in notification email. If file generated by pipeline exceeds the threshold, it will not be attached (Default: 25MB)
-name [str] Name for the pipeline run. If not specified, Nextflow will automatically generate a random mnemonic. -name [str] Name for the pipeline run. If not specified, Nextflow will automatically generate a random mnemonic.
...@@ -120,6 +121,37 @@ ch_multiqc_config = file(params.multiqc_config, checkIfExists: true) ...@@ -120,6 +121,37 @@ ch_multiqc_config = file(params.multiqc_config, checkIfExists: true)
ch_output_docs = file("$projectDir/docs/output.md", checkIfExists: true) ch_output_docs = file("$projectDir/docs/output.md", checkIfExists: true)
ch_output_docs_images = file("$projectDir/docs/images/", checkIfExists: true) ch_output_docs_images = file("$projectDir/docs/images/", checkIfExists: true)
def summary = [:]
if (workflow.revision) summary['Pipeline Release'] = workflow.revision
summary['Run Name'] = custom_runName ?: workflow.runName
// TODO nf-core: Report custom parameters here
summary['Input dir'] = params.inputdir
summary['Sample sheet'] = params.samplesheet
summary['Data Type'] = params.single_end ? 'Single-End' : 'Paired-End'
summary['Max Resources'] = "$params.max_memory memory, $params.max_cpus cpus, $params.max_time time per job"
if (workflow.containerEngine) summary['Container'] = "$workflow.containerEngine - $workflow.container"
summary['Output dir'] = params.outdir
summary['Launch dir'] = workflow.launchDir
summary['Working dir'] = workflow.workDir
summary['Script dir'] = workflow.projectDir
summary['User'] = workflow.userName
if (workflow.profile == 'awsbatch') {
summary['AWS Region'] = params.awsregion
summary['AWS Queue'] = params.awsqueue
}
summary['Config Profile'] = workflow.profile
if (params.email || params.email_on_fail) {
summary['E-mail Address'] = params.email
summary['E-mail on failure'] = params.email_on_fail
}
log.info "-\033[2m--------------------------------------------------\033[0m-"
log.info "-\033[2m---------------- get-nf workflow -----------------\033[0m-"
log.info "-\033[2m--------------------------------------------------\033[0m-"
log.info summary.collect { k,v -> "${k.padRight(18)}: $v" }.join("\n")
log.info "-\033[2m--------------------------------------------------\033[0m-"
/* In case of modular pipeline*/ /* In case of modular pipeline*/
params.step = "qc" params.step = "qc"
availableStepList = availableStepList =
...@@ -136,6 +168,31 @@ for (String a_step: step) { ...@@ -136,6 +168,31 @@ for (String a_step: step) {
assert (a_step in availableStepList) assert (a_step in availableStepList)
} }
/*
* Parse software version numbers
*/
process get_software_versions {
publishDir "${params.outdir}/pipeline_info", mode: 'copy',
saveAs: { filename ->
if (filename.indexOf(".csv") > 0) filename
else null
}
output:
file 'software_versions_mqc.yaml' into software_versions_yaml
file "software_versions.csv"
script:
// TODO nf-core: Get all tools to print their version number here
"""
echo $workflow.manifest.version > v_pipeline.txt
echo $workflow.nextflow.version > v_nextflow.txt
fastqc --version > v_fastqc.txt
multiqc --version > v_multiqc.txt
scrape_software_versions.py &> software_versions_mqc.yaml
"""
/* /*
* STEP 1 - FastQC * STEP 1 - FastQC
*/ */
...@@ -194,10 +251,10 @@ process assembly { ...@@ -194,10 +251,10 @@ process assembly {
""" """
} }
/***********
* MultiQC *
***********/
/*
* STEP - MultiQC
*/
process multiqc { process multiqc {
publishDir "${params.outdir}/MultiQC", mode: 'copy' publishDir "${params.outdir}/MultiQC", mode: 'copy'
...@@ -208,7 +265,7 @@ process multiqc { ...@@ -208,7 +265,7 @@ process multiqc {
input: input:
file (multiqc_config) from ch_multiqc_config file (multiqc_config) from ch_multiqc_config
file ('fastqc/*') from fastqc_results_for_multiqc.collect().ifEmpty([]) file ('fastqc/*') from fastqc_results_for_multiqc.collect().ifEmpty([])
// TODO nf-core: Add in log files from your new processes for MultiQC to find! // TODO get-nf: Add in log files from your new processes for MultiQC to find!
//file ('softwareVersions/*') from softwareVersionsYamlCh.collect().ifEmpty([]) //file ('softwareVersions/*') from softwareVersionsYamlCh.collect().ifEmpty([])
//file ('workflowSummary/*') from workflowSummaryYamlCh.collect() //file ('workflowSummary/*') from workflowSummaryYamlCh.collect()
...@@ -224,3 +281,104 @@ process multiqc { ...@@ -224,3 +281,104 @@ process multiqc {
multiqc -f $rtitle $rfilename --config $multiqc_config . multiqc -f $rtitle $rfilename --config $multiqc_config .
""" """
} }
/*
* STEP - Output Description HTML
*/
process output_documentation {
publishDir "${params.outdir}/pipeline_info", mode: 'copy'
input:
file output_docs from ch_output_docs
output:
file "results_description.html"
script:
"""
pandoc $output_docs -t html -o results_description.html
"""
}
/*
* Completion e-mail notification
*/
workflow.onComplete {
// Set up the e-mail variables
def subject = "[get-nf/template] Successful: $workflow.runName"
if (!workflow.success) {
subject = "[get-nf/template] FAILED: $workflow.runName"
}
def email_fields = [:]
email_fields['version'] = workflow.manifest.version
email_fields['runName'] = custom_runName ?: workflow.runName
email_fields['success'] = workflow.success
email_fields['dateComplete'] = workflow.complete
email_fields['duration'] = workflow.duration
email_fields['exitStatus'] = workflow.exitStatus
email_fields['errorMessage'] = (workflow.errorMessage ?: 'None')
email_fields['errorReport'] = (workflow.errorReport ?: 'None')
email_fields['commandLine'] = workflow.commandLine
email_fields['projectDir'] = workflow.projectDir
email_fields['summary'] = summary
println(workflow)
email_fields['summary']['Date Started'] = 11 // workflow.start
email_fields['summary']['Date Completed'] = 11 // workflow.complete
email_fields['summary']['Pipeline script file path'] = 'aaa' //workflow.scriptFile
email_fields['summary']['Pipeline script hash ID'] = 'aaa' //workflow.scriptId
if (workflow.repository) email_fields['summary']['Pipeline repository Git URL'] = workflow.repository
if (workflow.commitId) email_fields['summary']['Pipeline repository Git Commit'] = workflow.commitId
if (workflow.revision) email_fields['summary']['Pipeline Git branch/tag'] = workflow.revision
if (workflow.container) email_fields['summary']['Docker image'] = workflow.container
email_fields['summary']['Nextflow Version'] = workflow.nextflow.version
email_fields['summary']['Nextflow Build'] = workflow.nextflow.build
email_fields['summary']['Nextflow Compile Timestamp'] = workflow.nextflow.timestamp
// Check if we are only sending emails on failure
email_address = params.email
if (!params.email && params.email_on_fail && !workflow.success) {
email_address = params.email_on_fail
}
// Render the TXT template
def engine = new groovy.text.GStringTemplateEngine()
def tf = new File("$baseDir/assets/email_template.txt")
def txt_template = engine.createTemplate(tf).make(email_fields)
def email_txt = txt_template.toString()
// Send the HTML e-mail
if (email_address) {
// Catch failures and try with plaintext
[ 'mail', '-s', subject, email_address ].execute() << email_txt
log.info "[get-nf/template] Sent summary e-mail to $email_address (mail)"
log.info "$email_txt"
}
// Write summary e-mail HTML to a file
def output_d = new File( "${params.outdir}/pipeline_info/" )
if (!output_d.exists()) {
output_d.mkdirs()
}
def output_tf = new File( output_d, "pipeline_report.txt" )
output_tf.withWriter { w -> w << email_txt }
c_reset = params.monochrome_logs ? '' : "\033[0m";
c_purple = params.monochrome_logs ? '' : "\033[0;35m";
c_green = params.monochrome_logs ? '' : "\033[0;32m";
c_red = params.monochrome_logs ? '' : "\033[0;31m";
if (workflow.stats.ignoredCount > 0 && workflow.success) {
log.info "${c_purple}Warning, pipeline completed, but with errored process(es) ${c_reset}"
log.info "${c_red}Number of ignored errored process(es) : ${workflow.stats.ignoredCount} ${c_reset}"
log.info "${c_green}Number of successfully ran process(es) : ${workflow.stats.succeedCount} ${c_reset}"
}
if (workflow.success) {
log.info "${c_purple}[get-nf/template]${c_green} Pipeline completed successfully${c_reset}"
} else {
log.info "${c_purple}[get-nf/template]${c_red} Pipeline completed with errors${c_reset}"
}
}
\ No newline at end of file
...@@ -14,6 +14,7 @@ params { ...@@ -14,6 +14,7 @@ params {
samplesheet = "${params.inputdir}/samples.csv" samplesheet = "${params.inputdir}/samples.csv"
single_end = false single_end = false
outdir = './results' outdir = './results'
skip_multiQC = false
// Boilerplate options // Boilerplate options
name = false name = false
...@@ -21,8 +22,6 @@ params { ...@@ -21,8 +22,6 @@ params {
tracedir = "${params.outdir}/pipeline_info" tracedir = "${params.outdir}/pipeline_info"
email = false email = false
email_on_fail = false email_on_fail = false
maxMultiqcEmailFileSize = 25.MB
plaintext_email = false
monochrome_logs = false monochrome_logs = false
help = false help = false
config_profile_description = false config_profile_description = false
...@@ -40,7 +39,7 @@ params { ...@@ -40,7 +39,7 @@ params {
// Container slug. Stable releases should specify release tag! // Container slug. Stable releases should specify release tag!
// Developmental code should specify :dev // Developmental code should specify :dev
process.container = "$baseDir/img.sif" process.container = "$baseDir/template-nf.sif"
// Load base.config by default for all pipelines // Load base.config by default for all pipelines
includeConfig 'conf/base.config' includeConfig 'conf/base.config'
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment