Skip to content

Commit

Permalink
Add logging to triage missing variant mask issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ramari16 committed Jan 29, 2024
1 parent 0982462 commit a42d7da
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public Optional<VariantMasks> getMasks(String variant, VariantBucketHolder<Varia
bucketCache.lastContig = contig;
bucketCache.lastChunkOffset = chrOffset;
}
return bucketCache.lastValue == null ? Optional.empty() : Optional.of(bucketCache.lastValue.get(variant));
return bucketCache.lastValue == null ? Optional.empty() : Optional.ofNullable(bucketCache.lastValue.get(variant));
}

public String[] getHeaders() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package edu.harvard.hms.dbmi.avillach.hpds.processing;

import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import edu.harvard.hms.dbmi.avillach.hpds.data.genotype.VariantMasks;
Expand Down Expand Up @@ -70,17 +71,21 @@ public BigInteger getPatientIdsForIntersectionOfVariantSets(Set<Integer> patient
List<List<String>> variantBuckets = variantBucketPartitions.get(x);
variantBuckets.parallelStream().forEach(variantBucket -> {
VariantBucketHolder<VariantMasks> bucketCache = new VariantBucketHolder<>();
List<String> missingVariants = new ArrayList<>();
variantBucket.forEach(variantSpec -> {
variantService.getMasks(variantSpec, bucketCache).ifPresent(masks -> {
Optional<VariantMasks> variantMask = variantService.getMasks(variantSpec, bucketCache);
variantMask.ifPresentOrElse(masks -> {
BigInteger heteroMask = masks.heterozygousMask == null ? variantService.emptyBitmask() : masks.heterozygousMask;
BigInteger homoMask = masks.homozygousMask == null ? variantService.emptyBitmask() : masks.homozygousMask;
BigInteger orMasks = heteroMask.or(homoMask);
BigInteger andMasks = orMasks.and(patientsInScopeMask);
synchronized(matchingPatients) {
matchingPatients[0] = matchingPatients[0].or(andMasks);
}
});
}, () -> missingVariants.add(variantSpec));
});
log.info(missingVariants.size() + "variant masks not found");
log.info("Variants missing masks: " + Joiner.on(",").join( missingVariants.subList(0, 100)));
});
}
return matchingPatients[0];
Expand Down

0 comments on commit a42d7da

Please sign in to comment.