diff --git a/main.nf b/main.nf index e731215..a79f185 100644 --- a/main.nf +++ b/main.nf @@ -22,11 +22,15 @@ include { collect_provenance } from './modules/provenance.nf' workflow { - ch_start_time = Channel.of(LocalDateTime.now()) - ch_pipeline_name = Channel.of(workflow.manifest.name) - ch_pipeline_version = Channel.of(workflow.manifest.version) - - ch_pipeline_provenance = pipeline_provenance(ch_pipeline_name.combine(ch_pipeline_version).combine(ch_start_time)) + ch_workflow_metadata = Channel.value([ + workflow.sessionId, + workflow.runName, + workflow.manifest.name, + workflow.manifest.version, + workflow.start, + ]) + + ch_pipeline_provenance = pipeline_provenance(ch_workflow_metadata) if (params.samplesheet_input != 'NO_FILE') { ch_fastq = Channel.fromPath(params.samplesheet_input).splitCsv(header: true).map{ it -> [it['ID'], [it['R1'], it['R2'], it['LONG']]] } diff --git a/modules/provenance.nf b/modules/provenance.nf index 966b423..218c290 100644 --- a/modules/provenance.nf +++ b/modules/provenance.nf @@ -20,20 +20,22 @@ process collect_provenance { process pipeline_provenance { - tag { pipeline_name + " / " + pipeline_version } + tag { pipeline_name + " / " + pipeline_version } - executor 'local' + executor 'local' - input: - tuple val(pipeline_name), val(pipeline_version), val(analysis_start) + input: + tuple val(session_id), val(run_name), val(pipeline_name), val(pipeline_version), val(analysis_start) - output: - file("pipeline_provenance.yml") + output: + file("pipeline_provenance.yml") - script: - """ - printf -- "- pipeline_name: ${pipeline_name}\\n" >> pipeline_provenance.yml - printf -- " pipeline_version: ${pipeline_version}\\n" >> pipeline_provenance.yml - printf -- " timestamp_analysis_start: ${analysis_start}\\n" >> pipeline_provenance.yml - """ + script: + """ + printf -- "- pipeline_name: ${pipeline_name}\\n" >> pipeline_provenance.yml + printf -- " pipeline_version: ${pipeline_version}\\n" >> pipeline_provenance.yml + printf -- " nextflow_session_id: ${session_id}\\n" >> pipeline_provenance.yml + printf -- " nextflow_run_name: ${run_name}\\n" >> pipeline_provenance.yml + printf -- " timestamp_analysis_start: ${analysis_start}\\n" >> pipeline_provenance.yml + """ } diff --git a/nextflow.config b/nextflow.config index 202e9f4..67f6a48 100644 --- a/nextflow.config +++ b/nextflow.config @@ -1,7 +1,7 @@ manifest { author = 'Dan Fornika' name = 'BCCDC-PHL/plasmid-assembly' - version = '0.1.1' + version = '0.1.2' description = 'Nextflow pipeline for plasmid assembly' mainScript = 'main.nf' nextflowVersion = '>=20.01.0'