Package htsjdk.variant.variantcontext
Class FastGenotype
- java.lang.Object
-
- htsjdk.variant.variantcontext.Genotype
-
- htsjdk.variant.variantcontext.FastGenotype
-
- All Implemented Interfaces:
Serializable
,Comparable<Genotype>
public final class FastGenotype extends Genotype
This class encompasses all the basic information about a genotype. For the sake of performance, it does not make a copy of the Collections/arrays it's constructed from, and so subsequent changes to those Collections/arrays will be reflected in the FastGenotype object A genotype has several key fields- a sample name, must be a non-null string
- an ordered list of alleles, intrepreted as the genotype of the sample, each allele for each chromosome given in order. If alleles = [a*, t] then the sample is a/t, with a (the reference from the *) the first chromosome and t on the second chromosome
- an
isPhased
marker indicating where the alleles are phased with respect to some global coordinate system. See VCF4.1 spec for a detailed discussion - Inline, optimized
int
s andint[]
values for:- GQ: the phred-scaled genotype quality, or
-1
if it's missing - DP: the count of reads at this locus for this sample, or
-1
if missing - AD: an array of counts of reads at this locus, one for each Allele at the site,
that is, for each allele in the surrounding
VariantContext
.null
if missing. - PL: phred-scaled genotype likelihoods in standard VCF4.1 order for
all combinations of the alleles in the surrounding
VariantContext
, given the ploidy of the sample (from the alleles vector).null
if missing.
- GQ: the phred-scaled genotype quality, or
- A general map from String keys to -> Object values for all other attributes in this genotype. Note that this map should not contain duplicate values for the standard bindings for GQ, DP, AD, and PL. Genotype filters can be put into this genotype, but it isn't respected by the GATK in analyses
The only way to build a
Genotype
object is with aGenotypeBuilder
, which permits values to be set in any order, which means thatGenotypeBuilder
may at some in the chain of sets pass through invalid states that are not permitted in a fully formed immutableGenotype
.Note this is a simplified, refactored Genotype object based on the original generic (and slow) implementation from the original VariantContext + Genotype codebase.
- Since:
- 05/12
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class htsjdk.variant.variantcontext.Genotype
PHASED_ALLELE_SEPARATOR, PRIMARY_KEYS, serialVersionUID, UNPHASED_ALLELE_SEPARATOR
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
FastGenotype(String sampleName, List<Allele> alleles, boolean isPhased, int GQ, int DP, int[] AD, int[] PL, String filters, Map<String,Object> extendedAttributes)
The only way to make one of these, for use by GenotypeBuilder only
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int[]
getAD()
Allele
getAllele(int i)
Get the ith allele in this genotypeList<Allele>
getAlleles()
int
getDP()
Map<String,Object>
getExtendedAttributes()
Returns the extended attributes for this objectint
getGQ()
Returns a phred-scaled quality score, or -1 if none is availableint[]
getPL()
Unsafe low-level accessor the PL field itself, may be null.boolean
isPhased()
Are the alleles phased w.r.t.-
Methods inherited from class htsjdk.variant.variantcontext.Genotype
compareTo, countAllele, determineType, getAlleleStrings, getAnyAttribute, getAttributeAsDouble, getAttributeAsInt, getAttributeAsString, getExtendedAttribute, getExtendedAttribute, getFilters, getGenotypeString, getGenotypeString, getLikelihoods, getLikelihoodsString, getLog10PError, getPhredScaledQual, getPloidy, getSampleName, getType, hasAD, hasAnyAttribute, hasDP, hasExtendedAttribute, hasForbiddenKey, hasGQ, hasLikelihoods, hasLog10PError, hasPL, isAvailable, isCalled, isFiltered, isForbiddenKey, isHet, isHetNonRef, isHom, isHomRef, isHomVar, isMixed, isNoCall, isNonInformative, sameGenotype, sameGenotype, sortedString, toBriefString, toString, toStringIfExists, toStringIfExists, toStringIfExists
-
-
-
-
Constructor Detail
-
FastGenotype
protected FastGenotype(String sampleName, List<Allele> alleles, boolean isPhased, int GQ, int DP, int[] AD, int[] PL, String filters, Map<String,Object> extendedAttributes)
The only way to make one of these, for use by GenotypeBuilder only- Parameters:
sampleName
-alleles
-isPhased
-GQ
-DP
-AD
-PL
-extendedAttributes
-
-
-
Method Detail
-
getAlleles
public List<Allele> getAlleles()
- Specified by:
getAlleles
in classGenotype
- Returns:
- the alleles for this genotype. Cannot be null. May be empty
-
getAllele
public Allele getAllele(int i)
Description copied from class:Genotype
Get the ith allele in this genotype
-
isPhased
public boolean isPhased()
Description copied from class:Genotype
Are the alleles phased w.r.t. the global phasing system?
-
getDP
public int getDP()
-
getAD
public int[] getAD()
-
getGQ
public int getGQ()
Description copied from class:Genotype
Returns a phred-scaled quality score, or -1 if none is available
-
getPL
public int[] getPL()
Description copied from class:Genotype
Unsafe low-level accessor the PL field itself, may be null.
-
-