# Class Variant

java.lang.Object
org.snpeff.interval.Interval
org.snpeff.interval.Marker
org.snpeff.interval.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 As of version 4.0, variants have no strand, i.e. variants on the negative are NOT allowed because they just complicate the code and bring no real benefit.

Author:
  pcingola
See Also:
  - Serialized Form

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static enum`
`Variant.VariantType`

## Field Summary

Fields
Modifier and Type
Field
Description
`protected String`
`alt`
`protected String`
`genotype`
`static final double`
`HUGE_DELETION_RATIO_THRESHOLD`
`static final int`
`HUGE_DELETION_SIZE_THRESHOLD`
`protected boolean`
`imprecise`
`static final Variant`
`NO_VARIANT`
`protected String`
`ref`
`protected Variant.VariantType`
`variantType`

### Fields inherited from class Marker

`type`

### Fields inherited from class Interval

`chromosomeNameOri, end, id, parent, start, strandMinus`

## Constructor Summary

Constructors
Constructor
Description
`Variant()`
`Variant(Marker parent, int start, int end, String id)`
This constructor is used when we only have interval data (e.g.
`Variant(Marker parent, int position, String referenceStr, String altStr)`
`Variant(Marker parent, int position, String referenceStr, String altStr, String id)`

## Method Summary

Modifier and Type
Method
Description
`Variant`
`clone()`
`Variant`
`cloneShallow()`
Perform a shallow clone
`int`
`compareTo(Interval i2)`
Compare by start and end
`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
`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)
`String`
`getAlt()`
`String`
`getGenotype()`
`String`
`getReference()`
`Variant.VariantType`
`getVariantType()`
`int`
`hashCode()`
`boolean`
`isBnd()`
`boolean`
`isDel()`
`boolean`
`isDup()`
`boolean`
`isElongation()`
`boolean`
`isImprecise()`
`boolean`
`isInDel()`
`boolean`
`isIns()`
`boolean`
`isInterval()`
`boolean`
`isInv()`
`boolean`
`isMixed()`
`boolean`
`isMnp()`
`boolean`
`isNonRef()`
`protected boolean`
`isShowWarningIfParentDoesNotInclude()`
Show an error if parent does not include child?
`boolean`
`isSnp()`
`boolean`
`isStructural()`
`boolean`
`isStructuralHuge()`
Is this a huge structural variant?
`boolean`
`isTruncation()`
`boolean`
`isVariant()`
Is this a change or is ALT actually the same as the reference
`int`
`lengthChange()`
Calculate the number of bases of change in length
`String`
`netChange(boolean reverseStrand)`
Return the change (always compared to 'referenceStrand')
`String`
`netChange(Marker marker)`
Only the part of the change that overlaps with a marker Return the change (always in positive strand)
`Variant`
`realignLeft()`
Create a new variant realigning it towards the leftmost position
`Variant`
`reverse()`
Reverse variant (e.g.
`void`
`setGenotype(String genotype)`
`void`
`setImprecise(boolean imprecise)`
`void`
`setVariantType(Variant.VariantType variantType)`
`String`
`toString()`
`String`
`toStringEnsembl()`
Show variant in ENSEMBL's VEP format
`String`
`toStringOld()`
Old format, used for some test cases

### Methods inherited from class Marker

`adjust, apply, applyDel, applyDup, applyIns, applyMixed, codonTable, compareToPos, distance, distanceBases, getParent, getType, idChain, idChain, idChain, includes, intersect, isAdjustIfParentDoesNotInclude, isDeferredAnalysis, minus, query, query, readTxt, serializeParse, serializeSave, shouldApply, union, variantEffect, variantEffectNonRef`

### Methods inherited from class Interval

`equals, findParent, getChromosome, getChromosomeName, getChromosomeNameOri, getChromosomeNum, getEnd, getGenome, getGenomeName, getId, getStart, getStrand, intersects, intersects, intersects, intersects, intersectSize, isCircular, isSameChromo, isStrandMinus, isStrandPlus, isValid, setChromosomeNameOri, setEnd, setId, setParent, setStart, setStrandMinus, shiftCoordinates, size, toStr, toStringAsciiArt, toStrPos`

### Methods inherited from class Object

`equals, finalize, getClass, notify, notifyAll, wait, wait, wait`

## Field Details

### HUGE_DELETION_SIZE_THRESHOLD

public static final int HUGE_DELETION_SIZE_THRESHOLD

See Also:
  - Constant Field Values

### HUGE_DELETION_RATIO_THRESHOLD

public static final double HUGE_DELETION_RATIO_THRESHOLD

See Also:
  - Constant Field Values

### 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