Package org.snpeff.vcf

# Class VcfGenotype

java.lang.Object
org.snpeff.vcf.VcfGenotype

public class VcfGenotype extends Object
A VCF genotype field There is one genotype per sample in each VCF entry

Author:
  pablocingolani

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`GT_FIELD_ALLELIC_DEPTH_OF_COVERAGE`
`static final String`
`GT_FIELD_DEPTH_OF_COVERAGE`

## Constructor Summary

Constructors
Constructor
Description
`VcfGenotype(VcfEntry vcfEntry, String format, String values)`

## Method Summary

Modifier and Type
Method
Description
`void`
`add(String name, String value)`
Add a name=value pair WARNING: This method does NOT change the FORMAT field.
`int`
`depth()`
Depth of coverage
`String`
`get(String fieldName)`
Get a genotype field
`int[]`
`getGenotype()`
Get genotype numbers as an array E.g.
`String`
`getGenotype(int idx)`
Get genotype string by index WARNING: If the genotype is missing, it returns an empty string.
`int`
`getGenotypeCode()`
Return as a genotype SNP code: -1: if missing data of more than one ALT 0: if aa (0/0) 1: if Aa (0/1 or 1/0) 2: if AA (1/1) WARNING: In multi-allelic case, any non-ref is treated as ALT
`int`
`getGenotypeCodeIgnoreMissing()`
Return as a genotype SNP code: 0: if aa (0/0) or any missing value 1: if Aa (0/1 or 1/0) 2: if AA (1/1)
`String`
`getGenotypeStr()`
Return genotypes as string (e.g.
`VcfEntry`
`getVcfEntry()`
`boolean`
`isHeterozygous()`
Is the most likely genotype heterozygous?
`boolean`
`isHomozygous()`
Is this genotype homozygous? (either REF or ALT)
`boolean`
`isHomozygousAlt()`
Is this genotype homozygous ALT?
`boolean`
`isMissing()`
Is genotpye missing (e.g.
`boolean`
`isPhased()`
`boolean`
`isRef()`
Is any genotype different than REF? Note: This is calculated for the most likely genotype (GT field)
`boolean`
`isVariant()`
Is any genotype different than REF? Note: This is calculated for the most likely genotype (GT field)
`int`
`plodity()`
Genotype plodity (i.e.
`void`
`set(String gtFieldName, String gtValue)`
Set a genotype field value
`void`
`setGenotype(String gtValue)`
Set genotype value
`String`
`toString()`

### Methods inherited from class java.lang.Object

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

## Field Details

### GT_FIELD_DEPTH_OF_COVERAGE

public static final String GT_FIELD_DEPTH_OF_COVERAGE

See Also:
  - Constant Field Values

### GT_FIELD_ALLELIC_DEPTH_OF_COVERAGE

public static final String GT_FIELD_ALLELIC_DEPTH_OF_COVERAGE

See Also:
  - Constant Field Values

## Constructor Details

### VcfGenotype

public VcfGenotype(VcfEntry vcfEntry, String format, String values)

## Method Details

### add

public void add(String name, String value)
Add a name=value pair WARNING: This method does NOT change the FORMAT field. Use VcfEntry.addFormat() method

### depth

public int depth()
Depth of coverage

Returns:
  -1 if not found

### get

public String get(String fieldName)
Get a genotype field

### getGenotype

public int[] getGenotype()
Get genotype numbers as an array E.g. '0/1' -> {0, 1} WARNING: If the genotype is missing, the numeric value is '-1'. E.g.: './.' -> {-1, -1}

Returns:

### getGenotype

public String getGenotype(int idx)
Get genotype string by index WARNING: If the genotype is missing, it returns an empty string. E.g.: './.' -> getGenotype(0) = ""

Returns:

### getGenotypeCode

public int getGenotypeCode()
Return as a genotype SNP code: -1: if missing data of more than one ALT 0: if aa (0/0) 1: if Aa (0/1 or 1/0) 2: if AA (1/1) WARNING: In multi-allelic case, any non-ref is treated as ALT

Returns:

### getGenotypeCodeIgnoreMissing

public int getGenotypeCodeIgnoreMissing()
Return as a genotype SNP code: 0: if aa (0/0) or any missing value 1: if Aa (0/1 or 1/0) 2: if AA (1/1)

Returns:

### getGenotypeStr

public String getGenotypeStr()
Return genotypes as string (e.g. "A/C")

Returns:

### getVcfEntry

public VcfEntry getVcfEntry()

### isHeterozygous

public boolean isHeterozygous()
Is the most likely genotype heterozygous?

Returns:

### isHomozygous

public boolean isHomozygous()
Is this genotype homozygous? (either REF or ALT)

### isHomozygousAlt

public boolean isHomozygousAlt()
Is this genotype homozygous ALT?

### isMissing

public boolean isMissing()
Is genotpye missing (e.g. "GT=./.")

Returns:

### isPhased

public boolean isPhased()

### isRef

public boolean isRef()
Is any genotype different than REF? Note: This is calculated for the most likely genotype (GT field)

### isVariant

public boolean isVariant()
Is any genotype different than REF? Note: This is calculated for the most likely genotype (GT field)

### plodity

public int plodity()
Genotype plodity (i.e. how many copies of the chromosome does it have)

### set

public void set(String gtFieldName, String gtValue)
Set a genotype field value

### setGenotype

public void setGenotype(String gtValue)
Set genotype value

### toString

public String toString()

Overrides:
  `toString` in class `Object`