Class Variant

All Implemented Interfaces:
Serializable, Cloneable, Comparable<Interval>, TxtSerializable
Direct Known Subclasses:
VariantBnd, VariantNonRef, VariantVcfEntry, VariantWithScore

public class Variant extends Marker
A variant represents a change in a reference sequence

Notes: This class was previously known as Variant.

As of version 4.0, variants in the negative strand are NOT allowed any more (they just complicate the code and bring no real benefit).

We are also storing much less information fields like quality, score, coverage, etc. have been removed.

Author:
pcingola
See Also:
  • Field Details

    • HUGE_DELETION_SIZE_THRESHOLD

      public static final int HUGE_DELETION_SIZE_THRESHOLD
      See Also:
    • HUGE_DELETION_RATIO_THRESHOLD

      public static final double HUGE_DELETION_RATIO_THRESHOLD
      See Also:
    • NO_VARIANT

      public static final Variant NO_VARIANT
    • variantType

      protected Variant.VariantType variantType
    • ref

      protected String ref
    • alt

      protected String alt
    • genotype

      protected String genotype
    • imprecise

      protected boolean imprecise
  • Constructor Details

    • Variant

      public Variant()
    • Variant

      public Variant(Marker parent, int start, int end, String id)
      This constructor is used when we only have interval data (e.g. when reading a BED file)
    • Variant

      public Variant(Marker parent, int position, String referenceStr, String altStr)
    • Variant

      public Variant(Marker parent, int position, String referenceStr, String altStr, String id)
  • Method Details

    • factory

      public static List<Variant> factory(Chromosome chromo, int start, String ref, String altStr, String id, boolean expand)
      Create variants from ALT (which can be multiple values)
    • clone

      public Variant clone()
      Overrides:
      clone in class Marker
    • cloneShallow

      public Variant cloneShallow()
      Description copied from class: Marker
      Perform a shallow clone
      Overrides:
      cloneShallow in class Marker
    • compareTo

      public int compareTo(Interval i2)
      Compare by start and end
      Specified by:
      compareTo in interface Comparable<Interval>
      Overrides:
      compareTo in class Marker
    • decompose

      public Variant[] decompose()
      Decompose a variant into basic constituents At the moment this only makes sense for MIXED variants which are decomposed into two variants: MNP + InDel
    • getAlt

      public String getAlt()
    • getGenotype

      public String getGenotype()
    • setGenotype

      public void setGenotype(String genotype)
    • getReference

      public String getReference()
    • getVariantType

      public Variant.VariantType getVariantType()
    • setVariantType

      public void setVariantType(Variant.VariantType variantType)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Interval
    • isBnd

      public boolean isBnd()
    • isDel

      public boolean isDel()
    • isDup

      public boolean isDup()
    • isElongation

      public boolean isElongation()
    • isImprecise

      public boolean isImprecise()
    • setImprecise

      public void setImprecise(boolean imprecise)
    • isInDel

      public boolean isInDel()
    • isIns

      public boolean isIns()
    • isInterval

      public boolean isInterval()
    • isInv

      public boolean isInv()
    • isMixed

      public boolean isMixed()
    • isMnp

      public boolean isMnp()
    • isNonRef

      public boolean isNonRef()
    • isShowWarningIfParentDoesNotInclude

      protected boolean isShowWarningIfParentDoesNotInclude()
      Description copied from class: Marker
      Show an error if parent does not include child?
      Overrides:
      isShowWarningIfParentDoesNotInclude in class Marker
    • isSnp

      public boolean isSnp()
    • isStructural

      public boolean isStructural()
    • isStructuralHuge

      public boolean isStructuralHuge()
      Is this a huge structural variant?
    • isTruncation

      public boolean isTruncation()
    • isVariant

      public boolean isVariant()
      Is this a change or is ALT actually the same as the reference
    • lengthChange

      public int lengthChange()
      Calculate the number of bases of change in length
    • netChange

      public String netChange(boolean reverseStrand)
      Return the change (always compared to 'referenceStrand')
    • netChange

      public String netChange(Marker marker)
      Only the part of the change that overlaps with a marker Return the change (always in positive strand)
    • realignLeft

      public Variant realignLeft()
      Create a new variant realigning it towards the leftmost position
    • reverse

      public Variant reverse()
      Reverse variant (e.g. back to reference in cancer samples)
    • toString

      public String toString()
      Overrides:
      toString in class Marker
    • toStringEnsembl

      public String toStringEnsembl()
      Show variant in ENSEMBL's VEP format
    • toStringOld

      public String toStringOld()
      Old format, used for some test cases