public final class BasicGenotypeValues extends java.lang.Object implements GenotypeValues
Class BasicGenotypeValues stores values for each possible
genotype for each sample at each marker.
Instances of class BasicGenotypeValues are thread-safe.
| Constructor and Description |
|---|
BasicGenotypeValues(Markers markers,
Samples samples)
Constructs a new
BasicGenotypeValues instance with initial
value 0 for each possible genotype for each sample at each marker. |
| Modifier and Type | Method and Description |
|---|---|
void |
add(int sample,
double[] values)
Adds the specified genotype values to the stored genotype values
for the specified sample.
|
void |
add(int marker,
int sample,
int genotype,
double value)
Adds the specified genotype value to the stored genotype value.
|
Marker |
marker(int marker)
Returns the specified marker.
|
Markers |
markers()
Returns the list of markers.
|
int |
nMarkers()
Returns the number of markers.
|
int |
nSamples()
Returns the number of samples.
|
Samples |
samples()
Returns the list of samples.
|
java.lang.String |
toString()
Returns a string representation of
this. |
float |
value(int marker,
int sample,
int genotype)
Returns the specified genotype value.
|
public BasicGenotypeValues(Markers markers, Samples samples)
BasicGenotypeValues instance with initial
value 0 for each possible genotype for each sample at each marker.markers - a list of markerssamples - a list of samplesjava.lang.NullPointerException - if
markers == null || samples == nullpublic float value(int marker,
int sample,
int genotype)
GenotypeValuesvalue in interface GenotypeValuesmarker - a marker indexsample - a sample indexgenotype - a genotype indexpublic void add(int sample,
double[] values)
GenotypeValues
for (m=0; m<this.nMarkers(); ++m) {
offset = this.markers().sumGenotypes(m);
for (gt=0; gt<this.marker(m).nGenotypes(); ++gt) {
this.add(marker, sample, gt, values[offset + gt])
}
}
add in interface GenotypeValuessample - a sample indexvalues - an array of length this.markers.sumGenotypes()
containing the genotype values to be added.public void add(int marker,
int sample,
int genotype,
double value)
GenotypeValuesadd in interface GenotypeValuesmarker - a marker indexsample - a sample indexgenotype - a genotype indexvalue - the value to be addedpublic Samples samples()
GenotypeValuessamples in interface GenotypeValuespublic int nSamples()
GenotypeValuesnSamples in interface GenotypeValuespublic Marker marker(int marker)
GenotypeValuesmarker in interface GenotypeValuesmarker - a marker indexpublic Markers markers()
GenotypeValuesmarkers in interface GenotypeValuespublic int nMarkers()
GenotypeValuesnMarkers in interface GenotypeValuespublic java.lang.String toString()
GenotypeValuesthis. The exact details
of the representation are unspecified and subject to change.toString in interface GenotypeValuestoString in class java.lang.Objectthis