@groovy.util.logging.Slf4j @groovy.transform.CompileStatic class CombineByOp extends java.lang.Object
Combines two channels by extracting and matching keys. This operator implements combine logic similar to Nextflow's combine(by:) operator, but uses closures to dynamically extract the join key from each item instead of requiring tuple indices. Key features: - Uses closures for flexible key extraction from both channels - Emits fused items (key is used internally for matching and not emitted) - Produces full cartesian product for items with matching keys - Drops unmatched keys (inner join semantics) Use cases: - Combine subjects with sessions by subject ID - Combine scans with parameters by matching fields - Generate all pairwise combinations within groups Example:
subjects.combineBy(
sessions,
{ it.subject } // extract key from both left and right items
)
.view { fused -> "Combined item: ${fused}" }
| Constructor and description |
|---|
CombineByOp(groovyx.gpars.dataflow.DataflowReadChannel left, groovyx.gpars.dataflow.DataflowReadChannel right, groovy.lang.Closure leftKeyExtractor, groovy.lang.Closure rightKeyExtractor, java.util.Map opts)Create a new CombineByOp operator. |
CombineByOp(groovyx.gpars.dataflow.DataflowReadChannel left, groovyx.gpars.dataflow.DataflowReadChannel right, groovy.lang.Closure leftKeyExtractor, groovy.lang.Closure rightKeyExtractor) |
CombineByOp(groovyx.gpars.dataflow.DataflowReadChannel left, groovyx.gpars.dataflow.DataflowReadChannel right, groovy.lang.Closure keyExtractor, java.util.Map opts) |
CombineByOp(groovyx.gpars.dataflow.DataflowReadChannel left, groovyx.gpars.dataflow.DataflowReadChannel right, groovy.lang.Closure keyExtractor) |
| Type Params | Return Type | Name and description |
|---|---|---|
|
groovyx.gpars.dataflow.DataflowWriteChannel |
apply()Apply the combine operator. |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait() |
Create a new CombineByOp operator.
left - The left input channelright - The right input channelleftKeyExtractor - Closure that extracts the key from left itemsrightKeyExtractor - Closure that extracts the key from right itemsopts - Optional configuration (reserved for future use: remainder, filter)