public final class Markers
extends java.lang.Object
Class Markers
represent a list of markers in chromosome order.
Instances of class Markers
are immutable.
Modifier and Type | Method and Description |
---|---|
boolean |
contains(Marker marker)
Returns
true if the specified marker is not null
and is an element in the list of markers represented by this ,
and returns false otherwise. |
static Markers |
create(Marker[] markers)
Construct and return a new
Markers instance that represents the
specified list of markers. |
boolean |
equals(java.lang.Object obj)
Returns
true if the specified object is a Markers
instance which represents the same list of markers as this ,
and returns false otherwise. |
int |
hashCode()
Returns a hash code value for the object.
|
Marker |
marker(int marker)
Returns the specified marker.
|
Marker[] |
markers()
Returns the list of markers.
|
int |
nMarkers()
Returns the number of markers.
|
Markers |
restrict(int start,
int end)
Returns a
Markers instance that represents
the specified range of marker indices. |
Markers |
reverse()
Constructs and returns a new
Markers instance that is
obtained by reversing the order of markers in this . |
int |
sumAlleles()
Returns
this.sumAlleles(this.nMarkers()) . |
int |
sumAlleles(int marker)
Returns the sum of the number of alleles for
the markers with index less than the specified index.
|
int |
sumGenotypes()
Returns
this.sumGenotypes(this.nMarkers()) . |
int |
sumGenotypes(int marker)
Returns the sum of the number of possible genotypes for the markers
with index less than the specified index.
|
int |
sumHaplotypeBits()
Returns
this.sumHaplotypeBits(this.nMarkers()) . |
int |
sumHaplotypeBits(int marker)
Returns the number of bits requires to store a haplotype for the
markers with index less than the specified index.
|
java.lang.String |
toString()
Returns a string representation of
this . |
public static Markers create(Marker[] markers)
Markers
instance that represents the
specified list of markers.markers
- a list of markers in chromosome orderMarkers
instance that represents the
specified list of markersjava.lang.IllegalArgumentException
- if markers on a chromosome are not
in chromosome orderjava.lang.IllegalArgumentException
- if there are duplicate markersjava.lang.IllegalArgumentException
- if the markers on a chromosome
do not form a contiguous set of entries within the arrayjava.lang.NullPointerException
- if
markers == null
or if markers[j] == null
for any j
satisfying (0 <= j && j < markers.length)
public int hashCode()
Arrays.deepHashCode(this.markers())
.hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
true
if the specified object is a Markers
instance which represents the same list of markers as this
,
and returns false
otherwise. Two lists of markers are
the same if the lists have the same size and if markers with the
same index in the two lists are equal.equals
in class java.lang.Object
obj
- the object to be tested for equality with this
true
if the specified object is a Markers
instance which represents the same list of markers as this
public Markers reverse()
Markers
instance that is
obtained by reversing the order of markers in this
.Markers
instance that is obtained by
reversing the order of markers in this
public int nMarkers()
public Marker marker(int marker)
marker
- a marker indexjava.lang.IndexOutOfBoundsException
- if
marker < 0 || marker >= this.nMarkers()
public Marker[] markers()
public boolean contains(Marker marker)
true
if the specified marker is not null
and is an element in the list of markers represented by this
,
and returns false
otherwise.marker
- a markertrue
if the specified marker is not null
and
is an element in the list of markers represented by this
public Markers restrict(int start, int end)
Markers
instance that represents
the specified range of marker indices.start
- the starting marker index (inclusive)end
- the ending marker index (exclusive)Markers
instance that represents
the specified range of marker indicesjava.lang.IndexOutOfBoundsException
- if
start < 0 || end > this.nMarkers()
java.lang.IllegalArgumentException
- if start >= end
.public int sumAlleles(int marker)
marker
- a marker indexjava.lang.IndexOutOfBoundsException
- if
marker < 0 || marker > this.nMarkers()
public int sumAlleles()
this.sumAlleles(this.nMarkers())
.this.sumAlleles(this.nMarkers())
public int sumGenotypes(int marker)
marker
- a marker indexjava.lang.IndexOutOfBoundsException
- if
marker < 0 || marker > this.nMarkers()
public int sumGenotypes()
this.sumGenotypes(this.nMarkers())
.this.sumGenotypes(this.nMarkers())
public int sumHaplotypeBits(int marker)
marker
- a marker indexjava.lang.IndexOutOfBoundsException
- if
marker < 0 || marker > this.nMarkers()
public int sumHaplotypeBits()
this.sumHaplotypeBits(this.nMarkers())
.this.sumHaplotypeBits(this.nMarkers())
public java.lang.String toString()
this
.
The exact details of the representation are unspecified and
subject to change.toString
in class java.lang.Object
this