Class TargetData
- java.lang.Object
-
- vcf.TargetData
-
-
Field Summary
-
Fields inherited from interface vcf.Data
HIGH_FREQ_ARRAY, ZERO_FREQ_ARRAY
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadvanceWindow()Advances the sliding window of VCF records.booleancanAdvanceWindow()Returnstrueif the sliding window of VCF records can advance and returnsfalseotherwise.IntArray[][]carriers(int maxCarriers)Returns the indices of the reference and target carriers for each low-frequency allele at the target data markers.voidclose()Releases any I/O resources controlled by this object.GeneticMapgenMap()Returns the genetic map.booleanlastWindowOnChrom()Returnstrueif the current window of VCF records is the last window for the chromosome and returnsfalseotherwise.MarkerIndicesmarkerIndices()Return aMarkerIndicesinstance which stores the overlap with the current marker window and adjacent marker windows and the mappings between marker indices and target marker indices.intnMarkers()Returns the number of markers in the current window.intnMarkersSoFar()Returns the number of markers in the union of the current window and all previous windows.intnTargMarkersSoFar()Returns the number of target VCF records in the union of the current window and all previous windows.Pedigreeped()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 TargetDatatargetData(Par par, java.util.function.Supplier<SampleFileIt<GTRec>> supplier)Constructs and returns a newTargetDatainstance from VcfRecords returned by the specifiedSampleFileItobjects.GTtargGT()Returns the genotype likelihoods for the target samples restricted to the target data markers in the current window.java.lang.StringtoString()Returns a string representation ofthis.intwindowIndex()Returns the current window index.
-
-
-
Method Detail
-
targetData
public static TargetData targetData(Par par, java.util.function.Supplier<SampleFileIt<GTRec>> supplier)
Constructs and returns a newTargetDatainstance from VcfRecords returned by the specifiedSampleFileItobjects.- Parameters:
supplier- a supplier for the sample file iteratorpar- the command line parameters- Returns:
- a new
TargetDatainstance - Throws:
java.lang.IllegalArgumentException- if the data returned by the specified iterator contains no samplesjava.lang.IllegalArgumentException- if a format error is detected in a string VCF recordjava.lang.IllegalArgumentException- ifoverlap < 0 || Float.isFinite(overlap) == falsejava.lang.IllegalArgumentException- ifwindow <= overlap || Float.isFinite(window) == falsejava.lang.NullPointerException- ifit == null || ped == null || genMap == null
-
genMap
public GeneticMap genMap()
Description copied from interface:DataReturns the genetic map.
-
lastWindowOnChrom
public boolean lastWindowOnChrom()
Description copied from interface:DataReturnstrueif the current window of VCF records is the last window for the chromosome and returnsfalseotherwise.- Specified by:
lastWindowOnChromin interfaceData- Returns:
trueif the current window of VCF records is the last window for the chromosome
-
canAdvanceWindow
public boolean canAdvanceWindow()
Description copied from interface:DataReturnstrueif the sliding window of VCF records can advance and returnsfalseotherwise.- Specified by:
canAdvanceWindowin interfaceData- Returns:
trueif the sliding window of VCF records can advance
-
advanceWindow
public void advanceWindow()
Description copied from interface:DataAdvances the sliding window of VCF records.- Specified by:
advanceWindowin interfaceData
-
carriers
public IntArray[][] carriers(int maxCarriers)
Description copied from interface:DataReturns 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_ARRAYif the allele has no carriers, and the the element will be empty and equal toData.HIGH_FREQ_ARRAYif the number of carriers of the allele exceeds the specified maximum number of carriers.The list of carriers for the
k-th allele of thej-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.
-
windowIndex
public int windowIndex()
Description copied from interface:DataReturns the current window index. The first window has index 1.- Specified by:
windowIndexin interfaceData- Returns:
- the current window index
-
nTargMarkersSoFar
public int nTargMarkersSoFar()
Description copied from interface:DataReturns the number of target VCF records in the union of the current window and all previous windows.- Specified by:
nTargMarkersSoFarin interfaceData- 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:DataReturns the number of markers in the current window.
-
nMarkersSoFar
public int nMarkersSoFar()
Description copied from interface:DataReturns the number of markers in the union of the current window and all previous windows.- Specified by:
nMarkersSoFarin interfaceData- Returns:
- the number of markers in the union of the current window and all previous windows
-
targGT
public GT targGT()
Description copied from interface:DataReturns the genotype likelihoods for the target samples restricted to the target data markers in the current window. The returnedGLinstance will contain no markers ifthis.advanceWindow()has not yet been invoked.
-
refGT
public java.util.Optional<RefGT> refGT()
Description copied from interface:DataReturns the optional phased, nonmissing reference genotype data for the current window.
-
restrictRefGT
public java.util.Optional<RefGT> restrictRefGT()
Description copied from interface:DataReturns the optional phased, nonmissing reference genotype data for the target data markers in the current window.- Specified by:
restrictRefGTin interfaceData- 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:DataReleases any I/O resources controlled by this object.
-
markerIndices
public MarkerIndices markerIndices()
Description copied from interface:DataReturn aMarkerIndicesinstance 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:
markerIndicesin interfaceData- Returns:
- a
MarkerIndicesinstance
-
toString
public java.lang.String toString()
Returns a string representation ofthis. The exact details of the representation are unspecified and subject to change.- Overrides:
toStringin classjava.lang.Object- Returns:
- a string representation of
this.
-
-