Sort file names after using groupTuple #2207
Replies: 2 comments 2 replies
-
Hi @zillurbmb51 , for questions related to usage of Nextflow, please make use of the discussions forum. The issues sections are used for bugs/feature request regarding Nextflow runtime. This is a new functionality of Github and similar to issues, but dedicated to only questions. |
Beta Was this translation helpful? Give feedback.
-
Regarding the solution, I think that we could rely on some Groovy magic and closure over here Given the following files in the filesystem
We want to soft them based on the
This yields the desired result
|
Beta Was this translation helpful? Give feedback.
-
Hi, I have a similar issue #347 only have numbers in the file name.
The solution there:
my_channel.groupTuple().map { chrom,bgen -> tuple( chrom, bgen.sort{it.name})}
does not resolve the problem, because in my file name there are numbers existed. example:
[chr1, [chr1.step10.imputed.chunk0.bgen, chr1.step10.imputed.chunk1.bgen, chr1.step10.imputed.chunk2.bgen, chr1.step10.imputed.chunk3.bgen,.....]]
After using
.map { chrom,bgen -> tuple( chrom, bgen.sort{it.name})}
it is giving me[chr1, [chr1.step10.imputed.chunk0.bgen, chr1.step10.imputed.chunk1.bgen, chr1.step10.imputed.chunk10.bgen, chr1.step10.imputed.chunk11.bgen,.....]]
. As I understand, sorting order was0,1,10,11,12,...
but I need,0,1,2,3,4...
That means[chr1, [chr1.step10.imputed.chunk0.bgen, chr1.step10.imputed.chunk1.bgen, chr1.step10.imputed.chunk2.bgen, chr1.step10.imputed.chunk3.bgen,.....]]
. How could I get that after usinggroupTuple
?Beta Was this translation helpful? Give feedback.
All reactions