public class SampleGenotypeValues
extends java.lang.Object
Class SampleGenotypeValues
stores a value for each possible
genotype at each marker for one sample.
Class SampleGenotypeValues
is thread-safe.
Constructor and Description |
---|
SampleGenotypeValues(Markers markers,
Samples samples,
int sampleIndex)
Constructs a
SampleGenotypeValues instance for the
specified markers and sample with initial value 0 for each possible
genotype at each marker. |
Modifier and Type | Method and Description |
---|---|
void |
add(double[] values)
Adds the specified genotype values to
this . |
void |
add(int marker,
int genotype,
double value)
Adds the specified genotype value to
this . |
Marker |
marker(int marker)
Returns the specified marker.
|
Markers |
markers()
Returns the list of markers.
|
int |
nMarkers()
Returns the number of markers.
|
int |
sampleIndex()
Returns the sample index.
|
Samples |
samples()
Returns the list of samples.
|
java.lang.String |
toString()
Returns a string representation of
this . |
float |
value(int marker,
int genotype)
Returns the specified genotype value.
|
public SampleGenotypeValues(Markers markers, Samples samples, int sampleIndex)
SampleGenotypeValues
instance for the
specified markers and sample with initial value 0 for each possible
genotype at each marker.markers
- the list of markerssamples
- the list of samplessampleIndex
- a sample indexjava.lang.IllegalArgumentException
- if
sampleIndex < 0 || sampleIndex >= sampes.nSamples()
java.lang.NullPointerException
- if
markers == null || samples == null
public float value(int marker, int genotype)
marker
- a marker indexgenotype
- a genotype indexjava.lang.IndexOutOfBoundsException
- if
marker < 0 || marker >= this.nMarkers()
java.lang.IndexOutOfBoundsException
- if
genotype < 0 || genotype >= this.marker(marker).nGenotypes()
public void add(double[] values)
this
. This method is
equivalent to
for (int m=0; m<this.nMarkers(); ++m) { offset = this.markers().sumGenotypes(m); for (int gt=0; gt<this.marker(m).nGenotypes(); ++gt) { this.add(marker, gt, values[offset + gt]) } }
values
- an array with this.markers.sumGenotypes()
elements containing the genotype values to be addedjava.lang.IllegalArgumentException
- if
values.length != this.markers().sumGenotypes()
java.lang.NullPointerException
- if values == null
public void add(int marker, int genotype, double value)
this
.marker
- a marker indexgenotype
- a genotype indexvalue
- the value to be addedjava.lang.IndexOutOfBoundsException
- if
marker < 0 || marker >= this.nMarkers()
java.lang.IndexOutOfBoundsException
- if
genotype < 0 || genotype >= this.marker(marker).nGenotypes()
public Markers markers()
public Samples samples()
public int sampleIndex()
public Marker marker(int marker)
marker
- a marker indexjava.lang.IndexOutOfBoundsException
- if
marker < 0 || marker >= this.nMarkers()
public int 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