public class VcfWindow
extends java.lang.Object
implements java.io.Closeable
Class VcfWindow represents a sliding window of VCF records.
VcfWindow are not thread-safe.| Constructor and Description |
|---|
VcfWindow(SampleFileIt<? extends VcfEmission> it)
Constructs a new
VcfWindow instance. |
| Modifier and Type | Method and Description |
|---|---|
VcfEmission[] |
advanceWindow(int overlap,
int windowSize)
Advances the sliding window of VCF records, and returns the advanced
window as a
VcfEmission[] object. |
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.
|
int |
cumMarkerCnt()
Returns the number of distinct VCF records in the union of the current
window and all previous windows.
|
java.io.File |
file()
Returns the file from which VCF records are read, or returns
null if the source is standard input. |
boolean |
lastWindowOnChrom()
Returns
true if the sliding window of VCF Records is the last
window for the chromosome and returns false otherwise. |
int |
nSamples()
Returns the number of samples.
|
int |
overlap()
Returns the number of VCF records in the overlap between the current
window and the previous window.
|
Samples |
samples()
Returns the list of samples.
|
int |
size()
Returns the number of VCF records in the current window.
|
java.lang.String |
toString()
Returns a string representation of
this. |
public VcfWindow(SampleFileIt<? extends VcfEmission> it)
VcfWindow instance.it - an iterator that returns VCF recordsjava.lang.IllegalArgumentException - if it.hasNext() == falsejava.lang.IllegalArgumentException - if a format error is detected in
a VCF recordjava.lang.NullPointerException - if it == nullpublic boolean lastWindowOnChrom()
true if the sliding window of VCF Records is the last
window for the chromosome and returns false otherwise.true if the sliding window of VCF Records is the last
window for the chromosomepublic boolean canAdvanceWindow()
true if the sliding window of VCF records can advance
and returns false otherwise.true if the sliding window of VCF records can advancepublic VcfEmission[] advanceWindow(int overlap, int windowSize)
VcfEmission[] object. The size of the advanced
window and the number of markers of overlap between the marker window
immediately before method invocation and the marker window immediately
after method invocation may differ from the requested values. If the
advanced window size or overlap is less than the requested value, the
actual value will be as large as possible. If
this.lastWindowOnChrom() == true before method invocation, then
there will be no overlap between the advanced window and the previous
window.overlap - the number of markers of overlapwindowSize - the requested number of the markers in the window
immediately after the method returnsjava.lang.IllegalArgumentException - if a format error is detected in
a VCF recordjava.lang.IllegalArgumentException - if
overlap < 0 || overlap >= windowSizejava.lang.IllegalArgumentException - if overlap > this.size()
at the time of method invocationjava.lang.IllegalArgumentException - if
overlap > 0 && this.lastWindowOnChromosome() == truejava.lang.IllegalStateException - if
this.canAdvanceWindow() == falsepublic java.io.File file()
null if the source is standard input.null if the source is standard inputpublic Samples samples()
public int nSamples()
public int size()
public int overlap()
public int cumMarkerCnt()
public void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablepublic java.lang.String toString()
this. The exact
details of the representation are unspecified and subject to change.toString in class java.lang.Objectthis