diff --git a/etl/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/etl/genotype/GenomicDatasetMerger.java b/etl/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/etl/genotype/GenomicDatasetMerger.java index 29dcaf15..ea94f7c7 100644 --- a/etl/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/etl/genotype/GenomicDatasetMerger.java +++ b/etl/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/etl/genotype/GenomicDatasetMerger.java @@ -249,13 +249,16 @@ public FileBackedJsonIndexStorage mergedMasks = new ConcurrentHashMap<>(); variantMaskStorage2.keys().forEach(key -> { - Map masks2 = variantMaskStorage2.get(key); - for (Map.Entry entry : masks2.entrySet()) { - if (!mergedMasks.containsKey(entry.getKey())) { - mergedMasks.put(entry.getKey(), new VariableVariantMasks(variantStore1.getPatientIds().length).append(entry.getValue())); + if (variantMaskStorage1.get(key) == null) { + ConcurrentHashMap mergedMasks = new ConcurrentHashMap<>(); + Map masks2 = variantMaskStorage2.get(key); + for (Map.Entry entry : masks2.entrySet()) { + if (!mergedMasks.containsKey(entry.getKey())) { + mergedMasks.put(entry.getKey(), new VariableVariantMasks(variantStore1.getPatientIds().length).append(entry.getValue())); + } } + merged.put(key, mergedMasks); } }); return merged;