Package main
Interface GenotypeValues
-
public interface GenotypeValues
Interface
GenotypeValues
represents a value for each possible genotype for each sample at each marker.All instances of
GenotypeValues
are required to be thread-safe.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method 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 ofthis
.float
value(int marker, int sample, int genotype)
Returns the specified genotype value.
-
-
-
Method Detail
-
value
float value(int marker, int sample, int genotype)
Returns the specified genotype value.- Parameters:
marker
- a marker indexsample
- a sample indexgenotype
- a genotype index- Returns:
- the specified genotype value
- Throws:
java.lang.IndexOutOfBoundsException
- ifmarker < 0 || marker >= this.nMarkers()
java.lang.IndexOutOfBoundsException
- ifsample < 0 || sample >= this.nSamples()
java.lang.IndexOutOfBoundsException
- ifgenotype < 0 || genotype >= this.marker(marker).nGenotypes()
-
add
void add(int sample, double[] values)
Adds the specified genotype values to the stored genotype values for the specified sample. This method is equivalent tofor (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]) } }
- Parameters:
sample
- a sample indexvalues
- an array of lengththis.markers.sumGenotypes()
containing the genotype values to be added.- Throws:
java.lang.IndexOutOfBoundsException
- if ifsample < 0 || sample >= this.nSamples()
java.lang.IllegalArgumentException
- ifvalues.length != this.markers().sumGenotypes()
java.lang.NullPointerException
- ifvalues == null
-
add
void add(int marker, int sample, int genotype, double value)
Adds the specified genotype value to the stored genotype value.- Parameters:
marker
- a marker indexsample
- a sample indexgenotype
- a genotype indexvalue
- the value to be added- Throws:
java.lang.IndexOutOfBoundsException
- ifmarker < 0 || marker >= this.nMarkers()
java.lang.IndexOutOfBoundsException
- ifsample < 0 || sample >= this.nSamples()
java.lang.IndexOutOfBoundsException
- ifgenotype < 0 || genotype >= this.marker(marker).nGenotypes()
-
nMarkers
int nMarkers()
Returns the number of markers.- Returns:
- the number of markers
-
markers
Markers markers()
Returns the list of markers.- Returns:
- the list of markers
-
marker
Marker marker(int marker)
Returns the specified marker.- Parameters:
marker
- a marker index- Returns:
- the specified marker
- Throws:
java.lang.IndexOutOfBoundsException
- ifmarker < 0 || marker >= this.nMarkers()
-
nSamples
int nSamples()
Returns the number of samples.- Returns:
- the number of samples
-
samples
Samples samples()
Returns the list of samples.- Returns:
- the list of samples
-
toString
java.lang.String toString()
Returns a string representation ofthis
. The exact details of the representation are unspecified and subject to change.- Overrides:
toString
in classjava.lang.Object
- Returns:
- a string representation of
this
-
-