Skip to content

Commit 8d87019

Browse files
authored
Use getGroupTarget to upwrap groupKey instead of converting to Map. (#649)
1 parent a5133d9 commit 8d87019

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

docs/advanced/grouping.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ genotyped_bams = GenotypeOnInterval(combined_bams)
334334
.view { meta, bamfile -> "Meta is of ${meta.getClass()}" }
335335
```
336336

337-
To ensure that grouping is performed only on the relevant elements, we can convert the `groupKey` back into a plain Map using the `as Map` operator. This allows the `groupTuple` operator to group by just the keys present in the map, similar to how `subMap` works. This approach ensures that downstream grouping and merging steps operate on the intended sample attributes.
337+
To ensure that grouping is performed only on the relevant elements, we can unwrap the `groupKey` to return the underlying `Map` using the `getGroupTarget()` method available on groupKeys. This allows the `groupTuple` operator to group by just the keys present in the map, similar to how `subMap` works. This approach ensures that downstream grouping and merging steps operate on the intended sample attributes.
338338

339339
```groovy linenums="71" hl_lines="13"
340340
mapped_reads = MapReads( samples, reference )
@@ -349,7 +349,7 @@ combined_bams = CombineBams(mapped_reads)
349349
.combine( intervals )
350350
351351
genotyped_bams = GenotypeOnInterval(combined_bams)
352-
.map { groupKey, bamfile -> [groupKey as Map, bamfile] }
352+
.map { groupKey, bamfile -> [groupKey.getGroupTarget(), bamfile] }
353353
.groupTuple()
354354
355355
merged_bams = MergeGenotyped(genotyped_bams)

0 commit comments

Comments
 (0)