Package vcf

Class BitArrayRefGTRec

  • All Implemented Interfaces:
    IntArray, DuplicatesGTRec, GTRec, MarkerContainer

    public final class BitArrayRefGTRec
    extends java.lang.Object
    implements GTRec

    Class BitArrayRefGTRec represents phased, nonmissing, genotypes for a list of samples at a single marker. Instances of class BitArrayRefGTRec store haplotype alleles in bit sets.

    Instances of class BitArrayRefGTRec are immutable.

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int allele1​(int sample)
      Returns the first allele for the specified sample or -1 if the allele is missing.
      int allele2​(int sample)
      Returns the second allele for the specified sample or -1 if the allele is missing.
      int[] alleles()
      Returns an array of length this.size() whose j-th element is equal to this.allele(j}
      int get​(int hap)
      Returns the specified allele for the specified haplotype or -1 if the allele is missing.
      boolean isPhased()
      Returns true if every genotype for each sample is a phased, non-missing genotype, and returns false otherwise.
      boolean isPhased​(int sample)
      Returns true if the genotype for the specified sample has non-missing alleles and is either haploid or diploid with a phased allele separator, and returns false otherwise.
      Marker marker()
      Returns the marker.
      Samples samples()
      Returns the list of samples.
      int size()
      Returns the number of haplotypes.
      static BitArrayRefGTRec[] toBitArrayRefGTRecs​(EstPhase estPhase)
      Returns the current estimated phased, non-missing genotypes.
      static BitArrayRefGTRec[] toBitArrayRefGTRecs​(XRefGT gt, int nThreads)
      Returns the phased, non-missing genotypes as a BitArrayRefGTRec[] array.
      java.lang.String toString()
      Returns the data represented by this as a VCF record with a GT format field.
      • Methods inherited from class java.lang.Object

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

      • toBitArrayRefGTRecs

        public static BitArrayRefGTRec[] toBitArrayRefGTRecs​(EstPhase estPhase)
        Returns the current estimated phased, non-missing genotypes. This method converts column-major data into row-major data.
        Parameters:
        estPhase - the current estimated phased genotypes for each target sample
        Returns:
        the current estimated phased, non-missing genotypes
        Throws:
        java.lang.NullPointerException - if estPhase == null
      • toBitArrayRefGTRecs

        public static BitArrayRefGTRec[] toBitArrayRefGTRecs​(XRefGT gt,
                                                             int nThreads)
        Returns the phased, non-missing genotypes as a BitArrayRefGTRec[] array. This method converts column-major data into row-major data.
        Parameters:
        gt - the genotype data
        nThreads - the maximum number of computational threads for object construction
        Returns:
        the phased, non-missing genotypes as a BitArrayRefGTRec[] array
        Throws:
        java.lang.IllegalArgumentException - if nThreads < 1
        java.lang.NullPointerException - if gt == null
      • samples

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

        public int size()
        Description copied from interface: DuplicatesGTRec
        Returns the number of haplotypes.
        Specified by:
        size in interface DuplicatesGTRec
        Specified by:
        size in interface IntArray
        Returns:
        the number of haplotypes
      • isPhased

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

        public boolean isPhased​(int sample)
        Description copied from interface: DuplicatesGTRec
        Returns true if the genotype for the specified sample has non-missing alleles and is either haploid or diploid with a phased allele separator, and returns false otherwise.
        Specified by:
        isPhased in interface DuplicatesGTRec
        Parameters:
        sample - a sample index
        Returns:
        true if the genotype for the specified sample is a phased, nonmissing genotype
      • allele1

        public int allele1​(int sample)
        Description copied from interface: DuplicatesGTRec
        Returns the first allele for the specified sample or -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 DuplicatesGTRec
        Parameters:
        sample - a sample index
        Returns:
        the first allele for the specified sample
      • allele2

        public int allele2​(int sample)
        Description copied from interface: DuplicatesGTRec
        Returns the second allele for the specified sample or -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 DuplicatesGTRec
        Parameters:
        sample - a sample index
        Returns:
        the second allele for the specified sample
      • get

        public int get​(int hap)
        Description copied from interface: DuplicatesGTRec
        Returns the specified allele for the specified haplotype or -1 if the allele is missing. The two alleles for a sample at a marker are arbitrarily ordered if this.unphased(marker, hap/2) == false.
        Specified by:
        get in interface DuplicatesGTRec
        Specified by:
        get in interface IntArray
        Parameters:
        hap - a haplotype index
        Returns:
        the specified allele for the specified sample
      • alleles

        public int[] alleles()
        Description copied from interface: DuplicatesGTRec
        Returns an array of length this.size() whose j-th element is equal to this.allele(j}
        Specified by:
        alleles in interface DuplicatesGTRec
        Returns:
        an array of length this.size() whose j-th element is equal to this.allele(j}
      • toString

        public java.lang.String toString()
        Returns the data represented by this as a VCF record with a GT format field. The returned VCF record will have missing QUAL and INFO fields, will have "PASS" in the filter field, and will have a GT format field.
        Overrides:
        toString in class java.lang.Object
        Returns:
        the data represented by this as a VCF record with a GT format field