- java.lang.Object
-
- vcf.Window<E>
-
- Type Parameters:
E
- the type of elements in this window
public class Window<E extends GTRec> extends java.lang.Object
ClassWindow
represents a window of VCF recList.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addRecords(java.util.List<E> list, int start, int end)
Adds the specified records to he specified list.int
chromIndex()
Returns the chromosome index of the first maker in the window.boolean
lastWindow()
Returnstrue
if the sliding window of genotype records is the last window and returnsfalse
otherwise.boolean
lastWindowOnChrom()
Returnstrue
if the sliding window of genotype records is the last window for its chromosome and returnsfalse
otherwise.int
nMarkers()
Returns the number of markers in this window.int
overlapEnd()
Returns the index of the first marker after the overlap with the preceding marker window.int
overlapStart()
Returns the index of the first marker in the overlap with the next marker window.E
rec(int marker)
Returns the specified record.java.util.List<E>
recList()
Returns the list of recList in this window.
-
-
-
Constructor Detail
-
Window
public Window(java.util.List<E> recList, int overlapEnd, int overlapStart, boolean lastWindowOnChrom, boolean lastWindow)
Constructs a newWindow
instance from the specified data. The contract for the constructed instance is undefined if any element of the specifiedrecList
isnull
.- Parameters:
recList
- a list of marker recListoverlapEnd
- the index of the first marker after the overlap with the preceding marker windowoverlapStart
- the index of the first marker in the overlap with the next marker windowlastWindowOnChrom
-true
if the sliding window of VCF Records is the last window for its chromosomelastWindow
-true
if the sliding window of VCF Records is the last window- Throws:
java.lang.IllegalArgumentException
- ifrecList.isEmpty()
java.lang.IllegalArgumentException
- iflastWindowOnChrom && overlapStart != recList.size()
java.lang.NullPointerException
- ifrecList==null
-
-
Method Detail
-
nMarkers
public int nMarkers()
Returns the number of markers in this window.- Returns:
- the number of markers in this window
-
recList
public java.util.List<E> recList()
Returns the list of recList in this window.- Returns:
- the list of recList in this window
-
rec
public E rec(int marker)
Returns the specified record.- Parameters:
marker
- a marker index- Returns:
- the specified record
- Throws:
java.lang.IndexOutOfBoundsException
- ifindex < 0 || index >= this.nMarkers()
-
addRecords
public void addRecords(java.util.List<E> list, int start, int end)
Adds the specified records to he specified list.- Parameters:
list
- the list to be added tostart
- the start record index (inclusive)end
- the end record index (exclusive)- Throws:
java.lang.IndexOutOfBoundsException
- ifstart < 0 || end > this.nMarkers() || start > end
java.lang.NullPointerException
- iflist == null
-
overlapEnd
public int overlapEnd()
Returns the index of the first marker after the overlap with the preceding marker window. Returns 0 if the current window is the first window.- Returns:
- the index of the first marker after the overlap with the preceding marker window
-
overlapStart
public int overlapStart()
Returns the index of the first marker in the overlap with the next marker window. Returnsthis.size()
if the next marker window does not exist or is from a different chromosome.- Returns:
- the first marker index in the overlap between this marker window and the next marker window
-
chromIndex
public int chromIndex()
Returns the chromosome index of the first maker in the window.- Returns:
- the chromosome index of the first maker in the window
-
lastWindowOnChrom
public boolean lastWindowOnChrom()
Returnstrue
if the sliding window of genotype records is the last window for its chromosome and returnsfalse
otherwise.- Returns:
true
if the sliding window of genotype records is the last window for its chromosome
-
lastWindow
public boolean lastWindow()
Returnstrue
if the sliding window of genotype records is the last window and returnsfalse
otherwise.- Returns:
true
if the sliding window of genotype records is the last window
-
-