Package vcf

Class TargetData

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, Data

    public class TargetData
    extends java.lang.Object
    implements Data

    Class TargetData represents a sliding window of target VCF records.

    Instances of class TargetData are not thread-safe.

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void advanceWindow()
      Advances the sliding window of VCF records.
      boolean canAdvanceWindow()
      Returns true if the sliding window of VCF records can advance and returns false otherwise.
      IntArray[][] carriers​(int maxCarriers)
      Returns the indices of the reference and target carriers for each low-frequency allele at the target data markers.
      void close()
      Releases any I/O resources controlled by this object.
      GeneticMap genMap()
      Returns the genetic map.
      boolean lastWindowOnChrom()
      Returns true if the current window of VCF records is the last window for the chromosome and returns false otherwise.
      MarkerIndices markerIndices()
      Return a MarkerIndices instance which stores the overlap with the current marker window and adjacent marker windows and the mappings between marker indices and target marker indices.
      int nMarkers()
      Returns the number of markers in the current window.
      int nMarkersSoFar()
      Returns the number of markers in the union of the current window and all previous windows.
      int nTargMarkersSoFar()
      Returns the number of target VCF records in the union of the current window and all previous windows.
      Pedigree ped()
      Returns the pedigree.
      java.util.Optional<RefGT> refGT()
      Returns the optional phased, nonmissing reference genotype data for the current window.
      java.util.Optional<RefGT> restrictRefGT()
      Returns the optional phased, nonmissing reference genotype data for the target data markers in the current window.
      static TargetData targetData​(Par par, java.util.function.Supplier<SampleFileIt<GTRec>> supplier)
      Constructs and returns a new TargetData instance from VcfRecords returned by the specified SampleFileIt objects.
      GT targGT()
      Returns the genotype likelihoods for the target samples restricted to the target data markers in the current window.
      java.lang.String toString()
      Returns a string representation of this.
      int windowIndex()
      Returns the current window index.
      • Methods inherited from class java.lang.Object

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

      • targetData

        public static TargetData targetData​(Par par,
                                            java.util.function.Supplier<SampleFileIt<GTRec>> supplier)
        Constructs and returns a new TargetData instance from VcfRecords returned by the specified SampleFileIt objects.
        Parameters:
        supplier - a supplier for the sample file iterator
        par - the command line parameters
        Returns:
        a new TargetData instance
        Throws:
        java.lang.IllegalArgumentException - if the data returned by the specified iterator contains no samples
        java.lang.IllegalArgumentException - if a format error is detected in a string VCF record
        java.lang.IllegalArgumentException - if overlap < 0 || Float.isFinite(overlap) == false
        java.lang.IllegalArgumentException - if window <= overlap || Float.isFinite(window) == false
        java.lang.NullPointerException - if it == null || ped == null || genMap == null
      • ped

        public Pedigree ped()
        Description copied from interface: Data
        Returns the pedigree.
        Specified by:
        ped in interface Data
        Returns:
        the pedigree
      • genMap

        public GeneticMap genMap()
        Description copied from interface: Data
        Returns the genetic map.
        Specified by:
        genMap in interface Data
        Returns:
        the genetic map
      • lastWindowOnChrom

        public boolean lastWindowOnChrom()
        Description copied from interface: Data
        Returns true if the current window of VCF records is the last window for the chromosome and returns false otherwise.
        Specified by:
        lastWindowOnChrom in interface Data
        Returns:
        true if the current window of VCF records is the last window for the chromosome
      • canAdvanceWindow

        public boolean canAdvanceWindow()
        Description copied from interface: Data
        Returns true if the sliding window of VCF records can advance and returns false otherwise.
        Specified by:
        canAdvanceWindow in interface Data
        Returns:
        true if the sliding window of VCF records can advance
      • advanceWindow

        public void advanceWindow()
        Description copied from interface: Data
        Advances the sliding window of VCF records.
        Specified by:
        advanceWindow in interface Data
      • carriers

        public IntArray[][] carriers​(int maxCarriers)
        Description copied from interface: Data

        Returns the indices of the reference and target carriers for each low-frequency allele at the target data markers. The reference sample indices will be shifted by the number of target samples so that the first reference sample will have an index equal to the number of target samples. An element of the returned array will be empty and equal to Data.ZERO_FREQ_ARRAY if the allele has no carriers, and the the element will be empty and equal to Data.HIGH_FREQ_ARRAY if the number of carriers of the allele exceeds the specified maximum number of carriers.

        The list of carriers for the k-th allele of the j-th target marker are stored in entry (j, k) of the returned array. if the number of carriers is less than or equal to the specified maximum number of carriers.

        Specified by:
        carriers in interface Data
        Parameters:
        maxCarriers - the maximum number of carriers in any list of the returned array.
        Returns:
        the indices of the reference and target carriers for each low-frequency allele
      • windowIndex

        public int windowIndex()
        Description copied from interface: Data
        Returns the current window index. The first window has index 1.
        Specified by:
        windowIndex in interface Data
        Returns:
        the current window index
      • nTargMarkersSoFar

        public int nTargMarkersSoFar()
        Description copied from interface: Data
        Returns the number of target VCF records in the union of the current window and all previous windows.
        Specified by:
        nTargMarkersSoFar in interface Data
        Returns:
        the number of target VCF records in the union of the current window and all previous windows
      • nMarkers

        public int nMarkers()
        Description copied from interface: Data
        Returns the number of markers in the current window.
        Specified by:
        nMarkers in interface Data
        Returns:
        the number of markers in the current window
      • nMarkersSoFar

        public int nMarkersSoFar()
        Description copied from interface: Data
        Returns the number of markers in the union of the current window and all previous windows.
        Specified by:
        nMarkersSoFar in interface Data
        Returns:
        the number of markers in the union of the current window and all previous windows
      • targGT

        public GT targGT()
        Description copied from interface: Data
        Returns the genotype likelihoods for the target samples restricted to the target data markers in the current window. The returned GL instance will contain no markers if this.advanceWindow() has not yet been invoked.
        Specified by:
        targGT in interface Data
        Returns:
        the genotype likelihoods for the target samples restricted to the target data markers in the current window
      • refGT

        public java.util.Optional<RefGT> refGT()
        Description copied from interface: Data
        Returns the optional phased, nonmissing reference genotype data for the current window.
        Specified by:
        refGT in interface Data
        Returns:
        the optional phased, nonmissing reference genotype data for the current window
      • restrictRefGT

        public java.util.Optional<RefGT> restrictRefGT()
        Description copied from interface: Data
        Returns the optional phased, nonmissing reference genotype data for the target data markers in the current window.
        Specified by:
        restrictRefGT in interface Data
        Returns:
        the optional phased, nonmissing reference genotype data for the target data markers in the current window
      • close

        public void close()
        Description copied from interface: Data
        Releases any I/O resources controlled by this object.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in interface Data
      • markerIndices

        public MarkerIndices markerIndices()
        Description copied from interface: Data
        Return a MarkerIndices instance which stores the overlap with the current marker window and adjacent marker windows and the mappings between marker indices and target marker indices.
        Specified by:
        markerIndices in interface Data
        Returns:
        a MarkerIndices instance
      • toString

        public java.lang.String toString()
        Returns a string representation of this. The exact details of the representation are unspecified and subject to change.
        Overrides:
        toString in class java.lang.Object
        Returns:
        a string representation of this.