Skip to content

Commit

Permalink
Adding Allele constants for simple SV types(#1192)
Browse files Browse the repository at this point in the history
* adding constants for Simple structural variant types to Allele, ex SV_SIMPLE_DEL
  • Loading branch information
SHuang-Broad authored and lbergelson committed Oct 15, 2018
1 parent 23f3223 commit 1971f4e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/main/java/htsjdk/variant/variantcontext/Allele.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
package htsjdk.variant.variantcontext;

import htsjdk.samtools.util.StringUtil;
import htsjdk.variant.vcf.VCFConstants;

import java.io.Serializable;
import java.util.Arrays;
Expand Down Expand Up @@ -200,6 +199,16 @@ protected Allele(final Allele allele, final boolean ignoreRefState) {
public final static Allele NO_CALL = new Allele(NO_CALL_STRING, false);
public final static Allele NON_REF_ALLELE = new Allele(NON_REF_STRING, false);

// for simple deletion, e.g. "ALT==<DEL>" (note that the spec allows, for now at least, alt alleles like <DEL:ME>)
public final static Allele SV_SIMPLE_DEL = StructuralVariantType.DEL.toSymbolicAltAllele();
// for simple insertion, e.g. "ALT==<INS>"
public final static Allele SV_SIMPLE_INS = StructuralVariantType.INS.toSymbolicAltAllele();
// for simple inversion, e.g. "ALT==<INV>"
public final static Allele SV_SIMPLE_INV = StructuralVariantType.INV.toSymbolicAltAllele();
// for simple generic cnv, e.g. "ALT==<CNV>"
public final static Allele SV_SIMPLE_CNV = StructuralVariantType.CNV.toSymbolicAltAllele();
// for simple duplication, e.g. "ALT==<DUP>"
public final static Allele SV_SIMPLE_DUP = StructuralVariantType.DUP.toSymbolicAltAllele();

// ---------------------------------------------------------------------------------------------------------
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,18 @@ public enum StructuralVariantType {
* event can be summarized as a set of novel adjacencies.
* Each adjacency ties together two breakends.</cite>
*/
BND
BND;

// TODO: 10/10/18 one caveat: BND's have symbolic alt allele, but it takes more information (novel adjacency at the minimum)
/**
* Create angle-bracketed alt allele for simple SV types
* @return angle-bracketed alt allele for simple SV types
* @throws UnsupportedOperationException if this is invoked on a {@link #BND} object
*/
Allele toSymbolicAltAllele() {
if (this.equals(StructuralVariantType.BND)) {
throw new UnsupportedOperationException("BND type does not have angle bracketed alt allele");
}
return Allele.create("<" + name() + ">", false);
}
}

0 comments on commit 1971f4e

Please sign in to comment.