From 9d17741530bedc09e2a0417a0a70d90755b749ee Mon Sep 17 00:00:00 2001 From: Ryan Amari Date: Tue, 11 Jun 2024 14:11:08 -0400 Subject: [PATCH] ALS-6330: Implement createMaskForPatientSet for patient merging genomic processor --- .../hpds/processing/GenomicProcessorParentImpl.java | 2 +- .../GenomicProcessorPatientMergingParentImpl.java | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/processing/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/processing/GenomicProcessorParentImpl.java b/processing/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/processing/GenomicProcessorParentImpl.java index 9689edd7..7da6f4fb 100644 --- a/processing/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/processing/GenomicProcessorParentImpl.java +++ b/processing/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/processing/GenomicProcessorParentImpl.java @@ -64,7 +64,7 @@ public VariantMask createMaskForPatientSet(Set patientSubset) { VariantMask result = nodes.parallelStream() .map(node -> node.createMaskForPatientSet(patientSubset)) .reduce(VariantMask::union) - .orElse(VariantMask.emptyInstance()); + .orElseGet(VariantMask::emptyInstance); return result; } diff --git a/processing/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/processing/GenomicProcessorPatientMergingParentImpl.java b/processing/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/processing/GenomicProcessorPatientMergingParentImpl.java index c3db2b11..70263401 100644 --- a/processing/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/processing/GenomicProcessorPatientMergingParentImpl.java +++ b/processing/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/processing/GenomicProcessorPatientMergingParentImpl.java @@ -90,7 +90,11 @@ public Set patientMaskToPatientIdSet(VariantMask patientMask) { @Override public VariantMask createMaskForPatientSet(Set patientSubset) { - throw new RuntimeException("Not implemented"); + return nodes.stream() + .map(node -> new SizedVariantMask(node.createMaskForPatientSet(patientSubset), node.getPatientIds().size())) + .reduce(this::appendMask) + .map(SizedVariantMask::getVariantMask) + .orElseGet(VariantMask::emptyInstance); } @Override