@groovy.transform.CompileStatic class BidsExtension extends nextflow.plugin.extension.PluginExtensionPoint
DSL extension point for the nf-bids Nextflow plugin.
Exposes the following additions to the Nextflow DSL:
@Factory that creates a channel from a BIDS dataset directory.@Operator that groups channel items by a closure-extracted key.@Operator that inner-joins two channels by closure-extracted keys.@Operator that produces the cartesian product within matched key groups.All operators are backed by their respective *Op implementation classes in
nfneuro.plugin.channel.operations and use nfneuro.plugin.channel.operations.keys.KeyExtractor
to validate and invoke the caller-supplied key-extraction closures.
| Fields inherited from class | Fields |
|---|---|
class nextflow.plugin.extension.PluginExtensionPoint |
__$stMC |
| Constructor and description |
|---|
BidsExtension() |
| Type Params | Return Type | Name and description |
|---|---|---|
|
groovyx.gpars.dataflow.DataflowWriteChannel |
combineBy(groovyx.gpars.dataflow.DataflowReadChannel left, groovyx.gpars.dataflow.DataflowReadChannel right, groovy.lang.Closure leftKeyExtractor, groovy.lang.Closure rightKeyExtractor, java.util.Map opts)Combine two channels by extracting and matching keys. |
|
groovyx.gpars.dataflow.DataflowWriteChannel |
combineBy(groovyx.gpars.dataflow.DataflowReadChannel left, groovyx.gpars.dataflow.DataflowReadChannel right, groovy.lang.Closure keyExtractor)Convenience overload — uses a single closure as both left and right key extractor. |
|
groovyx.gpars.dataflow.DataflowWriteChannel |
combineBy(groovyx.gpars.dataflow.DataflowReadChannel left, groovyx.gpars.dataflow.DataflowReadChannel right, groovy.lang.Closure keyExtractor, java.util.Map opts)Convenience overload — uses a single closure as both left and right key extractor, with an explicit options map. |
|
groovyx.gpars.dataflow.DataflowWriteChannel |
fromBIDS(java.lang.String bidsDir, java.lang.String configPath, java.util.Map options)Parse BIDS dataset and return channel |
|
groovyx.gpars.dataflow.DataflowWriteChannel |
groupTupleBy(groovyx.gpars.dataflow.DataflowReadChannel source, groovy.lang.Closure keyExtractor, java.util.Map opts)Group channel items by dynamically extracted keys. |
|
protected void |
init(nextflow.Session session)Called by the Nextflow plugin framework to inject the active session. |
|
groovyx.gpars.dataflow.DataflowWriteChannel |
joinBy(groovyx.gpars.dataflow.DataflowReadChannel left, groovyx.gpars.dataflow.DataflowReadChannel right, groovy.lang.Closure leftKeyExtractor, groovy.lang.Closure rightKeyExtractor, java.util.Map opts)Join two channels by dynamically extracted keys. |
|
groovyx.gpars.dataflow.DataflowWriteChannel |
joinBy(groovyx.gpars.dataflow.DataflowReadChannel left, groovyx.gpars.dataflow.DataflowReadChannel right, groovy.lang.Closure keyExtractor, java.util.Map opts)Convenience overload — uses a single closure as both left and right key extractor, with an explicit options map. |
| Methods inherited from class | Name |
|---|---|
class nextflow.plugin.extension.PluginExtensionPoint |
nextflow.plugin.extension.PluginExtensionPoint#$getLookup(), nextflow.plugin.extension.PluginExtensionPoint#getMetaClass(), nextflow.plugin.extension.PluginExtensionPoint#setMetaClass(groovy.lang.MetaClass), nextflow.plugin.extension.PluginExtensionPoint#equals(java.lang.Object), nextflow.plugin.extension.PluginExtensionPoint#toString(), nextflow.plugin.extension.PluginExtensionPoint#hashCode(), nextflow.plugin.extension.PluginExtensionPoint#getClass(), nextflow.plugin.extension.PluginExtensionPoint#notify(), nextflow.plugin.extension.PluginExtensionPoint#notifyAll(), nextflow.plugin.extension.PluginExtensionPoint#wait(long), nextflow.plugin.extension.PluginExtensionPoint#wait(long, int), nextflow.plugin.extension.PluginExtensionPoint#wait(), nextflow.plugin.extension.PluginExtensionPoint#getProperty(java.lang.String), nextflow.plugin.extension.PluginExtensionPoint#setProperty(java.lang.String, java.lang.Object), nextflow.plugin.extension.PluginExtensionPoint#invokeMethod(java.lang.String, java.lang.Object) |
Combine two channels by extracting and matching keys. Similar to Nextflow's combine(by:) operator but uses closures to extract keys from each item instead of tuple indices. Emits the cartesian product of items within each key group.
subjects = Channel.of(
[id: 'sub-01', age: 25],
[id: 'sub-02', age: 30]
)
sessions = Channel.of(
[id: 'sub-01', session: 'ses-01'],
[id: 'sub-01', session: 'ses-02'],
[id: 'sub-02', session: 'ses-01']
)
// Combine by subject ID (produces cartesian product for duplicates)
subjects.combineBy(
sessions,
{ it.id } // extract key from both left and right
)
.view { fused ->
"Subject ${fused.id}: age=${fused.age}, session=${fused.session}"
}
left - Left input channelright - Right input channelleftKeyExtractor - Closure that extracts the key from left itemsrightKeyExtractor - Closure that extracts the key from right itemsopts - Optional configuration (reserved for future: remainder)Convenience overload — uses a single closure as both left and right key extractor.
left - left input channelright - right input channelkeyExtractor - closure applied to items from both channels to derive the join keyConvenience overload — uses a single closure as both left and right key extractor, with an explicit options map.
left - left input channelright - right input channelkeyExtractor - closure applied to items from both channels to derive the join keyopts - optional configuration map (reserved for future use: remainder, filter)Parse BIDS dataset and return channel Creates a channel from a BIDS dataset with structured data grouping according to the provided configuration. Usage: Channel.fromBIDS('/path/to/bids/dataset', 'config.yaml', [bids_validation: false])
bidsDir - Path to BIDS dataset directoryconfigPath - Path to configuration YAML file (optional)options - Additional options map (bids_validation, libbids_sh_path, entity_aliases_json, etc.)Group channel items by dynamically extracted keys. Similar to groupTuple but uses a closure to extract the grouping key from each item, allowing for flexible grouping logic based on computed values, nested fields, or multiple attributes.
channel
.of([subject: 'sub-01', file: 'a.txt'],
[subject: 'sub-01', file: 'b.txt'],
[subject: 'sub-02', file: 'c.txt'])
.groupTupleBy { it.subject }
// Emits: ['sub-01', [[subject:'sub-01', file:'a.txt'], [subject:'sub-01', file:'b.txt']]]
// ['sub-02', [[subject:'sub-02', file:'c.txt']]]
source - The input channel to groupkeyExtractor - Closure that receives an item and returns its grouping keyopts - Optional configuration map (size, sort, remainder)Called by the Nextflow plugin framework to inject the active session.
session - the current Nextflow sessionJoin two channels by dynamically extracted keys. Similar to join but uses closures to extract matching keys from each channel, allowing for flexible join conditions based on computed values or nested fields.
anatomical = Channel.of([subject: 'sub-01', file: 't1.nii'])
functional = Channel.of([subject: 'sub-01', file: 'bold.nii'])
anatomical.joinBy(functional) { it.subject }
// Emits: [subject:'sub-01', file:'bold.nii', type:'bold']
left - Left input channelright - Right input channelleftKeyExtractor - Closure extracting key from left channel itemsrightKeyExtractor - Optional closure for right items (defaults to leftKeyExtractor)opts - Optional configuration (remainder, failOnDuplicate, failOnMismatch)Convenience overload — uses a single closure as both left and right key extractor, with an explicit options map.
left - left input channelright - right input channelkeyExtractor - closure applied to items from both channels to derive the join keyopts - optional configuration map (remainder, failOnDuplicate, failOnMismatch)