Package vcf
Class AllData
- java.lang.Object
-
- vcf.AllData
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
advanceWindowCm()
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.Samples
allSamples()
Returns a list of all target and reference samples.boolean
canAdvanceWindow()
Returnstrue
if the sliding window of VCF records can advance and returnsfalse
otherwise.void
close()
Releases any I/O resources controlled by this object.GeneticMap
genMap()
Returns the genetic map.boolean
lastWindowOnChrom()
Returnstrue
if the current window of VCF records is the last window for the chromosome and returnsfalse
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, ornull
if there are no reference datajava.util.List<HapPair>
refHapPairs()
Returns a list of the reference haplotype pairs for the current window.Samples
refSamples()
Returns the list of reference samples, ornull
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.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 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
-
advanceWindowCm
public void advanceWindowCm()
Description copied from interface:Data
Advances the sliding window of VCF records.- Specified by:
advanceWindowCm
in interfaceData
-
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
-
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 interfaceData
- 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.
-
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. Returnsthis.nMarkers()
if the next marker window is from a different chromosome.- Specified by:
nextOverlapStart
in interfaceData
- 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 interfaceData
- 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 interfaceData
- 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 interfaceData
- 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.
-
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
-
markers
public Markers markers()
Description copied from 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 interfaceData
- 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 interfaceData
- 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 interfaceData
- 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 interfaceData
- 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 interfaceData
- Returns:
- the number of reference samples
-
refSamples
public Samples refSamples()
Description copied from interface:Data
Returns the list of reference samples, ornull
if there are no reference samples.- Specified by:
refSamples
in interfaceData
- 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 interfaceData
- 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 bythis.targetSamples()
. Reference samples are listed last in the same order as the list returned bythis.refSamples()
.- Specified by:
allSamples
in interfaceData
- 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 returnedGL
instance will contain no markers ifthis.advanceWindow()
has not yet been invoked.
-
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 ifthis.advanceWindow()
has not yet been invoked.- Specified by:
restrictedRefHapPairs
in interfaceData
- 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 ifthis.advanceWindow()
has not yet been invoked.- Specified by:
refHapPairs
in interfaceData
- 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, ornull
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. Returnsnull
if there are no reference data- Specified by:
restrictRefGT
in interfaceData
- 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.
-
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
-
-