Skip to content

Commit

Permalink
non-assembled events edge case
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbenjamin committed Mar 6, 2024
1 parent a4a146c commit be4b7de
Showing 1 changed file with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,17 @@ public CalledHaplotypes callMutations(
for (final Allele allele : outputCall.getAlternateAlleles()) {
// note: this creates the minimal representation behind the scenes
final Event event = new Event(outputCall.getContig(), outputCall.getStart(), outputCall.getReference(), allele);
final Haplotype bestHaplotype = haplotypesByEvent.get(event).stream()
.sorted(Comparator.comparingInt(h -> haplotypeSupportCounts.getOrDefault(h, new MutableInt(0)).intValue()).reversed())
.findFirst().get();

eventCountAnnotations.computeIfAbsent(outputCall, vc -> new ArrayList<>())
.add(bestHaplotype.getEventMap().getNumberOfEvents());
// haplotypesByEvent contains every *assembled* event, including events injected into the original assembly,
// but there are some modes where we genotype events that were never in an assembly graph, in which case
// this annotation is irrelevant
if (haplotypesByEvent.containsKey(event)) {
final Haplotype bestHaplotype = haplotypesByEvent.get(event).stream()
.sorted(Comparator.comparingInt(h -> haplotypeSupportCounts.getOrDefault(h, new MutableInt(0)).intValue()).reversed())
.findFirst().get();

eventCountAnnotations.computeIfAbsent(outputCall, vc -> new ArrayList<>())
.add(bestHaplotype.getEventMap().getNumberOfEvents());
}
}
}
final List<VariantContext> outputCallsWithEventCountAnnotation = outputCalls.stream()
Expand Down

0 comments on commit be4b7de

Please sign in to comment.