Package vcf
Class RestrictedVcfWindow
- java.lang.Object
-
- vcf.RestrictedVcfWindow
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class RestrictedVcfWindow extends java.lang.Object implements java.io.Closeable
Class
RestrictedVcfWindow
represents a sliding window of VCF records.Instances of class
RestrictedVcfWindow
are not thread.safe.
-
-
Constructor Summary
Constructors Constructor Description RestrictedVcfWindow(SampleFileIt<? extends GTRec> it)
Construct a newRestrictedVcfWindow
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GTRec[]
advanceWindow(Markers nextMarkers)
Advances the sliding marker window, and returns the advanced window as aGTRec[]
object.void
close()
Releases any I/O resources controlled by this object.int
cumMarkerCnt()
Returns the number of 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 returnsnull
if the source is standard input.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.java.lang.String
toString()
Returns a string representation ofthis
.
-
-
-
Constructor Detail
-
RestrictedVcfWindow
public RestrictedVcfWindow(SampleFileIt<? extends GTRec> it)
Construct a newRestrictedVcfWindow
instance.- Parameters:
it
- an iterator that returns VCF records.- Throws:
java.lang.IllegalArgumentException
- ifit.hasNext() == false
java.lang.IllegalArgumentException
- if a format error is detected in a VCF recordjava.lang.NullPointerException
- ifit == null
-
-
Method Detail
-
advanceWindow
public GTRec[] advanceWindow(Markers nextMarkers)
Advances the sliding marker window, and returns the advanced window as aGTRec[]
object. The returned array will have lengthmarkers.nMarkers()
. Markers not found in the data source will havenull
entries in the returned array.- Parameters:
nextMarkers
- the set of markers in the advanced window- Returns:
- the advanced marker window
- Throws:
java.lang.IllegalArgumentException
- ifmarkers.nMarkers() == 0
java.lang.IllegalArgumentException
- if any two of the specified markers are on different chromosomesjava.lang.IllegalArgumentException
- if specified markers are inconsistent with a sliding marker windowjava.lang.IllegalArgumentException
- if the specified markers do not advance the current marker windowjava.lang.IllegalArgumentException
- if a format error is detected in a VCF recordjava.lang.IllegalArgumentException
- if the input data does not contain any of the specified markersjava.lang.NullPointerException
- ifnextMarkers == null
-
file
public java.io.File file()
Returns the file from which VCF records are read, or returnsnull
if the source is standard input.- Returns:
- the file from which VCF records are read, or
null
if the source is standard input
-
samples
public Samples samples()
Returns the list of samples.- Returns:
- the list of samples
-
nSamples
public int nSamples()
Returns the number of samples.- Returns:
- the number of samples
-
overlap
public int overlap()
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.- Returns:
- the number of VCF records in the overlap between the current window and the previous window
-
cumMarkerCnt
public int cumMarkerCnt()
Returns the number of VCF records in the union of the current window and all previous windows.- Returns:
- the number of VCF records in the union of the current window and all previous windows
-
close
public void close()
Releases any I/O resources controlled by this object.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
-
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
-
-