Package vcf
Interface GeneticMap
-
- All Known Implementing Classes:
MarkerMap
,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 Default 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.double
genPos(Marker marker)
Returns the genetic map position of the specified marker.default double[]
genPos(Markers markers)
Returns the an array of lengthhapPairs.nMarkers()
whose whosej
-th element is the genetic map position of thej
-th marker.default float[]
pRecomb(Markers markers, double intensity)
Returns the an array of lengthhapPairs.nMarkers()
whose whosej
-th element forj > 0
is the probability of recombination between markerj - 1
and markerj
.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 indexgeneticPosition
- 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 exceedsInteger.MAX_VALUE
java.lang.IllegalArgumentException
- if this genetic map has no map positions for the specified chromosomejava.lang.IndexOutOfBoundsException
- ifchrom < 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 chromosomejava.lang.NullPointerException
- 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:
java.lang.IllegalArgumentException
- if this genetic map has no map positions for the specified chromosomejava.lang.IndexOutOfBoundsException
- ifchrom < 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 classjava.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 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:
java.lang.IllegalArgumentException
- if any map position is infinite orNaN
java.lang.NumberFormatException
- if the base position on any line of the map file is not a parsable integerjava.lang.NumberFormatException
- if the genetic map position on any line of the map file is not a parsable doublejava.lang.IllegalArgumentException
- if a non-empty line of the specified genetic map file does not contain 4 fieldsjava.lang.IllegalArgumentException
- if the map positions on each chromosome are not sorted in ascending orderjava.lang.IllegalArgumentException
- if there are duplicate base positions on a chromosomejava.lang.IllegalArgumentException
- if all base positions on a chromosome have the same genetic map position
-
genPos
default double[] genPos(Markers markers)
Returns the an array of lengthhapPairs.nMarkers()
whose whosej
-th element is the genetic map position of thej
-th marker.- Parameters:
markers
- the list of markers- Returns:
- an array of genetic map positions
- Throws:
java.lang.IllegalArgumentException
- if this genetic map does not contain a map position for any specified markerjava.lang.NullPointerException
- ifmarkers == null
-
pRecomb
default float[] pRecomb(Markers markers, double intensity)
Returns the an array of lengthhapPairs.nMarkers()
whose whosej
-th element forj > 0
is the probability of recombination between markerj - 1
and markerj
. The initial marker on a chromosome has recombination probability 0. Any inter-marker genetic distances less than1e-7
cM are increased to1e-7
cM.- Parameters:
markers
- the list of markersintensity
- the reciprocal of the expected length of the longest IBD segment at a locus- Returns:
- an array of inter-marker recombination probabilities
- Throws:
java.lang.IllegalArgumentException
- ifintensity <= 0.0 || Double.isFinite(intensity)==false
java.lang.IllegalArgumentException
- if this genetic map does not contain a map position for any specified markerjava.lang.NullPointerException
- ifmarkers == null
-
-