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
isPhasedmarker indicating where the alleles are phased with respect to some global coordinate system. See VCF4.1 spec for a detailed discussion - Inline, optimized
ints andint[]values for:- GQ: the phred-scaled genotype quality, or
-1if it's missing - DP: the count of reads at this locus for this sample, or
-1if 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.nullif 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).nullif 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
Genotypeobject is with aGenotypeBuilder, which permits values to be set in any order, which means thatGenotypeBuildermay 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 protectedFastGenotype(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()AllelegetAllele(int i)Get the ith allele in this genotypeList<Allele>getAlleles()intgetDP()Map<String,Object>getExtendedAttributes()Returns the extended attributes for this objectintgetGQ()Returns a phred-scaled quality score, or -1 if none is availableint[]getPL()Unsafe low-level accessor the PL field itself, may be null.booleanisPhased()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:
getAllelesin classGenotype- Returns:
- the alleles for this genotype. Cannot be null. May be empty
-
getAllele
public Allele getAllele(int i)
Description copied from class:GenotypeGet the ith allele in this genotype
-
isPhased
public boolean isPhased()
Description copied from class:GenotypeAre 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:GenotypeReturns a phred-scaled quality score, or -1 if none is available
-
getPL
public int[] getPL()
Description copied from class:GenotypeUnsafe low-level accessor the PL field itself, may be null.
-
-