Skip to content

Commit

Permalink
Add options for external_data_endpoints and environment_variables
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Sherman <[email protected]>
  • Loading branch information
bentsherman committed Oct 21, 2024
1 parent ce27ca3 commit 4594477
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 9 deletions.
33 changes: 33 additions & 0 deletions BCO.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Additional BCO configuration

*New in version 1.3.0*

The `bco` format supports additional "pass-through" options for certain BCO fields. These fields cannot be inferred automatically from a pipeline or run, and so must be entered through the config. External systems can use these config options to inject fields automatically.

The following config options are supported:
Expand All @@ -11,9 +13,13 @@ The following config options are supported:
- `prov.formats.bco.usability_domain`
- `prov.formats.bco.description_domain.keywords`
- `prov.formats.bco.description_domain.xref`
- `prov.formats.bco.execution_domain.external_data_endpoints`
- `prov.formats.bco.execution_domain.environment_variables`

These options correspond exactly to fields in the BCO JSON schema. Refer to the [BCO User Guide](https://docs.biocomputeobject.org/user_guide/) for more information about these fields.

*NOTE: The `environment_variables` setting differs from the BCO standard in that it only specifies the variable names. Only the variables specified in this list will be populated in the BCO, if they are present in the execution environment.*

Here is an example config based on the BCO User Guide:

```groovy
Expand Down Expand Up @@ -94,6 +100,23 @@ prov {
]
]
}
execution_domain {
external_data_endpoints = [
[
"url": "protocol://domain:port/application/path",
"name": "generic name"
],
[
"url": "ftp://data.example.com:21/",
"name": "access to ftp server"
],
[
"url": "http://eutils.ncbi.nlm.nih.gov/entrez/eutils",
"name": "access to e-utils web service"
]
]
environment_variables = ["HOSTTYPE", "EDITOR"]
}
}
}
}
Expand All @@ -116,6 +139,10 @@ prov {
keywords = params.bco_description_domain_keywords
xref = params.bco_description_domain_xref
}
execution_domain {
external_data_endpoints = params.bco_execution_domain_external_data_endpoints
environment_variables = params.bco_execution_domain_environment_variables
}
}
}
}
Expand All @@ -142,6 +169,12 @@ This way, the pass-through options can be provided as JSON in a [params file](ht
],
"bco_description_domain_xref": [
// ...
],
"bco_execution_domain_external_data_endpoints": [
// ...
],
"bco_execution_domain_environment_variables": [
// ...
]
}
```
25 changes: 16 additions & 9 deletions plugins/nf-prov/src/main/nextflow/prov/BcoRenderer.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import java.time.format.DateTimeFormatter
import groovy.json.JsonOutput
import groovy.transform.CompileStatic
import nextflow.Session
import nextflow.SysEnv
import nextflow.processor.TaskRun
import nextflow.script.WorkflowMetadata
import nextflow.util.CacheHelper
Expand Down Expand Up @@ -68,13 +69,15 @@ class BcoRenderer implements Renderer {
final params = session.config.params as Map

final config = session.config
final review = config.navigate('prov.formats.bco.provenance_domain.review', []) as List<Map<String,?>>
final derived_from = config.navigate('prov.formats.bco.provenance_domain.derived_from') as String
final obsolete_after = config.navigate('prov.formats.bco.provenance_domain.obsolete_after') as String
final embargo = config.navigate('prov.formats.bco.provenance_domain.embargo') as Map<String,String>
final usability = config.navigate('prov.formats.bco.usability_domain', []) as List<String>
final keywords = config.navigate('prov.formats.bco.description_domain.keywords', []) as List<String>
final xref = config.navigate('prov.formats.bco.description_domain.xref', []) as List<Map<String,?>>
final review = config.navigate('prov.formats.bco.provenance_domain.review', []) as List<Map<String,?>>
final derived_from = config.navigate('prov.formats.bco.provenance_domain.derived_from') as String
final obsolete_after = config.navigate('prov.formats.bco.provenance_domain.obsolete_after') as String
final embargo = config.navigate('prov.formats.bco.provenance_domain.embargo') as Map<String,String>
final usability = config.navigate('prov.formats.bco.usability_domain', []) as List<String>
final keywords = config.navigate('prov.formats.bco.description_domain.keywords', []) as List<String>
final xref = config.navigate('prov.formats.bco.description_domain.xref', []) as List<Map<String,?>>
final external_data_endpoints = config.navigate('prov.formats.bco.execution_domain.external_data_endpoints', []) as List<Map<String,String>>
final environment_variables = config.navigate('prov.formats.bco.execution_domain.environment_variables', []) as List<String>

// create BCO manifest
final bco = [
Expand Down Expand Up @@ -125,8 +128,12 @@ class BcoRenderer implements Renderer {
]
]
],
"external_data_endpoints": [],
"environment_variables": [:]
"external_data_endpoints": external_data_endpoints,
"environment_variables": environment_variables.inject([:]) { acc, name ->
if( SysEnv.containsKey(name) )
acc.put(name, SysEnv.get(name))
acc
}
],
"parametric_domain": params.toConfigObject().flatten().collect( (k, v) -> [
"param": k,
Expand Down

0 comments on commit 4594477

Please sign in to comment.