Package phase
Class BasicPhaseStates
- java.lang.Object
-
- phase.BasicPhaseStates
-
public final class BasicPhaseStates extends java.lang.ObjectClass
BasicPhaseStateshas methods for constructing a Li and Stephens HMM for a target haplotype or target sample.Instances of
BasicPhaseStatesare not thread-safe.
-
-
Constructor Summary
Constructors Constructor Description BasicPhaseStates(PbwtPhaseIbs ibsHaps, int maxStates)Constructs a newBasicPhaseStatesobject from the specified data.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intibsStates(int sample, byte[][][] nMismatches)Stores the Li and Stephens HMM for the specified target sample in the specified arrays.intibsStates(int sample, MarkerCluster mc, java.util.List<int[]> refAtMissingGT, byte[][][] nMismatches)Stores the Li and Stephens HMM for the specified target sample in the specified arrays.intmaxStates()Returns the maximum number of HMM states at a marker.intnMarkers()Returns the number of markers.intnTargSamples()Returns the number of target samples.
-
-
-
Constructor Detail
-
BasicPhaseStates
public BasicPhaseStates(PbwtPhaseIbs ibsHaps, int maxStates)
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:
java.lang.IllegalArgumentException- ifmaxStates < 1java.lang.NullPointerException- ifibsHaps == null
-
-
Method Detail
-
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
public int ibsStates(int sample, MarkerCluster mc, java.util.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. 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:
sample- the target sample indexmc- 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:
java.lang.IndexOutOfBoundsException- ifsample < 0 || sample >= this.nTargSamples()java.lang.IndexOutOfBoundsException- ifnMismatches.length < 3java.lang.IndexOutOfBoundsException- if there existsjsuch that0 < j && j < 3 && nMismatches[j].length < mc.nClusters()java.lang.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 markermjava.lang.IndexOutOfBoundsException- ifmissAlleles.get(j)is less than the number of model states for anyjthat indexes the missing genotypesjava.lang.NullPointerException- if(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:
java.lang.IndexOutOfBoundsException- ifsample < 0 || sample >= this.nTargSamples()java.lang.IndexOutOfBoundsException- ifnMismatches.length < 2java.lang.IndexOutOfBoundsException- if there existsjsuch that(0 < j && j < 2 && nMismatches[j].length < this.nMarkers())java.lang.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 statesjava.lang.NullPointerException- if any array isnull
-
-