Package vcf

Class XBasicGT

  • All Implemented Interfaces:
    GT

    public final class XBasicGT
    extends java.lang.Object
    implements GT

    Class XBasicGT represents genotype and genotype emission probabilities for a set of samples optimized by sample.

    Instances of class XBasicGTWindow are immutable.
    • Constructor Summary

      Constructors 
      Constructor Description
      XBasicGT​(GT gl, Pedigree ped)
      Constructs a XBasicGT instance from the specified data.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int allele​(int marker, int hap)
      Returns the allele on the specified haplotype for the specified marker or return -1 if the allele is missing.
      int allele1​(int marker, int sample)
      Returns the first allele for the specified marker and sample or return -1 if the allele is missing.
      int allele2​(int marker, int sample)
      Returns the second allele for the specified marker and sample or return -1 if the allele is missing.
      float gl​(int marker, int sample, int allele1, int allele2)
      Returns the probability of the observed data for the specified marker and sample if the specified pair of ordered alleles is the true ordered genotype.
      boolean isGTData()
      Returns true if the value returned by this.gl() is determined by a called or missing genotype, and returns false otherwise.
      boolean isPhased()
      Returns true if the genotype for each marker and sample is a phased, non-missing genotype, and returns false otherwise.
      boolean isPhased​(int sample)
      Returns true if the genotype for each marker for the specified sample is a phased, nonmissing genotype, and returns false otherwise.
      boolean isPhased​(int marker, int sample)
      Returns true if the genotype for the specified marker and sample is a phased, nonmissing genotype, and returns false otherwise.
      Marker marker​(int markerIndex)
      Returns the specified marker.
      Markers markers()
      Returns the list of markers.
      int nHaps()
      Returns the number of haplotypes.
      int nMarkers()
      Returns the number of markers.
      int nSamples()
      Returns the number of samples.
      Samples samples()
      Returns the list of samples.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • XBasicGT

        public XBasicGT​(GT gl,
                        Pedigree ped)
        Constructs a XBasicGT instance from the specified data.
        Parameters:
        gl - the genotype likelihoods
        ped - the pedigrees
        Throws:
        java.lang.IllegalArgumentException - if gl.samples().equals(ped.samples())==false
        java.lang.NullPointerException - if gl == null || ped == null
    • Method Detail

      • isPhased

        public boolean isPhased()
        Description copied from interface: GT
        Returns true if the genotype for each marker and sample is a phased, non-missing genotype, and returns false otherwise.
        Specified by:
        isPhased in interface GT
        Returns:
        true if the genotype for each marker and sample is a phased, non-missing genotype
      • isGTData

        public boolean isGTData()
        Description copied from interface: GT
        Returns true if the value returned by this.gl() is determined by a called or missing genotype, and returns false otherwise.
        Specified by:
        isGTData in interface GT
        Returns:
        true if the value returned by this.gl() is determined by a called or missing genotype
      • isPhased

        public boolean isPhased​(int sample)
        Description copied from interface: GT
        Returns true if the genotype for each marker for the specified sample is a phased, nonmissing genotype, and returns false otherwise.
        Specified by:
        isPhased in interface GT
        Parameters:
        sample - a sample index
        Returns:
        true if the genotype for each marker for the specified sample is a phased, nonmissing genotype
      • gl

        public float gl​(int marker,
                        int sample,
                        int allele1,
                        int allele2)
        Description copied from interface: GT
        Returns the probability of the observed data for the specified marker and sample if the specified pair of ordered alleles is the true ordered genotype.
        Specified by:
        gl in interface GT
        Parameters:
        marker - the marker index
        sample - the sample index
        allele1 - the first allele index
        allele2 - the second allele index
        Returns:
        the probability of the observed data for the specified marker and sample if the specified pair of ordered alleles is the true ordered genotype
      • isPhased

        public boolean isPhased​(int marker,
                                int sample)
        Description copied from interface: GT
        Returns true if the genotype for the specified marker and sample is a phased, nonmissing genotype, and returns false otherwise.
        Specified by:
        isPhased in interface GT
        Parameters:
        marker - the marker index
        sample - the sample index
        Returns:
        true if the genotype for the specified marker and sample is a phased, nonmissing genotype
      • allele1

        public int allele1​(int marker,
                           int sample)
        Description copied from interface: GT
        Returns the first allele for the specified marker and sample or return -1 if the allele is missing. The two alleles for a sample are arbitrarily ordered if this.unphased(marker, sample) == false.
        Specified by:
        allele1 in interface GT
        Parameters:
        marker - the marker index
        sample - the sample index
        Returns:
        the first allele for the specified marker and sample
      • allele2

        public int allele2​(int marker,
                           int sample)
        Description copied from interface: GT
        Returns the second allele for the specified marker and sample or return -1 if the allele is missing. The two alleles for a sample are arbitrarily ordered if this.unphased(marker, sample) == false.
        Specified by:
        allele2 in interface GT
        Parameters:
        marker - the marker index
        sample - the sample index
        Returns:
        the allele for the specified marker and sample
      • allele

        public int allele​(int marker,
                          int hap)
        Description copied from interface: GT
        Returns the allele on the specified haplotype for the specified marker or return -1 if the allele is missing. The two alleles for an individual are arbitrarily ordered if this.unphased(marker, hap/2) == false.
        Specified by:
        allele in interface GT
        Parameters:
        marker - the marker index
        hap - the haplotype index
        Returns:
        the allele on the specified haplotype for the specified marker
      • nMarkers

        public int nMarkers()
        Description copied from interface: GT
        Returns the number of markers.
        Specified by:
        nMarkers in interface GT
        Returns:
        the number of markers
      • marker

        public Marker marker​(int markerIndex)
        Description copied from interface: GT
        Returns the specified marker.
        Specified by:
        marker in interface GT
        Parameters:
        markerIndex - a marker index
        Returns:
        the specified marker
      • markers

        public Markers markers()
        Description copied from interface: GT
        Returns the list of markers.
        Specified by:
        markers in interface GT
        Returns:
        the list of markers
      • nHaps

        public int nHaps()
        Description copied from interface: GT
        Returns the number of haplotypes. The returned value is equal to 2*this.nSamples().
        Specified by:
        nHaps in interface GT
        Returns:
        the number of haplotypes
      • nSamples

        public int nSamples()
        Description copied from interface: GT
        Returns the number of samples.
        Specified by:
        nSamples in interface GT
        Returns:
        the number of samples
      • samples

        public Samples samples()
        Description copied from interface: GT
        Returns the list of samples.
        Specified by:
        samples in interface GT
        Returns:
        the list of samples
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object