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 advanceWindowCm()
      Advances the sliding window of VCF records.
      Samples allSamples()
      Returns a list of all target and reference samples.
      boolean canAdvanceWindow()
      Returns true if the sliding window of VCF records can advance and returns false otherwise.
      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.
      int markerIndex​(int nonRefIndex)
      Returns the marker index corresponding to the specified target data marker.
      Markers markers()
      Returns the list of markers in the current window.
      int nAllSamples()
      Returns the total number of reference and target samples.
      int nextOverlapStart()
      Returns the first marker index in the overlap between this marker window and the next marker window.
      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 nRefSamples()
      Returns the number of reference samples.
      int nTargetMarkers()
      Returns the number of target data markers in the current window.
      int nTargetMarkersSoFar()
      Returns the number of target VCF records in the union of the current window and all previous windows.
      int nTargetSamples()
      Returns the number of target samples.
      int overlap()
      Returns the number of VCF records in the overlap between the current window and the previous window.
      Pedigree ped()
      Returns the pedigree.
      RefGT refGT()
      Returns the phased, nonmissing reference genotype data for the current window, or null if there are no reference data
      java.util.List<HapPair> refHapPairs()
      Returns a list of the reference haplotype pairs for the current window.
      Samples refSamples()
      Returns the list of reference samples, or null if there are no reference samples.
      java.util.List<HapPair> restrictedRefHapPairs()
      Returns a list of reference haplotype pairs that are restricted to the target data markers in the current window.
      RefGT restrictRefGT()
      Returns the 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.
      int targetMarkerIndex​(int refIndex)
      Returns the target data marker index corresponding to the specified marker, or returns -1 if no corresponding target data marker exists.
      Markers targetMarkers()
      Returns the list of target data markers in the current window.
      int targetOverlap()
      Returns the number of target data markers in the overlap between the current marker window and the previous marker window.
      Samples targetSamples()
      Returns the list of target samples.
      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
      • advanceWindowCm

        public void advanceWindowCm()
        Description copied from interface: Data
        Advances the sliding window of VCF records.
        Specified by:
        advanceWindowCm in interface Data
      • 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
      • targetOverlap

        public int targetOverlap()
        Description copied from interface: Data
        Returns the number of target data markers in the overlap between the current marker window and the previous marker window. Returns 0 if the current marker window is the first marker window.
        Specified by:
        targetOverlap in interface Data
        Returns:
        the number of target data markers in the overlap between the current marker window and the previous marker window
      • overlap

        public int overlap()
        Description copied from interface: Data
        Returns the number of VCF records in the overlap between the current window and the previous window. Returns 0 if the current window is the first window.
        Specified by:
        overlap in interface Data
        Returns:
        the number of VCF records in the overlap between the current window and the previous window
      • nextOverlapStart

        public int nextOverlapStart()
        Description copied from interface: Data
        Returns the first marker index in the overlap between this marker window and the next marker window. Returns this.nMarkers() if the next marker window is from a different chromosome.
        Specified by:
        nextOverlapStart in interface Data
        Returns:
        the first marker index in the overlap between this marker window and the next marker window
      • nTargetMarkers

        public int nTargetMarkers()
        Description copied from interface: Data
        Returns the number of target data markers in the current window.
        Specified by:
        nTargetMarkers in interface Data
        Returns:
        the number of target data markers in the current window
      • nTargetMarkersSoFar

        public int nTargetMarkersSoFar()
        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:
        nTargetMarkersSoFar in interface Data
        Returns:
        the number of target VCF records in the union of the current window and all previous windows
      • targetMarkers

        public Markers targetMarkers()
        Description copied from interface: Data
        Returns the list of target data markers in the current window.
        Specified by:
        targetMarkers in interface Data
        Returns:
        the list of target data markers in the current window
      • 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
      • markers

        public Markers markers()
        Description copied from interface: Data
        Returns the list of markers in the current window.
        Specified by:
        markers in interface Data
        Returns:
        the list of markers in the current window
      • targetMarkerIndex

        public int targetMarkerIndex​(int refIndex)
        Description copied from interface: Data
        Returns the target data marker index corresponding to the specified marker, or returns -1 if no corresponding target data marker exists. Indices are with respect to the current window.
        Specified by:
        targetMarkerIndex in interface Data
        Parameters:
        refIndex - a marker index
        Returns:
        the target data marker index corresponding to the specified marker, or returns -1 if no corresponding target data marker exists
      • markerIndex

        public int markerIndex​(int nonRefIndex)
        Description copied from interface: Data
        Returns the marker index corresponding to the specified target data marker. Indices are with respect to the current window.
        Specified by:
        markerIndex in interface Data
        Parameters:
        nonRefIndex - a target data marker index
        Returns:
        the marker index corresponding to the specified target data marker
      • nTargetSamples

        public int nTargetSamples()
        Description copied from interface: Data
        Returns the number of target samples.
        Specified by:
        nTargetSamples in interface Data
        Returns:
        the number of target samples
      • targetSamples

        public Samples targetSamples()
        Description copied from interface: Data
        Returns the list of target samples.
        Specified by:
        targetSamples in interface Data
        Returns:
        the list of target samples
      • nRefSamples

        public int nRefSamples()
        Description copied from interface: Data
        Returns the number of reference samples.
        Specified by:
        nRefSamples in interface Data
        Returns:
        the number of reference samples
      • refSamples

        public Samples refSamples()
        Description copied from interface: Data
        Returns the list of reference samples, or null if there are no reference samples.
        Specified by:
        refSamples in interface Data
        Returns:
        the list of reference samples, or null if there are no reference samples
      • nAllSamples

        public int nAllSamples()
        Description copied from interface: Data
        Returns the total number of reference and target samples.
        Specified by:
        nAllSamples in interface Data
        Returns:
        the total number of reference and target samples
      • allSamples

        public Samples allSamples()
        Description copied from interface: Data
        Returns a list of all target and reference samples. Target samples are listed first in the same order as the list returned by this.targetSamples(). Reference samples are listed last in the same order as the list returned by this.refSamples().
        Specified by:
        allSamples in interface Data
        Returns:
        a list of all target and reference samples
      • 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
      • restrictedRefHapPairs

        public java.util.List<HapPair> restrictedRefHapPairs()
        Description copied from interface: Data
        Returns a list of reference haplotype pairs that are restricted to the target data markers in the current window. The returned list will be empty if there are no reference samples or if this.advanceWindow() has not yet been invoked.
        Specified by:
        restrictedRefHapPairs in interface Data
        Returns:
        a list of reference haplotype pairs that are restricted to the target data markers
      • refHapPairs

        public java.util.List<HapPair> refHapPairs()
        Description copied from interface: Data
        Returns a list of the reference haplotype pairs for the current window. The returned list will be empty if there are no reference samples or if this.advanceWindow() has not yet been invoked.
        Specified by:
        refHapPairs in interface Data
        Returns:
        a list of the reference haplotype pairs
      • refGT

        public RefGT refGT()
        Description copied from interface: Data
        Returns the phased, nonmissing reference genotype data for the current window, or null if there are no reference data
        Specified by:
        refGT in interface Data
        Returns:
        the reference genotype data for the current window or null if there are no reference data
      • restrictRefGT

        public RefGT restrictRefGT()
        Description copied from interface: Data
        Returns the phased, nonmissing reference genotype data for the target data markers in the current window. Returns null if there are no reference data
        Specified by:
        restrictRefGT in interface Data
        Returns:
        the reference genotype data for the target data markers in the current window or null if there are no reference data
      • 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
      • 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.