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 TypeMethodDescriptionint
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 lengthmarkers.nMarkers()
whose whosej
-th element is the genetic map position of thej
-th marker.static double[]
genPos
(GeneticMap genMap, Markers markers) Returns the an array of lengthmarkers.nMarkers()
whose whosej
-th element is the genetic map position of thej
-th marker.double
Returns the genetic map position of the specified marker.toString()
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 indexgeneticPosition
- the genetic position on the chromosome- Returns:
- the base position corresponding to the specified genetic map position
- Throws:
IllegalArgumentException
- if the calculated base position exceedsInteger.MAX_VALUE
IllegalArgumentException
- if this genetic map has no map positions for the specified chromosomeIndexOutOfBoundsException
- ifchrom < 0 || chrom >= ChromIds.instance().size()
-
genPos
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 chromosomeNullPointerException
- ifmarker == 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 indexbasePosition
- 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 chromosomeIndexOutOfBoundsException
- ifchrom < 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. -
geneticMap
Constructs and returns a genetic map from the specified data. If the specified map file isnull
, 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 chromosomechromInt.chrom()
.- Parameters:
file
- a PLINK-format genetic map file with cM unitschromInt
- a chromosome interval- Returns:
- a genetic map from the specified data.
- Throws:
IllegalArgumentException
- if any map position is infinite orNaN
NumberFormatException
- if the base position on any line of the map file is not a parsable integerNumberFormatException
- if the genetic map position on any line of the map file is not a parsable doubleIllegalArgumentException
- if a non-empty line of the specified genetic map file does not contain 4 fieldsIllegalArgumentException
- if the map positions on each chromosome are not sorted in ascending orderIllegalArgumentException
- if there are duplicate base positions on a chromosomeIllegalArgumentException
- if all base positions on a chromosome have the same genetic map position
-
genPos
Returns the an array of lengthmarkers.nMarkers()
whose whosej
-th element is the genetic map position of thej
-th marker.- Parameters:
genMap
- the genetic mapmarkers
- the list of markers- Returns:
- an array of genetic map positions
- Throws:
IllegalArgumentException
- ifmarkers.marker(0).chromIndex() != markers.marker(markers.nMarkers() - 1).chromIndex()
IllegalArgumentException
- if the specified genetic map has no map positions for the specified chromosomeNullPointerException
- ifgenMap == null || markers == null
-
genPos
Returns the an array of lengthmarkers.nMarkers()
whose whosej
-th element is the genetic map position of thej
-th marker.- Parameters:
genMap
- the genetic map in cM unitsminGenDist
- the required minimum cM distance between successive markersmarkers
- the list of markers- Returns:
- an array of genetic map positions
- Throws:
IllegalArgumentException
- ifmarkers.marker(0).chromIndex() != markers.marker(markers.nMarkers() - 1).chromIndex()
IllegalArgumentException
- if the specified genetic map has no map positions for the specified chromosomeIllegalArgumentException
- ifDouble.isFinite(minDist) == false
NullPointerException
- ifgenMap == null || markers == null
-