Package imp
Class ImpData
- java.lang.Object
-
- imp.ImpData
-
public class ImpData extends java.lang.Object
Class
ImpData
contains the input data for imputation of ungenotyped markers.Instances of class
ImpData
are immutable.
-
-
Constructor Summary
Constructors Constructor Description ImpData(Par par, Window window, GT phasedTarg, GeneticMap map)
Constructs a newImpData
instance from the specified data.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
allele(int cluster, int hap)
Returns the specified target marker cluter alleles for the reference and target haplotypes.float
errProb(int cluster)
Returns the probability that the allele carried by the specified target marker cluster matches the allele labeling the latent HMM state.IndexArray
hapToSeq(int cluster)
Returns the specified target marker cluster alleles for the reference and target haplotypes.MarkerIndices
markerIndices()
int
nClusters()
Return the number of target marker clusters.int
nHaps()
Return the total number of reference and target haplotypes.int
nInputTargHaps()
Return the number of input target haplotypes.int
nRefHaps()
Return the number of reference haplotypes.int
nTargHaps()
Return the number of target haplotypes.int
nTargSamples()
Returns the number of target samples.Par
par()
Returns the command line parametersdouble[]
pos()
Return an array of sizethis.nClusters()
containing the the genetic map positions of the target marker clusters.double
pos(int cluster)
Return the genetic map position of the specified target marker cluster.float
pRecomb(int cluster)
Return the probability of recombination between the specified target marker cluster and the previous target marker cluster.int
refClusterEnd(int cluster)
Returns the index of the reference marker corresponding to the end (exclusive) of the specified target marker cluster.int
refClusterStart(int cluster)
Returns the index of the reference marker corresponding to the start (inclusive) of the specified target marker cluster.RefGT
refGT()
Return the reference genotype dataint
targClusterEnd(int cluster)
Returns the target marker index corresponding to the end (exclusive) of the specified marker cluster.int
targClusterStart(int cluster)
Returns the target marker index corresponding to the start (inclusive) of the specified marker cluster.GT
targGT()
Return the phased target genotype data.Samples
targSamples()
Returns the list of target samples.double
weight(int refMarker)
Return the weight for the HMM state probability at the preceding target marker cluster when estimating the HMM state probability at the specified reference marker via linear interpolation of HMM state probabilities at the preceding and succeeding target marker clusters.
-
-
-
Constructor Detail
-
ImpData
public ImpData(Par par, Window window, GT phasedTarg, GeneticMap map)
Constructs a newImpData
instance from the specified data.- Parameters:
par
- the analysis parameterswindow
- the input data for the current marker windowphasedTarg
- the phased target genotypesmap
- the genetic map- Throws:
java.lang.IllegalArgumentException
- ifwindow.targGT().markers().equals(phasedTarg.markers() == false
java.lang.IllegalArgumentException
- ifwindow.targGT().samples().equals(phasedTarg.samples()) == false
java.lang.IllegalArgumentException
- ifphasedTarg.isPhased() == false
java.util.NoSuchElementException
- ifwindow.refGT().isPresent() == false
java.lang.NullPointerException
- if any parameter isnull
-
-
Method Detail
-
par
public Par par()
Returns the command line parameters- Returns:
- the command line parameters
-
markerIndices
public MarkerIndices markerIndices()
-
refGT
public RefGT refGT()
Return the reference genotype data- Returns:
- the reference genotype data
-
targGT
public GT targGT()
Return the phased target genotype data. TheisPhased()
method of the returned object returnstrue
.- Returns:
- the phased target genotype data
-
targClusterStart
public int targClusterStart(int cluster)
Returns the target marker index corresponding to the start (inclusive) of the specified marker cluster.- Parameters:
cluster
- index of a target marker cluster- Returns:
- the target marker index corresponding to the start (inclusive) of the specified marker cluster
- Throws:
java.lang.IndexOutOfBoundsException
- ifcluster < 0 || cluster >= this.nClusters()
-
targClusterEnd
public int targClusterEnd(int cluster)
Returns the target marker index corresponding to the end (exclusive) of the specified marker cluster.- Parameters:
cluster
- index of a target marker cluster- Returns:
- the target marker index corresponding to the end (exclusive) of the specified marker cluster
- Throws:
java.lang.IndexOutOfBoundsException
- ifcluster < 0 || cluster >= this.nClusters()
-
refClusterStart
public int refClusterStart(int cluster)
Returns the index of the reference marker corresponding to the start (inclusive) of the specified target marker cluster.- Parameters:
cluster
- index of a target marker cluster- Returns:
- the index of the reference marker corresponding to the start (inclusive) of the specified target marker cluster
- Throws:
java.lang.IndexOutOfBoundsException
- ifcluster < 0 || cluster >= this.nClusters()
-
refClusterEnd
public int refClusterEnd(int cluster)
Returns the index of the reference marker corresponding to the end (exclusive) of the specified target marker cluster.- Parameters:
cluster
- index of a target marker cluster- Returns:
- the index of the reference marker corresponding to the end (exclusive) of the specified target marker cluster
- Throws:
java.lang.IndexOutOfBoundsException
- ifcluster < 0 || cluster >= this.nClusters()
-
nClusters
public int nClusters()
Return the number of target marker clusters.- Returns:
- the number of target marker clusters
-
targSamples
public Samples targSamples()
Returns the list of target samples.- Returns:
- the list of target samples
-
nTargSamples
public int nTargSamples()
Returns the number of target samples.- Returns:
- the number of target samples
-
nHaps
public int nHaps()
Return the total number of reference and target haplotypes.- Returns:
- the total number of reference and target haplotypes
-
nRefHaps
public int nRefHaps()
Return the number of reference haplotypes.- Returns:
- the number of reference haplotypes
-
nTargHaps
public int nTargHaps()
Return the number of target haplotypes.- Returns:
- the number of target haplotypes
-
nInputTargHaps
public int nInputTargHaps()
Return the number of input target haplotypes. Each sample with haploid input data contributes only one haplotype to the total.- Returns:
- the number of input target haplotypes
-
allele
public int allele(int cluster, int hap)
Returns the specified target marker cluter alleles for the reference and target haplotypes. Alleles for the reference haplotypes precede alleles for the target haplotypes. If(this.nRefHaps() <= hap && hap < this.nHaps())
then(this.allele(marker, hap) == this.targAllele(marker, hap - this.nRefHaps())
- Parameters:
cluster
- index of a target marker clusterhap
- a haplotype index- Returns:
- the specified target marker cluster allele for the specified haplotype
- Throws:
java.lang.IndexOutOfBoundsException
- ifcluster < 0 || cluster >= this.nClusters()
java.lang.IndexOutOfBoundsException
- ifhaplotype < 0 || haplotype >= this.nHaps()
-
hapToSeq
public IndexArray hapToSeq(int cluster)
Returns the specified target marker cluster alleles for the reference and target haplotypes. Alleles for the reference haplotypes precede alleles for the target haplotypes. The returned value will satisfy(this.hapToSeq(cluster).get(hap)==this.allele(cluster, hap))
for anycluster
andhap
satisfying(0 <= cluster && cluster < this.nClusters())
and(0 <= hap && hap < this.nHaps())
- Parameters:
cluster
- index of a target marker cluster- Returns:
- the specified target marker cluster alleles for the reference and target haplotypes
- Throws:
java.lang.IndexOutOfBoundsException
- ifcluster < 0 || cluster >= this.nClusters()
-
errProb
public float errProb(int cluster)
Returns the probability that the allele carried by the specified target marker cluster matches the allele labeling the latent HMM state.- Parameters:
cluster
- index of a target marker cluster- Returns:
- the probability that the allele carried by the specified target marker cluster matches the allele labeling the latent HMM state.
- Throws:
java.lang.IndexOutOfBoundsException
- ifcluster < 0 || cluster >= this.nClusters()
-
pos
public double pos(int cluster)
Return the genetic map position of the specified target marker cluster.- Parameters:
cluster
- index of a target marker cluster- Returns:
- the genetic map position of the specified target marker cluster
- Throws:
java.lang.IllegalArgumentException
- ifcluster < 0 || marker >= this.nClusters()
-
pos
public double[] pos()
Return an array of sizethis.nClusters()
containing the the genetic map positions of the target marker clusters.- Returns:
- the genetic map positions of the target marker clusters
-
pRecomb
public float pRecomb(int cluster)
Return the probability of recombination between the specified target marker cluster and the previous target marker cluster. Returns0
if(cluster == 0)
.- Parameters:
cluster
- index of a target marker cluster- Returns:
- the probability of recombination between the specified target marker cluster and the previous target marker cluster
- Throws:
java.lang.IllegalArgumentException
- ifcluster < 0 || cluster >= this.nClusters()
-
weight
public double weight(int refMarker)
Return the weight for the HMM state probability at the preceding target marker cluster when estimating the HMM state probability at the specified reference marker via linear interpolation of HMM state probabilities at the preceding and succeeding target marker clusters.- Parameters:
refMarker
- a reference marker index- Returns:
- the weight for the HMM state probability at the preceding target marker cluster when estimating the HMM state probability at the specified reference marker via linear interpolation
- Throws:
java.lang.IllegalArgumentException
- ifrefMarker < 0 || refMarker >= this.refGT().nMarkers()
-
-