Skip to content

Commit

Permalink
Ensure VariantContexts are sorted in ExtendedMultiVariantWalkerGroupe…
Browse files Browse the repository at this point in the history
…dOnStart, and bugfix to MendelianViolation code when child has one allele (#336)
  • Loading branch information
bbimber authored Jul 25, 2024
1 parent 38a1a58 commit f002b29
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.github.discvrseq.walkers;

import htsjdk.variant.variantcontext.VariantContext;
import htsjdk.variant.variantcontext.VariantContextComparator;
import org.broadinstitute.hellbender.engine.FeatureInput;
import org.broadinstitute.hellbender.engine.MultiVariantWalkerGroupedOnStart;

Expand Down Expand Up @@ -34,6 +35,9 @@ protected Map<FeatureInput<VariantContext>, List<VariantContext>> groupVariantsB
if (!byFeatureInput.containsKey(fi)) {
byFeatureInput.put(fi, Collections.emptyList());
}
else {
byFeatureInput.get(fi).sort(new VariantContextComparator(getBestAvailableSequenceDictionary()));
}
}

return byFeatureInput;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.broadinstitute.hellbender.utils.samples.Sex;

import javax.annotation.Nullable;
import java.io.Serial;
import java.util.*;

/**
Expand Down Expand Up @@ -161,6 +162,10 @@ public boolean isViolation(){
}

private static boolean testParents(Genotype gChild, Genotype gDad, Genotype gMom){
if (gChild.getAlleles().size() != 2) {
return false;
}

return !(gMom.getAlleles().contains(gChild.getAlleles().get(0)) && gDad.getAlleles().contains(gChild.getAlleles().get(1)) || gMom.getAlleles().contains(gChild.getAlleles().get(1)) && gDad.getAlleles().contains(gChild.getAlleles().get(0)));
}

Expand All @@ -182,10 +187,11 @@ public List<VCFCompoundHeaderLine> getDescriptions() { return Arrays.asList(
}

public static class NoCallGenotype extends Genotype {
@Serial
private static final long serialVersionUID = 1L;

private Genotype _orig = null;
private List<Allele> _alleles = Arrays.asList(Allele.NO_CALL, Allele.NO_CALL);
private final List<Allele> _alleles = Arrays.asList(Allele.NO_CALL, Allele.NO_CALL);

public NoCallGenotype(String sampleName)
{
Expand Down

0 comments on commit f002b29

Please sign in to comment.