Package org.snpeff.vcf
Class VcfGenotype
- java.lang.Object
-
- org.snpeff.vcf.VcfGenotype
-
public class VcfGenotype extends java.lang.ObjectA VCF genotype field There is one genotype per sample in each VCF entry- Author:
- pablocingolani
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringGT_FIELD_ALLELIC_DEPTH_OF_COVERAGEstatic java.lang.StringGT_FIELD_DEPTH_OF_COVERAGE
-
Constructor Summary
Constructors Constructor Description VcfGenotype(VcfEntry vcfEntry, java.lang.String format, java.lang.String values)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(java.lang.String name, java.lang.String value)Add a name=value pair WARNING: This method does NOT change the FORMAT field.intdepth()Depth of coveragejava.lang.Stringget(java.lang.String fieldName)Get a genotype fieldint[]getGenotype()Get genotype numbers as an array E.g.java.lang.StringgetGenotype(int idx)Get genotype string by index WARNING: If the genotype is missing, it returns an empty string.intgetGenotypeCode()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 ALTintgetGenotypeCodeIgnoreMissing()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)java.lang.StringgetGenotypeStr()Return genotypes as string (e.g.VcfEntrygetVcfEntry()booleanisHeterozygous()Is the most likely genotype heterozygous?booleanisHomozygous()Is this genotype homozygous? (either REF or ALT)booleanisHomozygousAlt()Is this genotype homozygous ALT?booleanisMissing()Is genotpye missing (e.g.booleanisPhased()booleanisRef()Is any genotype different than REF? Note: This is calculated for the most likely genotype (GT field)booleanisVariant()Is any genotype different than REF? Note: This is calculated for the most likely genotype (GT field)intplodity()Genotype plodity (i.e.voidset(java.lang.String gtFieldName, java.lang.String gtValue)Set a genotype field valuevoidsetGenotype(java.lang.String gtValue)Set genotype valuejava.lang.StringtoString()
-
-
-
Field Detail
-
GT_FIELD_DEPTH_OF_COVERAGE
public static final java.lang.String GT_FIELD_DEPTH_OF_COVERAGE
- See Also:
- Constant Field Values
-
GT_FIELD_ALLELIC_DEPTH_OF_COVERAGE
public static final java.lang.String GT_FIELD_ALLELIC_DEPTH_OF_COVERAGE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
VcfGenotype
public VcfGenotype(VcfEntry vcfEntry, java.lang.String format, java.lang.String values)
-
-
Method Detail
-
add
public void add(java.lang.String name, java.lang.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 java.lang.String get(java.lang.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 java.lang.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 java.lang.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(java.lang.String gtFieldName, java.lang.String gtValue)Set a genotype field value
-
setGenotype
public void setGenotype(java.lang.String gtValue)
Set genotype value
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-