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 of this.
      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 index
        sample - a sample index
        genotype - a genotype index
        Returns:
        the specified genotype value
        Throws:
        java.lang.IndexOutOfBoundsException - if marker < 0 || marker >= this.nMarkers()
        java.lang.IndexOutOfBoundsException - if sample < 0 || sample >= this.nSamples()
        java.lang.IndexOutOfBoundsException - if genotype < 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 to
         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])
             }
         }
         
        Parameters:
        sample - a sample index
        values - an array of length this.markers.sumGenotypes() containing the genotype values to be added.
        Throws:
        java.lang.IndexOutOfBoundsException - if if sample < 0 || sample >= this.nSamples()
        java.lang.IllegalArgumentException - if values.length != this.markers().sumGenotypes()
        java.lang.NullPointerException - if values == 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 index
        sample - a sample index
        genotype - a genotype index
        value - the value to be added
        Throws:
        java.lang.IndexOutOfBoundsException - if marker < 0 || marker >= this.nMarkers()
        java.lang.IndexOutOfBoundsException - if sample < 0 || sample >= this.nSamples()
        java.lang.IndexOutOfBoundsException - if genotype < 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 - if marker < 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 of this. The exact details of the representation are unspecified and subject to change.
        Overrides:
        toString in class java.lang.Object
        Returns:
        a string representation of this