Class 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 ints and int[] 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.
    • 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 a GenotypeBuilder, which permits values to be set in any order, which means that GenotypeBuilder may at some in the chain of sets pass through invalid states that are not permitted in a fully formed immutable Genotype.

    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
    • 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 class Genotype
        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
        Specified by:
        getAllele in class Genotype
        Parameters:
        i - the ith allele, must be < the ploidy, starting with 0
        Returns:
        the allele at position i, which cannot be null
      • isPhased

        public boolean isPhased()
        Description copied from class: Genotype
        Are the alleles phased w.r.t. the global phasing system?
        Specified by:
        isPhased in class Genotype
        Returns:
        true if yes
      • getDP

        public int getDP()
        Specified by:
        getDP in class Genotype
        Returns:
        the sequencing depth of this sample, or -1 if this value is missing
      • getAD

        public int[] getAD()
        Specified by:
        getAD in class Genotype
        Returns:
        the count of reads, one for each allele in the surrounding Variant context, matching the corresponding allele, or null if this value is missing. MUST NOT BE MODIFIED!
      • getGQ

        public int getGQ()
        Description copied from class: Genotype
        Returns a phred-scaled quality score, or -1 if none is available
        Specified by:
        getGQ in class Genotype
        Returns:
      • getPL

        public int[] getPL()
        Description copied from class: Genotype
        Unsafe low-level accessor the PL field itself, may be null.
        Specified by:
        getPL in class Genotype
        Returns:
        a pointer to the underlying PL data. MUST NOT BE MODIFIED!
      • getExtendedAttributes

        public Map<String,​Object> getExtendedAttributes()
        Description copied from class: Genotype
        Returns the extended attributes for this object
        Specified by:
        getExtendedAttributes in class Genotype
        Returns:
        is never null, but is often isEmpty()