Skip to content

Commit

Permalink
Collect nextflow session and run ids (#10)
Browse files Browse the repository at this point in the history
* Collect nextflow session and run ids

* bump version
  • Loading branch information
dfornika authored Nov 8, 2024
1 parent a48cc7d commit 0d249e4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 18 deletions.
14 changes: 9 additions & 5 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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']]] }
Expand Down
26 changes: 14 additions & 12 deletions modules/provenance.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
}
2 changes: 1 addition & 1 deletion nextflow.config
Original file line number Diff line number Diff line change
@@ -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'
Expand Down

0 comments on commit 0d249e4

Please sign in to comment.