Package htsjdk.variant.variantcontext
Class SimpleAllele
java.lang.Object
htsjdk.variant.variantcontext.SimpleAllele
- All Implemented Interfaces:
Allele
,Serializable
,Comparable<Allele>
An implementation of
Allele
which includes a byte[] of the bases in the allele or the symbolic name.
This has been made public as a base for classes which need to subclass Allele.
Most users should create alleles using Allele.create(byte[])
instead of interacting with this class directly.- See Also:
-
Field Summary
Fields inherited from interface htsjdk.variant.variantcontext.Allele
ALT_A, ALT_C, ALT_G, ALT_N, ALT_T, BREAKEND_EXTENDING_LEFT, BREAKEND_EXTENDING_RIGHT, NO_CALL, NO_CALL_STRING, NON_REF_ALLELE, NON_REF_STRING, REF_A, REF_C, REF_G, REF_N, REF_T, SINGLE_BREAKEND_INDICATOR, SPAN_DEL, SPAN_DEL_STRING, SV_SIMPLE_CNV, SV_SIMPLE_DEL, SV_SIMPLE_DUP, SV_SIMPLE_INS, SV_SIMPLE_INV, SYMBOLIC_ALLELE_END, SYMBOLIC_ALLELE_START, UNSPECIFIED_ALTERNATE_ALLELE, UNSPECIFIED_ALTERNATE_ALLELE_STRING
-
Constructor Summary
ModifierConstructorDescriptionprotected
SimpleAllele
(byte[] bases, boolean isRef) protected
SimpleAllele
(SimpleAllele allele, boolean ignoreRefState) Creates a new allele based on the provided one.protected
SimpleAllele
(String bases, boolean isRef) -
Method Summary
Modifier and TypeMethodDescriptionboolean
basesMatch
(byte[] test) boolean
basesMatch
(Allele test) boolean
basesMatch
(String test) int
boolean
Returns true if this and other are equal.boolean
byte[]
getBases()
Return the DNA bases segregating in this allele.Return the DNA bases segregating in this allele in String format.byte[]
Same as #getDisplayString() but returns the result as byte[].Return the printed representation of this allele.int
hashCode()
boolean
boolean
isCalled()
boolean
isNoCall()
boolean
boolean
boolean
isPrefixOf
(Allele other) boolean
boolean
boolean
int
length()
toString()
-
Constructor Details
-
SimpleAllele
protected SimpleAllele(byte[] bases, boolean isRef) -
SimpleAllele
-
SimpleAllele
Creates a new allele based on the provided one. Ref state will be copied unless ignoreRefState is true (in which case the returned allele will be non-Ref). This method is efficient because it can skip the validation of the bases (since the original allele was already validated)- Parameters:
allele
- the allele from which to copy the basesignoreRefState
- should we ignore the reference state of the input allele and use the default ref state?
-
-
Method Details
-
isPrefixOf
- Specified by:
isPrefixOf
in interfaceAllele
-
isNoCall
public boolean isNoCall() -
isCalled
public boolean isCalled() -
isReference
public boolean isReference()- Specified by:
isReference
in interfaceAllele
- Returns:
- true if this Allele is the reference allele
-
isNonReference
public boolean isNonReference()- Specified by:
isNonReference
in interfaceAllele
- Returns:
- true if this Allele is not the reference allele
-
isSymbolic
public boolean isSymbolic()- Specified by:
isSymbolic
in interfaceAllele
- Returns:
- true if this Allele is symbolic (i.e. no well-defined base sequence), this includes breakpoints and breakends
-
isBreakpoint
public boolean isBreakpoint()- Specified by:
isBreakpoint
in interfaceAllele
- Returns:
- true if this Allele is a breakpoint ( ex: G]17:198982] or ]13:123456]T )
-
isSingleBreakend
public boolean isSingleBreakend()- Specified by:
isSingleBreakend
in interfaceAllele
- Returns:
- true if this Allele is a single breakend (ex: .A or A.)
-
toString
-
getBases
public byte[] getBases()Return the DNA bases segregating in this allele. Note this isn't reference polarized, so the Null allele is represented by a vector of length 0 -
getBaseString
Return the DNA bases segregating in this allele in String format. This is useful, because toString() adds a '*' to reference alleles and getBases() returns garbage when you call toString() on it.- Specified by:
getBaseString
in interfaceAllele
- Returns:
- the segregating bases
-
getDisplayString
Return the printed representation of this allele. Same as getBaseString(), except for symbolic alleles. For symbolic alleles, the base string is empty while the display string contains <TAG>.- Specified by:
getDisplayString
in interfaceAllele
- Returns:
- the allele string representation
-
getDisplayBases
public byte[] getDisplayBases()Same as #getDisplayString() but returns the result as byte[]. Slightly faster then getDisplayString()- Specified by:
getDisplayBases
in interfaceAllele
- Returns:
- the allele string representation
-
equals
-
hashCode
public int hashCode() -
equals
Returns true if this and other are equal. If ignoreRefState is true, then doesn't require both alleles has the same ref tag -
basesMatch
public boolean basesMatch(byte[] test) - Specified by:
basesMatch
in interfaceAllele
- Parameters:
test
- bases to test against- Returns:
- true if this Allele contains the same bases as test, regardless of its reference status; handles Null and NO_CALL alleles
-
basesMatch
- Specified by:
basesMatch
in interfaceAllele
- Parameters:
test
- bases to test against- Returns:
- true if this Allele contains the same bases as test, regardless of its reference status; handles Null and NO_CALL alleles
-
basesMatch
- Specified by:
basesMatch
in interfaceAllele
- Parameters:
test
- allele to test against- Returns:
- true if this Allele contains the same bases as test, regardless of its reference status; handles Null and NO_CALL alleles
-
length
public int length() -
compareTo
- Specified by:
compareTo
in interfaceComparable<Allele>
-
isNonRefAllele
public boolean isNonRefAllele()- Specified by:
isNonRefAllele
in interfaceAllele
- Returns:
- true if Allele is either
<NON_REF>
or<*>
-