Files
demultiplex/src/dataflow/combine_samples/main.nf
CI 86ee0107c2 Build branch v0.3 with version v0.3.0 (c9cf585)
Build pipeline: viash-hub.demultiplex.v0.3-fprsg

Source commit: c9cf585479

Source message: Bump version to v0.3.0
2024-12-11 09:36:54 +00:00

28 lines
820 B
Plaintext

workflow run_wf {
take:
input_ch
main:
output_ch = input_ch
| map { id, state ->
def newEvent = [state.id, state + ["_meta": ["join_id": id]]]
newEvent
}
| groupTuple(by: 0, sort: "hash")
| map {run_id, states ->
// Gather the following state for all samples
def forward_fastqs = states.collect{it.forward_input}.flatten()
def reverse_fastqs = states.collect{it.reverse_input}.findAll{it != null}.flatten()
def resultState = [
"output_forward": forward_fastqs,
"output_reverse": reverse_fastqs,
// The join ID is the same across all samples from the same run
"_meta": ["join_id": states[0]._meta.join_id]
]
return [run_id, resultState]
}
emit:
output_ch
}