- 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.ObjectClass
Windowrepresents a window of VCF records.Instances of class [@code Window} are immutable.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddRecords(java.util.List<E> list, int start, int end)Adds the specified records to he specified list.intchromIndex()Returns the chromosome index of the first maker in the window.booleanlastWindow()Returnstrueif the sliding window of genotype records is the last window and returnsfalseotherwise.booleanlastWindowOnChrom()Returnstrueif the sliding window of genotype records is the last window for its chromosome and returnsfalseotherwise.intnextOverlap()Returns the index of the first marker in the overlap with the next marker window.intnMarkers()Returns the number of markers in this window.intprevOverlap()Returns the index of the first marker after the overlap with the preceding marker window.Erec(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 newWindowinstance from the specified data. The contract for the constructed instance is undefined if any element of the specifiedrecListisnull.- 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-trueif the sliding window of VCF Records is the last window for its chromosomelastWindow-trueif 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 > endjava.lang.NullPointerException- iflist == null
-
prevOverlap
public int prevOverlap()
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
-
nextOverlap
public int nextOverlap()
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()
Returnstrueif the sliding window of genotype records is the last window for its chromosome and returnsfalseotherwise.- Returns:
trueif the sliding window of genotype records is the last window for its chromosome
-
lastWindow
public boolean lastWindow()
Returnstrueif the sliding window of genotype records is the last window and returnsfalseotherwise.- Returns:
trueif the sliding window of genotype records is the last window
-
-