Package phase
Class BasicPhaseStates
java.lang.Object
phase.BasicPhaseStates
Class BasicPhaseStates has methods for constructing a Li and
Stephens HMM for a target haplotype or target sample.
Instances of BasicPhaseStates are not thread-safe.
-
Constructor Summary
ConstructorsConstructorDescriptionBasicPhaseStates(PbwtPhaseIbs ibsHaps, int maxStates) Constructs a newBasicPhaseStatesobject from the specified data. -
Method Summary
Modifier and TypeMethodDescriptionintibsStates(int sample, byte[][][] nMismatches) Stores the Li and Stephens HMM for the specified target sample in the specified arrays.intibsStates(MarkerCluster mc, List<int[]> refAtMissingGT, byte[][][] nMismatches) Stores the Li and Stephens HMM for the specified target sample in the specified arrays.ThenMismatchesparameter is an array of three two-dimensional arrays:nMismatches[0]stores stores the allele mismatch data between the reference haplotypes and the haplotype composed of homozygous target genotypes,nMismatches[1]stores the allele mismatch data between the reference haplotypes and the first target haplotype, andnMismatches[2]stores the allele mismatch data between the reference haplotypes and the first target haplotype.intReturns the maximum number of HMM states at a marker.intnMarkers()Returns the number of markers.intReturns the number of target samples.
-
Constructor Details
-
BasicPhaseStates
Constructs a newBasicPhaseStatesobject from the specified data.- Parameters:
ibsHaps- the IBS haplotype segmentsmaxStates- the maximum number of composite reference haplotypes that will be constructed- Throws:
IllegalArgumentException- ifmaxStates < 1NullPointerException- ifibsHaps == null
-
-
Method Details
-
nTargSamples
public int nTargSamples()Returns the number of target samples.- Returns:
- the number of target samples
-
nMarkers
public int nMarkers()Returns the number of markers.- Returns:
- the number of markers
-
maxStates
public int maxStates()Returns the maximum number of HMM states at a marker.- Returns:
- the maximum number of HMM states at a marker
-
ibsStates
Stores the Li and Stephens HMM for the specified target sample in the specified arrays.ThenMismatchesparameter is an array of three two-dimensional arrays:nMismatches[0]stores stores the allele mismatch data between the reference haplotypes and the haplotype composed of homozygous target genotypes,nMismatches[1]stores the allele mismatch data between the reference haplotypes and the first target haplotype, andnMismatches[2]stores the allele mismatch data between the reference haplotypes and the first target haplotype. Each two-dimensional array must have at leastmc.nClusters()rows, and a column for each HMM state. An element of the two-dimensional array is 0 if the target and reference allele match and is 1 otherwise.- Parameters:
mc- the marker clustersrefAtMissingGT- a list of arrays in which HMM state alleles at markers for which one or both target haplotypes have a missing allelenMismatches- arrays for storing present or absence of mismatches between target and reference alleles- Returns:
- the number of state alleles at each marker
- Throws:
IndexOutOfBoundsException- ifsample < 0 || sample >= this.nTargSamples()IndexOutOfBoundsException- ifnMismatches.length < 3IndexOutOfBoundsException- if there existsjsuch that0 < j && j < 3 && nMismatches[j].length < mc.nClusters()IndexOutOfBoundsException- if there existsj, msuch that(0 < j && j < 3 && 0 < m && m < mc.nClusters()), andnMismatches[j][m].lengthis less than the number of model states at markermIndexOutOfBoundsException- ifmissAlleles.get(j)is less than the number of model states for anyjthat indexes the missing genotypesNullPointerException- if(samplePhase == null || mc == null || refAtMissingGT == null)or if any array isnull
-
ibsStates
public int ibsStates(int sample, byte[][][] nMismatches) Stores the Li and Stephens HMM for the specified target sample in the specified arrays. The number of allele mismatches (0 or 1) betweenhap1[m]andhap2[m]for thej-th state are stored innMismatchs[0][m][j]andnMismatches[1][m][j]respectively.- Parameters:
sample- the target sample indexnMismatches- an array of two two-dimensional arrays in which the number of allele mismatches with reference haplotypes for the first haplotype and the second haplotype will be stored- Returns:
- the number of state alleles at each marker
- Throws:
IndexOutOfBoundsException- ifsample < 0 || sample >= this.nTargSamples()IndexOutOfBoundsException- ifnMismatches.length < 2IndexOutOfBoundsException- if there existsjsuch that(0 < j && j < 2 && nMismatches[j].length < this.nMarkers())IndexOutOfBoundsException- if there existsj, msuch that(0 < j && j < 2 && 0 < m && m < this.nMarkers()), andnMismatches[j][m].lengthis less than the total number of model statesNullPointerException- if any array isnull
-