Class VcfAllele

java.lang.Object
org.pharmgkb.parser.vcf.model.genotype.VcfAllele

@Immutable public class VcfAllele extends Object
An Allele matching the VCF 4.2 specification for the ALT and REF columns. For example:
  • ATgggcN
  • <IDxx>
  • ]34]ATGC
  • ]34:55]<IDxx>
  • Constructor Details

    • VcfAllele

      public VcfAllele(@Nonnull String string)
      Parameters:
      string - A string following the VCF specification for the REF or ALT columns
  • Method Details

    • toString

      @Nonnull public String toString()
      Overrides:
      toString in class Object
      Returns:
      The allele string from the constructor
    • length

      public int length() throws IllegalArgumentException
      Before calling, verify that this VcfAllele is not a breakpoint or a symbolic name.
      Returns:
      The number of bases in this Allele
      Throws:
      VcfFormatException - If this Allele is a breakpoint or symbolic name
      IllegalArgumentException
    • isBreakpoint

      public boolean isBreakpoint()
      Returns:
      Whether this Allele is defined using breakpoints (see the VCF spec)
    • isSymbolic

      public boolean isSymbolic()
      Returns:
      Whether this Allele contains a symbolic name like <IDxx>
    • isAmbigious

      public boolean isAmbigious()
      Returns:
      Whether this Allele contains 'N' or 'n' as a base (does not include symbolic names)
    • isDeleted

      public boolean isDeleted()
      Returns:
      Whether this Allele is '*', indicating a deletion upstream
    • isSimple

      public boolean isSimple()
      Returns:
      Whether this Allele is not symbolic, deleted, or a breakpoint
    • getPrimaryType

      public VcfAllele.PrimaryType getPrimaryType()
    • withLowercaseBases

      @Nonnull public String withLowercaseBases()
      Returns:
      A string where every base is in lowercase; symbolic names (e.g. <IDxx>) will not be lowercased
    • equalsIgnoreCase

      public boolean equalsIgnoreCase(@Nullable VcfAllele allele)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • containsBase

      public boolean containsBase(@Nonnull char... bases)
      Returns:
      Whether this Allele contains one or more of the characters (case-sensitive) in bases, restricted to bases (i.e. symbolic names like <IDxx> are excluded)