Class AllData
- java.lang.Object
-
- vcf.AllData
-
-
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 void
advanceWindow()
Advances the sliding window of VCF records.static AllData
allData(java.util.function.Supplier<SampleFileIt<RefGTRec>> supplier, SampleFileIt<GTRec> targIt, Par par)
Constructs and returns a newAllData
instance from VCF recList returned by the specifiedSampleFileIt
objects.boolean
canAdvanceWindow()
Returnstrue
if the sliding window of VCF records can advance and returnsfalse
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.static boolean[]
inTarg(GTRec[] recs)
boolean
lastWindowOnChrom()
Returnstrue
if the current window of VCF records is the last window for the chromosome and returnsfalse
otherwise.MarkerIndices
markerIndices()
Return aMarkerIndices
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.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 ofthis
.int
windowIndex()
Returns the current window index.
-
-
-
Method Detail
-
allData
public static AllData allData(java.util.function.Supplier<SampleFileIt<RefGTRec>> supplier, SampleFileIt<GTRec> targIt, Par par)
Constructs and returns a newAllData
instance from VCF recList returned by the specifiedSampleFileIt
objects.- Parameters:
supplier
- an object to supply the reference file iteratortargIt
- an iterator that returns target VCF recListpar
- the command line parameters- Returns:
- a new
AllData
instance - Throws:
java.lang.IllegalArgumentException
- if either the reference data or target data contain no samplesjava.lang.IllegalArgumentException
- if a format error is detected in a string VCF recordjava.lang.IllegalArgumentException
- ifoverlap < 0 || Float.isFinite(overlap) == false
java.lang.IllegalArgumentException
- ifwindow <= overlap || Float.isFinite(window) == false
java.lang.NullPointerException
- ifrefIt == null || targetIt == null || genMap == null
-
genMap
public GeneticMap genMap()
Description copied from interface:Data
Returns the genetic map.
-
lastWindowOnChrom
public boolean lastWindowOnChrom()
Description copied from interface:Data
Returnstrue
if the current window of VCF records is the last window for the chromosome and returnsfalse
otherwise.- Specified by:
lastWindowOnChrom
in interfaceData
- 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
Returnstrue
if the sliding window of VCF records can advance and returnsfalse
otherwise.- Specified by:
canAdvanceWindow
in interfaceData
- 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 interfaceData
-
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 toData.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 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:Data
Returns the current window index. The first window has index 1.- Specified by:
windowIndex
in interfaceData
- Returns:
- the current window index
-
inTarg
public static boolean[] inTarg(GTRec[] recs)
-
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 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: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 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:Data
Returns the genotype likelihoods for the target samples restricted to the target data markers in the current window. The returnedGL
instance will contain no markers ifthis.advanceWindow()
has not yet been invoked.
-
refGT
public java.util.Optional<RefGT> refGT()
Description copied from 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 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:Data
Releases any I/O resources controlled by this object.
-
markerIndices
public MarkerIndices markerIndices()
Description copied from interface:Data
Return aMarkerIndices
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 interfaceData
- Returns:
- a
MarkerIndices
instance
-
toString
public java.lang.String toString()
Returns a string representation ofthis
. The exact details of the representation are unspecified and subject to change.- Overrides:
toString
in classjava.lang.Object
- Returns:
- a string representation of
this
-
-