Skip to content

A way to partially split a groupedTuple by chunks, respecting key #4827

Answered by robsyme
VasLem asked this question in Q&A
Discussion options

You must be logged in to vote

It is not quite clear what you are trying to achieve, so the suggestion below may or may not be appropriate. If I've misunderstood, would you be able to provide a small example workflow showing the problem?

Given input data:

data
├── sample1
│   ├── data.1.dat
│   ├── data.2.dat
│   ├── data.3.dat
│   ├── data.4.dat
│   ├── data.5.dat
│   └── data.6.dat
└── sample2
    ├── data.1.dat
    ├── data.2.dat
    ├── data.3.dat
    └── data.4.dat

We can generate a channel that meets your input requirements:

workflow {
    Channel.fromPath("data/sample*/*.dat")
    | map { [it.getParent().name, it] }
    | groupTuple
    | view
}

Which emits a channel with contents:

[sample2, [data/sample2/data.…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@VasLem
Comment options

@robsyme
Comment options

robsyme Mar 19, 2024
Collaborator

Answer selected by VasLem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants
Converted from issue

This discussion was converted from issue #4826 on March 19, 2024 12:47.