Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for non-symbolic alt alleles before left aligning in liftover #1909

Merged
merged 1 commit into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/main/java/picard/util/LiftoverUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,9 @@ protected static VariantContextBuilder reverseComplementVariantContext(final Var
private static boolean isIndelForLiftover(final VariantContext vc) {
final Allele ref = vc.getReference();
if (ref.length() != 1) {
return true;
//need to make sure the only other alleles are not all symbolic or spanning deletion
return vc.getAlternateAlleles().stream()
.anyMatch(a -> !a.isSymbolic() && !a.equals(Allele.SPAN_DEL));
}

return vc.getAlleles().stream()
Expand Down
14 changes: 14 additions & 0 deletions src/test/java/picard/util/LiftoverVcfTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ public Iterator<Object[]> indelFlipData() {
final Allele RefT = Allele.create("T", true);
final Allele RefA = Allele.create("A", true);
final Allele RefAC = Allele.create("AC", true);
final Allele RefGT = Allele.create("GT", true);
final Allele RefC = Allele.create("C", true);
final Allele RefG = Allele.create("G", true);

Expand Down Expand Up @@ -621,6 +622,19 @@ public Iterator<Object[]> indelFlipData() {
result_builder.genotypes(resultGenotypeBuilder.make());
tests.add(new Object[]{builder.make(), REFERENCE, result_builder.make()});

// a spanning deletion with a multibase reference (for example a multiallelic mnp which has be split), where the spanning deletion is the only alt
// AC, * --> GT, *
start = CHAIN_SIZE - 13;
stop = start + 1;

builder.start(start).stop(stop).alleles(CollectionUtil.makeList(RefAC, spanningDeletion));
result_builder.start(CHAIN_SIZE - stop + 1).stop(CHAIN_SIZE - start + 1).alleles(CollectionUtil.makeList(RefGT, spanningDeletion));
genotypeBuilder.alleles(builder.getAlleles());
resultGenotypeBuilder.alleles(result_builder.getAlleles());
builder.genotypes(genotypeBuilder.make());
result_builder.genotypes(resultGenotypeBuilder.make());
tests.add(new Object[]{builder.make(), REFERENCE, result_builder.make()});

builder.noGenotypes();
result_builder.noGenotypes();

Expand Down
Loading