public final class PlinkGeneticMap extends java.lang.Object implements GeneticMap
Class PlinkGeneticMap
represents a genetic map derived
from a PLINK map file with map positions in cM units for one or more
chromosomes.
Instances of class PlinkGeneticMap
are immutable.
Modifier and Type | Method and Description |
---|---|
int |
basePos(int chrom,
double geneticPosition)
Returns the base position corresponding to the specified genetic map
position.
|
int |
closestIndex(int chrom,
int basePosition)
Returns the index of the genetic map position that is closest to the
specified base position.
|
static PlinkGeneticMap |
fromPlinkMapFile(java.io.File mapFile)
Constructs and returns a new
PlinkGeneticMap instance from
the data in the specified file. |
static PlinkGeneticMap |
fromPlinkMapFile(java.io.File mapFile,
java.lang.String chrom)
Constructs and returns a new
PlinkGeneticMap instance from
the data in the specified file. |
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.
|
int |
index2BasePos(int chrom,
int index)
Returns the specified base position
|
double |
index2GenPos(int chrom,
int index)
Returns the specified genetic map position
|
int |
nMapPositions(int chrom)
Returns the number of mapped loci in this genetic map.
|
java.lang.String |
toString()
Returns a string representation of this genetic map.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
genPos, pRecomb
public static PlinkGeneticMap fromPlinkMapFile(java.io.File mapFile)
PlinkGeneticMap
instance from
the data in the specified file.mapFile
- a genetic map file in PLINK format with genetic map
positions in cM unitsPlinkGeneticMap
instancejava.lang.IllegalArgumentException
- if any map position is infinite
or NaN
java.lang.NullPointerException
- if mapFile == null
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 positionpublic static PlinkGeneticMap fromPlinkMapFile(java.io.File mapFile, java.lang.String chrom)
PlinkGeneticMap
instance from
the data in the specified file. The returned genetic map will contain
only positions on the specified chromosomemapFile
- a genetic map file in PLINK format with genetic map
positions in cM unitschrom
- a chromosomePlinkGeneticMap
instancejava.lang.IllegalArgumentException
- if any map position is infinite or
NaN
.java.lang.NullPointerException
- if mapFile == null || chrom == null
java.lang.NumberFormatException
- if the base position on a line of the map
file that corresponds to the specified chromosome is not a parsable
integerjava.lang.NumberFormatException
- if the genetic map position on a line
of the map file that corresponds to the specified chromosome 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 the specified
chromosome are not sorted in ascending orderjava.lang.IllegalArgumentException
- if there are duplicate base positions
on the specified chromosomejava.lang.IllegalArgumentException
- if all base positions on the
specified chromosome have the same genetic map positionjava.lang.IllegalArgumentException
- if the specified chromosome does not
have at least two distinct positions in the genetic mappublic int nMapPositions(int chrom)
chrom
- a chromosome indexjava.lang.IllegalArgumentException
- if this genetic map has no
map positions for the specified chromosomejava.lang.IndexOutOfBoundsException
- if
chrom < 0 || chrom >= ChromIds.instance().size()
public int index2BasePos(int chrom, int index)
chrom
- a chromosome indexindex
- a map position indexjava.lang.IllegalArgumentException
- if this genetic map has no
map positions for the specified chromosomejava.lang.IndexOutOfBoundsException
- if
chrom < 0 || chrom >= ChromIds.instance().size()
java.lang.IndexOutOfBoundsException
- if
index < 0 || index >= this.nMapPositions(chrom)
public double index2GenPos(int chrom, int index)
chrom
- a chromosome indexindex
- a map position indexjava.lang.IllegalArgumentException
- if this genetic map has no
map positions for the specified chromosomejava.lang.IndexOutOfBoundsException
- if
chrom < 0 || chrom >= ChromIds.instance().size()
java.lang.IndexOutOfBoundsException
- if
index < 0 || index >= this.nMapPositions(chrom)
public int closestIndex(int chrom, int basePosition)
chrom
- a chromosome indexbasePosition
- a base positionjava.lang.IllegalArgumentException
- if this genetic map has no
map positions for the specified chromosomejava.lang.IndexOutOfBoundsException
- if
chrom < 0 || chrom >= ChromIds.instance().size()
public double genPos(Marker marker)
GeneticMap
genPos
in interface GeneticMap
marker
- a genetic markerpublic double genPos(int chrom, int basePosition)
GeneticMap
genPos
in interface GeneticMap
chrom
- the chromosome indexbasePosition
- the base coordinate on the chromosomepublic int basePos(int chrom, double geneticPosition)
GeneticMap
basePos
in interface GeneticMap
chrom
- the chromosome indexgeneticPosition
- the genetic position on the chromosomepublic java.lang.String toString()
GeneticMap
toString
in interface GeneticMap
toString
in class java.lang.Object