Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions nf-prov-test/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,14 @@ process WC_SAMPLE {
input:
tuple val(id), path(fastq_1), path(fastq_2)

output:
tuple val(id), path('counts.txt')

script:
"""
wc -l ${fastq_1}
wc -l ${fastq_2}
touch counts.txt
wc -l ${fastq_1} >> counts.txt
wc -l ${fastq_2} >> counts.txt
"""
}

Expand All @@ -53,11 +57,12 @@ workflow {
ECHO_EXEC(inputs_ch)

samples_ch = channel.fromPath(params.input).splitCsv(header: true)
WC_SAMPLE(samples_ch)
counts_ch = WC_SAMPLE(samples_ch)

publish:
script = ECHO_SCRIPT.out
exec = ECHO_EXEC.out
counts = counts_ch
}

output {
Expand All @@ -74,4 +79,8 @@ output {
path 'exec.json'
}
}

counts {
path '.'
}
}
54 changes: 53 additions & 1 deletion src/main/groovy/nextflow/prov/renderers/WrrocRenderer.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package nextflow.prov.renderers
import java.nio.file.FileSystems
import java.nio.file.Files
import java.nio.file.Path
import java.nio.file.Paths
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter

Expand Down Expand Up @@ -91,6 +92,12 @@ class WrrocRenderer implements Renderer {
final nextflowVersion = metadata.nextflow.version.toString()
final params = session.params

// get various pipeline_info configurations
final reportOpts = session.config.navigate('report', [:]) as Map
final timelineOpts = session.config.navigate('timeline', [:]) as Map
final dagOpts = session.config.navigate('dag', [:]) as Map
final traceOpts = session.config.navigate('trace', [:]) as Map

// parse wrroc configuration
final wrrocOpts = session.config.navigate('prov.formats.wrroc', [:]) as Map
final agent = getAgentInfo(wrrocOpts)
Expand Down Expand Up @@ -208,6 +215,51 @@ class WrrocRenderer implements Renderer {
] as Map
}

// -- pipeline_info files
if(reportOpts.enabled) {
Path relativeReportPath = crateDir.relativize(Paths.get(reportOpts.file.toString()))
datasetParts.add([
"@id" : relativeReportPath.toString(),
"@type" : "File",
"name" : relativeReportPath.getFileName().toString(),
"description" : "Nextflow execution report",
"encodingFormat": "text/html"
])
}

if(timelineOpts.enabled) {
Path relativeTimelinePath = crateDir.relativize(Paths.get(timelineOpts.file.toString()))
datasetParts.add([
"@id" : relativeTimelinePath.toString(),
"@type" : "File",
"name" : relativeTimelinePath.getFileName().toString(),
"description" : "Nextflow execution timeline",
"encodingFormat": "text/html"
])
}

if(dagOpts.enabled) {
Path relativeDagPath = crateDir.relativize(Paths.get(dagOpts.file.toString()))
datasetParts.add([
"@id" : relativeDagPath.toString(),
"@type" : "File",
"name" : relativeDagPath.getFileName().toString(),
"description" : "Nextflow execution DAG",
"encodingFormat": "text/html"
])
}

if(traceOpts.enabled) {
Path relativeTracePath = crateDir.relativize(Paths.get(traceOpts.file.toString()))
datasetParts.add([
"@id" : relativeTracePath.toString(),
"@type" : "File",
"name" : relativeTracePath.getFileName().toString(),
"description" : "Nextflow execution DAG",
"encodingFormat": "text/plain"
])
}

// -- input files
Map<Path,String> paramInputFiles = [:]

Expand Down Expand Up @@ -347,7 +399,7 @@ class WrrocRenderer implements Renderer {
// HACK: when the owner script of a processor defines only one process, that must be the definition
final meta = ScriptMeta.get(processor.getOwnerScript())
final defs = meta.getDefinitions().findAll { defn -> defn instanceof ProcessDef } as List<ProcessDef>
final processDef = defs.size() == 1 ? defs.first() : null
final processDef = defs.find { it.name == processor.name }
if( !processDef )
log.warn "Could not identify process definition for `${processor.name}` -- resulting RO-Crate may be invalid (hint: define each process in a separate module script to fix this issue)"
acc[processor] = processDef
Expand Down
Loading