Skip to content

Commit

Permalink
Add manifest contributors and license
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Sherman <[email protected]>
  • Loading branch information
bentsherman committed Nov 5, 2024
1 parent 4594477 commit f2c9416
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 26 deletions.
19 changes: 8 additions & 11 deletions plugins/nf-prov/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,18 @@ sourceSets {

dependencies {
// This dependency is exported to consumers, that is to say found on their compile classpath.
compileOnly 'io.nextflow:nextflow:23.04.0'
compileOnly 'io.nextflow:nextflow:24.10.0'
compileOnly 'org.slf4j:slf4j-api:1.7.10'
compileOnly 'org.pf4j:pf4j:3.4.1'
// add here plugins depepencies
compileOnly 'org.pf4j:pf4j:3.12.0'

// test configuration
testImplementation "org.codehaus.groovy:groovy:3.0.8"
testImplementation "org.codehaus.groovy:groovy-nio:3.0.8"
testImplementation 'io.nextflow:nextflow:23.04.0'
testImplementation ("org.codehaus.groovy:groovy-test:3.0.8") { exclude group: 'org.codehaus.groovy' }
testImplementation 'io.nextflow:nextflow:24.10.0'
testImplementation ("org.codehaus.groovy:groovy-test:4.0.23") { exclude group: 'org.codehaus.groovy' }
testImplementation ("cglib:cglib-nodep:3.3.0")
testImplementation ("org.objenesis:objenesis:3.1")
testImplementation ("org.spockframework:spock-core:2.0-M3-groovy-3.0") { exclude group: 'org.codehaus.groovy'; exclude group: 'net.bytebuddy' }
testImplementation ('org.spockframework:spock-junit4:2.0-M3-groovy-3.0') { exclude group: 'org.codehaus.groovy'; exclude group: 'net.bytebuddy' }
testImplementation ('com.google.jimfs:jimfs:1.1')
testImplementation ("org.objenesis:objenesis:3.2")
testImplementation ("org.spockframework:spock-core:2.3-groovy-4.0") { exclude group: 'org.codehaus.groovy'; exclude group: 'net.bytebuddy' }
testImplementation ('org.spockframework:spock-junit4:2.3-groovy-4.0') { exclude group: 'org.codehaus.groovy'; exclude group: 'net.bytebuddy' }
testImplementation ('com.google.jimfs:jimfs:1.2')

// see https://docs.gradle.org/4.1/userguide/dependency_management.html#sec:module_replacement
modules {
Expand Down
29 changes: 23 additions & 6 deletions plugins/nf-prov/src/main/nextflow/prov/BcoRenderer.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@ import groovy.json.JsonOutput
import groovy.transform.CompileStatic
import nextflow.Session
import nextflow.SysEnv
import nextflow.config.Manifest
import nextflow.processor.TaskRun
import nextflow.script.WorkflowMetadata
import nextflow.util.CacheHelper

import static nextflow.config.Manifest.ContributionType

/**
* Renderer for the BioCompute Object (BCO) format.
*
Expand Down Expand Up @@ -64,7 +67,7 @@ class BcoRenderer implements Renderer {
final nextflowMeta = metadata.nextflow

final dateCreated = DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(metadata.start)
final authors = (manifest.author ?: '').tokenize(',')*.trim()
final contributors = getContributors(manifest)
final nextflowVersion = nextflowMeta.version.toString()
final params = session.config.params as Map

Expand All @@ -88,15 +91,13 @@ class BcoRenderer implements Renderer {
"name": manifest.name ?: "",
"version": manifest.version ?: "",
"review": review,
"derived_from": derived_from,
"obsolete_after": obsolete_after,
"embargo": embargo,
"created": dateCreated,
"modified": dateCreated,
"contributors": authors.collect( name -> [
"contribution": ["authoredBy"],
"name": name
] ),
"license": ""
"contributors": contributors,
"license": manifest.license
],
"usability_domain": usability,
"extension_domain": [],
Expand Down Expand Up @@ -191,4 +192,20 @@ class BcoRenderer implements Renderer {
path.text = JsonOutput.prettyPrint(JsonOutput.toJson(bco))
}

private List getContributors(Manifest manifest) {
manifest.contributors.collect { c -> [
"name": c.name,
"affiliation": c.affiliation,
"email": c.email,
"contribution": c.contribution.collect { ct -> CONTRIBUTION_TYPES[ct] },
"orcid": c.orcid
] }
}

private static Map<ContributionType, String> CONTRIBUTION_TYPES = [
(ContributionType.AUTHOR) : "authoredBy",
(ContributionType.MAINTAINER) : "curatedBy",
(ContributionType.CONTRIBUTOR) : "curatedBy",
]

}
16 changes: 8 additions & 8 deletions plugins/nf-prov/src/main/nextflow/prov/DagRenderer.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ class DagRenderer implements Renderer {
}

private Map<TaskRun,Vertex> getVertices(Set<TaskRun> tasks) {
def result = [:]
for( def task : tasks ) {
Map<TaskRun,Vertex> result = [:]
for( final task : tasks ) {
final inputs = task.getInputFilesMap()
final outputs = ProvHelper.getTaskOutputs(task)

Expand Down Expand Up @@ -154,7 +154,7 @@ class DagRenderer implements Renderer {
}

// render task outputs
final outputs = [:] as Map<Path,String>
Map<Path,String> outputs = [:]

dag.vertices.each { task, vertex ->
vertex.outputs.each { path ->
Expand Down Expand Up @@ -184,11 +184,11 @@ class DagRenderer implements Renderer {
* @param vertices
*/
private Map getTaskTree(Map<TaskRun,Vertex> vertices) {
def taskTree = [:]
final taskTree = [:]

for( def entry : vertices ) {
def task = entry.key
def vertex = entry.value
for( final entry : vertices ) {
final task = entry.key
final vertex = entry.value

// infer subgraph keys from fully qualified process name
final result = getSubgraphKeys(task.processor.name)
Expand All @@ -200,7 +200,7 @@ class DagRenderer implements Renderer {

// navigate to given subgraph
def subgraph = taskTree
for( def key : keys ) {
for( final key : keys ) {
if( key !in subgraph )
subgraph[key] = [:]
subgraph = subgraph[key]
Expand Down
2 changes: 1 addition & 1 deletion plugins/nf-prov/src/resources/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ Plugin-Id: nf-prov
Plugin-Version: 1.2.4
Plugin-Class: nextflow.prov.ProvPlugin
Plugin-Provider: nextflow
Plugin-Requires: >=23.04.0
Plugin-Requires: >=24.10.0

0 comments on commit f2c9416

Please sign in to comment.