Package vcf

Interface GeneticMap

  • All Known Implementing Classes:
    PlinkGenMap, PositionMap

    public interface GeneticMap

    Interface GeneticMap represents a genetic map for one or more chromosomes.

    Instances of class GeneticMap are immutable.

    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      int basePos​(int chrom, double geneticPosition)
      Returns the base position corresponding to the specified genetic map position.
      static GeneticMap geneticMap​(java.io.File file, ChromInterval chromInt)
      Constructs and returns a genetic map from the specified data.
      double genPos​(int chrom, int basePosition)
      Returns the genetic map position of the specified genome coordinate.
      static double[] genPos​(GeneticMap genMap, double minGenDist, Markers markers)
      Returns the an array of length markers.nMarkers() whose whose j-th element is the genetic map position of the j-th marker.
      static double[] genPos​(GeneticMap genMap, Markers markers)
      Returns the an array of length markers.nMarkers() whose whose j-th element is the genetic map position of the j-th marker.
      double genPos​(Marker marker)
      Returns the genetic map position of the specified marker.
      java.lang.String toString()
      Returns a string representation of this genetic map.
    • Method Detail

      • basePos

        int basePos​(int chrom,
                    double geneticPosition)
        Returns the base position corresponding to the specified genetic map position. If the genetic position is not a map position then the base position is estimated from the nearest genetic map positions using linear interpolation.
        Parameters:
        chrom - the chromosome index
        geneticPosition - the genetic position on the chromosome
        Returns:
        the base position corresponding to the specified genetic map position
        Throws:
        java.lang.IllegalArgumentException - if the calculated base position exceeds Integer.MAX_VALUE
        java.lang.IllegalArgumentException - if this genetic map has no map positions for the specified chromosome
        java.lang.IndexOutOfBoundsException - if chrom < 0 || chrom >= ChromIds.instance().size()
      • genPos

        double genPos​(Marker marker)
        Returns the genetic map position of the specified marker. The genetic map position is estimated using linear interpolation.
        Parameters:
        marker - a genetic marker
        Returns:
        the genetic map position of the specified marker
        Throws:
        java.lang.IllegalArgumentException - if this genetic map has no map positions for the specified chromosome
        java.lang.NullPointerException - if marker == null
      • genPos

        double genPos​(int chrom,
                      int basePosition)
        Returns the genetic map position of the specified genome coordinate. The genetic map position is estimated using linear interpolation.
        Parameters:
        chrom - the chromosome index
        basePosition - the base coordinate on the chromosome
        Returns:
        the genetic map position of the specified genome coordinate
        Throws:
        java.lang.IllegalArgumentException - if this genetic map has no map positions for the specified chromosome
        java.lang.IndexOutOfBoundsException - if chrom < 0 || chrom >= ChromIds.instance().size()
      • toString

        java.lang.String toString()
        Returns a string representation of this genetic map. 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 genetic map
      • geneticMap

        static GeneticMap geneticMap​(java.io.File file,
                                     ChromInterval chromInt)
        Constructs and returns a genetic map from the specified data. If the specified map file is null, the returned genetic map will convert genome coordinates to genetic units by dividing by 1,000,000. If (chromInt != null) the genetic map will be restricted to chromosome chromInt.chrom().
        Parameters:
        file - a PLINK-format genetic map file with cM units
        chromInt - a chromosome interval
        Returns:
        a genetic map from the specified data.
        Throws:
        java.lang.IllegalArgumentException - if any map position is infinite or NaN
        java.lang.NumberFormatException - if the base position on any line of the map file is not a parsable integer
        java.lang.NumberFormatException - if the genetic map position on any line of the map file is not a parsable double
        java.lang.IllegalArgumentException - if a non-empty line of the specified genetic map file does not contain 4 fields
        java.lang.IllegalArgumentException - if the map positions on each chromosome are not sorted in ascending order
        java.lang.IllegalArgumentException - if there are duplicate base positions on a chromosome
        java.lang.IllegalArgumentException - if all base positions on a chromosome have the same genetic map position
      • genPos

        static double[] genPos​(GeneticMap genMap,
                               Markers markers)
        Returns the an array of length markers.nMarkers() whose whose j-th element is the genetic map position of the j-th marker.
        Parameters:
        genMap - the genetic map
        markers - the list of markers
        Returns:
        an array of genetic map positions
        Throws:
        java.lang.IllegalArgumentException - if markers.marker(0).chromIndex() != markers.marker(markers.nMarkers() - 1).chromIndex()
        java.lang.IllegalArgumentException - if the specified genetic map has no map positions for the specified chromosome
        java.lang.NullPointerException - if genMap == null || markers == null
      • genPos

        static double[] genPos​(GeneticMap genMap,
                               double minGenDist,
                               Markers markers)
        Returns the an array of length markers.nMarkers() whose whose j-th element is the genetic map position of the j-th marker.
        Parameters:
        genMap - the genetic map in cM units
        minGenDist - the required minimum cM distance between successive markers
        markers - the list of markers
        Returns:
        an array of genetic map positions
        Throws:
        java.lang.IllegalArgumentException - if markers.marker(0).chromIndex() != markers.marker(markers.nMarkers() - 1).chromIndex()
        java.lang.IllegalArgumentException - if the specified genetic map has no map positions for the specified chromosome
        java.lang.IllegalArgumentException - if Double.isFinite(minDist) == false
        java.lang.NullPointerException - if genMap == null || markers == null