Skip to content

Commit

Permalink
a few very minor comment tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesemery committed Jan 30, 2023
1 parent 0ae8da5 commit a70603e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,9 @@ public static AssemblyResultSet applyPileupEventsAsForcedAlleles(final AssemblyR
final AssemblyResultSet assemblyResultSet, final List<VariantContext> pileupAllelesFoundShouldFilter,
final List<VariantContext> pileupAllelesPassingFilters, final boolean debug) {
List<Haplotype> haplotypesWithFilterAlleles = new ArrayList<>();
// IF we find pileup alleles that we want to filter... AND we are not generating the partially determined haplotypes,
// we resort to a messy approach where we filter alleles by throwing away every haplotype supporting an allele. This is
// very dangerous since this could easily destroy phased variants with the haplotype.
if (!pileupAllelesFoundShouldFilter.isEmpty() && !argumentCollection.pileupDetectionArgs.generatePDHaplotypes) {
// TODO this is a bad algorithm for bad people
for(VariantContext delVariant : pileupAllelesFoundShouldFilter) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -671,19 +671,22 @@ public List<VariantContext> callRegion(final AssemblyRegion region, final Featur
.filter(v -> PileupBasedAlleles.passesFilters(hcArgs.pileupDetectionArgs, v))
.collect(Collectors.toList());

// Regenerate the list of AllVariationEvents, filtering out assembled variants that must be filtered according to the pileupcaller code.
final SortedSet<VariantContext> allVariationEvents = new TreeSet<>(
AssemblyResultSet.HAPLOTYPE_VARIANT_CONTEXT_COMPARATOR);
allVariationEvents.addAll(untrimmedAssemblyResult.getVariationEvents(hcArgs.maxMnpDistance).stream()
.filter(outerVC -> { return pileupAllelesFoundShouldFilter.stream().noneMatch(filterAllle -> filterAllle.getStart() == outerVC.getStart()
&& filterAllle.getReference().equals(outerVC.getReference())
&& filterAllle.getAlternateAllele(0).equals(outerVC.getAlternateAllele(0)));
}).collect(Collectors.toList()));
// Add any new pileupcaller alleles to the variation events
for (final VariantContext pileupAllele : pileupAllelesPassingFilters) {
//these are events from single haplotypes, so we can do a simple comparison without trimming
if (allVariationEvents.stream().noneMatch(vc -> vc.getStart() == pileupAllele.getStart() && vc.getAlternateAllele(0).basesMatch(pileupAllele.getAlternateAllele(0)))) {
allVariationEvents.add(pileupAllele);
}
}
// Add given alleles to the variation events
for (final VariantContext given : givenAlleles) {
//these are events from single haplotypes, so we can do a simple comparison without trimming
if (allVariationEvents.stream().noneMatch(vc -> vc.getStart() == given.getStart() && vc.getAlternateAllele(0).basesMatch(given.getAlternateAllele(0)))) {
Expand Down

0 comments on commit a70603e

Please sign in to comment.