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 == null
public float value(int marker, int sample, int genotype)
GenotypeValues
value
in interface GenotypeValues
marker
- 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 GenotypeValues
sample
- 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)
GenotypeValues
add
in interface GenotypeValues
marker
- a marker indexsample
- a sample indexgenotype
- a genotype indexvalue
- the value to be addedpublic Samples samples()
GenotypeValues
samples
in interface GenotypeValues
public int nSamples()
GenotypeValues
nSamples
in interface GenotypeValues
public Marker marker(int marker)
GenotypeValues
marker
in interface GenotypeValues
marker
- a marker indexpublic Markers markers()
GenotypeValues
markers
in interface GenotypeValues
public int nMarkers()
GenotypeValues
nMarkers
in interface GenotypeValues
public java.lang.String toString()
GenotypeValues
this
. The exact details
of the representation are unspecified and subject to change.toString
in interface GenotypeValues
toString
in class java.lang.Object
this