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

    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(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.
    Returns a string representation of this genetic map.
  • Method Details

    • 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:
      IllegalArgumentException - if the calculated base position exceeds Integer.MAX_VALUE
      IllegalArgumentException - if this genetic map has no map positions for the specified chromosome
      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:
      IllegalArgumentException - if this genetic map has no map positions for the specified chromosome
      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:
      IllegalArgumentException - if this genetic map has no map positions for the specified chromosome
      IndexOutOfBoundsException - if chrom < 0 || chrom >= ChromIds.instance().size()
    • toString

      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 Object
      Returns:
      a string representation of this genetic map
    • geneticMap

      static GeneticMap geneticMap(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:
      IllegalArgumentException - if any map position is infinite or NaN
      NumberFormatException - if the base position on any line of the map file is not a parsable integer
      NumberFormatException - if the genetic map position on any line of the map file is not a parsable double
      IllegalArgumentException - if a non-empty line of the specified genetic map file does not contain 4 fields
      IllegalArgumentException - if the map positions on each chromosome are not sorted in ascending order
      IllegalArgumentException - if there are duplicate base positions on a chromosome
      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:
      IllegalArgumentException - if markers.marker(0).chromIndex() != markers.marker(markers.nMarkers() - 1).chromIndex()
      IllegalArgumentException - if the specified genetic map has no map positions for the specified chromosome
      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:
      IllegalArgumentException - if markers.marker(0).chromIndex() != markers.marker(markers.nMarkers() - 1).chromIndex()
      IllegalArgumentException - if the specified genetic map has no map positions for the specified chromosome
      IllegalArgumentException - if Double.isFinite(minDist) == false
      NullPointerException - if genMap == null || markers == null