Package phase
Class FixedPhaseData
- java.lang.Object
-
- phase.FixedPhaseData
-
public class FixedPhaseData extends java.lang.Object
Class
FixedPhaseData
stores immutable data for a marker window. The definition of low-frequency markers is determined by thePar.rare()
method andFixedPhaseData.MAX_HIFREQ_PROP
field.Instances of class
FixedPhaseData
are immutable.
-
-
Constructor Summary
Constructors Constructor Description FixedPhaseData(Par par, GeneticMap genMap, Data data, GT phasedOverlap)
Constructs a newFixedPhaseData
instance from the specified data.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IntArray
carriers(int marker, int allele)
Returns the indices of the reference and target samples for the specified low-frequency allele.float
err()
Return the allele mismatch emission probability.Ibs2
hiFreqIbs2()
Returns the IBS2 data for the high-frequency markers.IntArray
hiFreqIndices()
Returns the indices of the high-frequency markers.MarkerMap
hiFreqMap()
Returns the genetic map for the high-frequency markers.int
hiFreqOverlap()
Returns the number of initial high-frequency markers that have phased target genotypes due to overlap with the previous window.RefGT
hiFreqRefGT()
Returns the phased, nonmissing reference genotypes for the high-frequency markers ornull
if there are no reference samples.GT
hiFreqTargGT()
Returns the input target genotypes at the high-frequency markers.boolean
isLowFreq(int marker, int allele)
Returnstrue
if the specified allele is a low-frequency allele, and returnsfalse
otherwise.MarkerMap
map()
Returns the genetic map for the markers.int
nHaps()
Return the sum of the number of reference and target haplotypes.int
overlap()
Returns the number of initial markers that have phased target genotypes due to overlap with the previous marker window.Par
par()
Return the analysis parameters.Pedigree
ped()
Returns the parent-offspring relationships.int
prevHiFreqMarker(int marker)
Returns the index of the closest high-frequency marker with position less than or equal to the position of the specified marker, or 0 if no such high-frequency marker exists.float
prevWt(int marker)
Returns the linear interpolation weight for the high-frequency marker with indexthis.prevHiFreqMarker(marker)
.RefGT
refGT()
Returns the input phased, nonmissing reference genotypes ornull
if there are no reference samples.GT
targGT()
Returns the input target genotypes.int
window()
Returns the index of the marker window.
-
-
-
Constructor Detail
-
FixedPhaseData
public FixedPhaseData(Par par, GeneticMap genMap, Data data, GT phasedOverlap)
Constructs a newFixedPhaseData
instance from the specified data.- Parameters:
par
- the analysis parametersgenMap
- the genetic mapdata
- input data for the current marker windowphasedOverlap
- initial phased target genotypes due to overlap with the previous window ornull
if there are no initial phased target genotypes- Throws:
java.lang.IllegalArgumentException
- if(phasedOverlap != null && phasedOverlap.isPhased() == false)
java.lang.IllegalArgumentException
- if(phasedOverlap != null && data.targGT().samples().equals(phasedOverlap.samples()) == false)
java.lang.IllegalArgumentException
- if(phasedOverlap != null && data.targGT().nMarkers() < phasedOverlap.nMarkers())
java.lang.IllegalArgumentException
- if(phasedOverlap != null && phasedOverlap.marker(j).equals(data.targGT().marker(j) == false)
for somej
satisfying(0 <= j && j <= overlapHaps.nMarkers())
java.lang.NullPointerException
- if(par == null || genMap == null || data == null)
-
-
Method Detail
-
par
public Par par()
Return the analysis parameters.- Returns:
- the analysis parameters
-
window
public int window()
Returns the index of the marker window.- Returns:
- the index of the marker window
-
ped
public Pedigree ped()
Returns the parent-offspring relationships.- Returns:
- the parent-offspring relationships
-
map
public MarkerMap map()
Returns the genetic map for the markers.- Returns:
- the genetic map for the markers
-
refGT
public RefGT refGT()
Returns the input phased, nonmissing reference genotypes ornull
if there are no reference samples.- Returns:
- the input phased, nonmissing reference genotypes
or
null
if there are no reference samples
-
targGT
public GT targGT()
Returns the input target genotypes.- Returns:
- the input target genotypes
-
overlap
public int overlap()
Returns the number of initial markers that have phased target genotypes due to overlap with the previous marker window.- Returns:
- the number of initial markers that have phased target genotypes due to overlap with the previous marker window
-
hiFreqMap
public MarkerMap hiFreqMap()
Returns the genetic map for the high-frequency markers.- Returns:
- the genetic map for the high-frequency markers
-
hiFreqRefGT
public RefGT hiFreqRefGT()
Returns the phased, nonmissing reference genotypes for the high-frequency markers ornull
if there are no reference samples.- Returns:
- the phased, nonmissing reference genotypes for the high-frequency
markers or
null
if there are no reference samples
-
hiFreqTargGT
public GT hiFreqTargGT()
Returns the input target genotypes at the high-frequency markers.- Returns:
- the input target genotypes at the high-frequency markers
-
hiFreqOverlap
public int hiFreqOverlap()
Returns the number of initial high-frequency markers that have phased target genotypes due to overlap with the previous window.- Returns:
- the number of initial high-frequency markers that have phased target genotypes due to overlap with the previous window
-
nHaps
public int nHaps()
Return the sum of the number of reference and target haplotypes.- Returns:
- the sum of the number of reference and target haplotypes
-
err
public float err()
Return the allele mismatch emission probability.- Returns:
- the allele mismatch emission probability
-
hiFreqIndices
public IntArray hiFreqIndices()
Returns the indices of the high-frequency markers.- Returns:
- the indices of the high-frequency markers
-
hiFreqIbs2
public Ibs2 hiFreqIbs2()
Returns the IBS2 data for the high-frequency markers.- Returns:
- the IBS2 data for the high-frequency markers
-
carriers
public IntArray carriers(int marker, int allele)
Returns the indices of the reference and target samples for the specified low-frequency allele. The reference sample indices will be shifted by the number of target samples. so that the first reference sample will have an index equal to the number of target samples. The returned list will be sorted in order of increasing sample index. The returned array will be empty and equal tovcf.Data.ZERO_FREQ_ARRAY
if the allele has no carriers, and the returned array will be empty and equal tovcf.Data.HIGH_FREQ_ARRAY
if the allele is not a low-frequency allele.- Parameters:
marker
- a marker indexallele
- an allele index for the specified marker- Returns:
- the indices of the reference and target samples that the specified low-frequency allele
- Throws:
java.lang.IndexOutOfBoundsException
- ifmarker < 0 || marker >= this.targGT().nMarkers()
java.lang.IndexOutOfBoundsException
- ifallele < 0 || allele >= this.targGT().marker(marker).nAlleles()
-
isLowFreq
public boolean isLowFreq(int marker, int allele)
Returnstrue
if the specified allele is a low-frequency allele, and returnsfalse
otherwise.- Parameters:
marker
- a marker indexallele
- an allele index for the specified marker- Returns:
true
if the specified allele is a low-frequency allele- Throws:
java.lang.IndexOutOfBoundsException
- ifmarker < 0 || marker >= this.targGT().nMarkers()
java.lang.IndexOutOfBoundsException
- ifallele < 0 || allele >= this.targGT().marker(marker).nAlleles()
-
prevHiFreqMarker
public int prevHiFreqMarker(int marker)
Returns the index of the closest high-frequency marker with position less than or equal to the position of the specified marker, or 0 if no such high-frequency marker exists.- Parameters:
marker
- a marker index- Returns:
- the index of the closest hi-frequency marker with position less than or equal to the position of the specified marker, or 0 if no such high-frequency marker exists
- Throws:
java.lang.IndexOutOfBoundsException
- ifmarker < 0 || marker >= this.targGT().nMarkers()
-
prevWt
public float prevWt(int marker)
Returns the linear interpolation weight for the high-frequency marker with indexthis.prevHiFreqMarker(marker)
.- Parameters:
marker
- a marker index- Returns:
- the linear interpolation weight for the high-frequency marker
with index
this.prevHiFreqMarker(marker)
- Throws:
java.lang.IndexOutOfBoundsException
- ifmarker < 0 || marker >= this.targGT().nMarkers()
-
-