Package vcf

Interface GTRec

All Superinterfaces:
IntArray
All Known Subinterfaces:
RefGTRec
All Known Implementing Classes:
AlleleRefGTRec, BasicGTRec, BitArrayGTRec, BitArrayRefGTRec, HapRefGTRec, IntArrayRefGTRec, LowMafDiallelicGTRec, LowMafGTRec, TwoAlleleRefGTRec, VcfRec

public interface GTRec extends IntArray

Interface GTRec represents represents genotype data for one marker.

All instances of GTRec are required to be immutable.

  • Method Summary

    Modifier and Type
    Method
    Description
    static int[]
    Returns the allele counts.
    static double[]
    Returns the allele frequencies.
    int
    get(int hap)
    Returns the specified allele for the specified haplotype or -1 if the allele is missing.
    boolean
    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.
    Returns the marker.
    Returns the list of samples.
    int
    Returns the number of haplotypes.
    static String
    toVcfRec(GTRec gtRec)
    Returns a VCF record corresponding to the specified GTRec object.
  • Method Details

    • samples

      Samples samples()
      Returns the list of samples.
      Returns:
      the list of samples
    • marker

      Marker marker()
      Returns the marker.
      Returns:
      the marker
    • get

      int get(int hap)
      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 IntArray
      Parameters:
      hap - a haplotype index
      Returns:
      the specified allele for the specified sample
      Throws:
      IndexOutOfBoundsException - if hap < 0 || hap >= this.size()
    • size

      int size()
      Returns the number of haplotypes.
      Specified by:
      size in interface IntArray
      Returns:
      the number of haplotypes
    • isPhased

      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.
      Parameters:
      sample - a sample index
      Returns:
      true if the genotype for the specified sample is a phased, nonmissing genotype
      Throws:
      IndexOutOfBoundsException - if sample < 0 || sample >= this.size()/2
    • isPhased

      boolean isPhased()
      Returns true if every genotype for each sample is a phased, non-missing genotype, and returns false otherwise.
      Returns:
      true if the genotype for each sample is a phased, non-missing genotype
    • alleleFreq

      static double[] alleleFreq(GTRec rec)
      Returns the allele frequencies. The k-th element of the returned array is the frequency of the k-th allele.
      Parameters:
      rec - the genotype data for a marker
      Returns:
      the allele frequencies
    • alleleCounts

      static int[] alleleCounts(GTRec rec)
      Returns the allele counts. The k-th element of the returned array is the count of the k-th allele.
      Parameters:
      rec - the genotype data for a marker
      Returns:
      the allele frequencies
    • toVcfRec

      static String toVcfRec(GTRec gtRec)
      Returns a VCF record corresponding to the specified GTRec object. 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.
      Parameters:
      gtRec - the genotype data
      Returns:
      a VCF record corresponding to the specified GTRec object
      Throws:
      NullPointerException - if gtRec == null