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, Pedigree ped, Window window, 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
ibsStep()
Returns the minimum cM step length for composite reference haplotype construction.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
prevStage1Marker(int marker)
Returns the index of the closest stage1 marker (in the list of stage1 markers) with position less than or equal to the position of the specified marker, or 0 if no such stage1 marker exists.float
prevStage1Wt(int marker)
Returns the linear interpolation weight associated with the preceding stage1 marker (seethis.prevStage1Marker(marker)
).java.util.Optional<RefGT>
refGT()
Returns the optional phased, nonmissing reference genotypes.Ibs2
stage1Ibs2()
Returns the IBS2 data for the stage1 markers.FloatArray
stage1Maf()
Returns a list whosej
-th element is the estimated minor allele frequency of thej
-th the stage1 marker.MarkerMap
stage1Map()
Returns the genetic map for the stage1 markers.int
stage1Overlap()
Returns the number of stage1 markers that have phased target genotypes due to overlap with the previous window.java.util.Optional<RefGT>
stage1RefGT()
Returns the optional phased, nonmissing reference genotypes for the stage1 markers.Steps
stage1Steps()
Returns a partition of the stage1 markers into a sequence of sets of consecutive markers (the steps).GT
stage1TargGT()
Returns the input target genotypes at the stage1 markers.IntArray
stage1To2()
Returns a map from stage1 marker index to marker indexjava.util.Optional<XRefGT>
stage1XRefGT()
Returns the optional phased, nonmissing reference genotypes for the stage1 markers.GT
targGT()
Returns the input target genotypes.int
window()
Returns the index of the marker window.
-
-
-
Constructor Detail
-
FixedPhaseData
public FixedPhaseData(Par par, Pedigree ped, Window window, GT phasedOverlap)
Constructs a newFixedPhaseData
instance from the specified data.- Parameters:
par
- the analysis parametersped
- the pedigree data for the target sampleswindow
- input data for the next 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 java.util.Optional<RefGT> refGT()
Returns the optional phased, nonmissing reference genotypes.- Returns:
- the optional phased, nonmissing reference genotypes
-
targGT
public GT targGT()
Returns the input target genotypes. The returned allele data is stored in marker-major order.- 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
-
stage1Map
public MarkerMap stage1Map()
Returns the genetic map for the stage1 markers.- Returns:
- the genetic map for the stage1 markers
-
ibsStep
public float ibsStep()
Returns the minimum cM step length for composite reference haplotype construction.- Returns:
- the minimum cM step length for composite reference haplotype construction
-
stage1Steps
public Steps stage1Steps()
Returns a partition of the stage1 markers into a sequence of sets of consecutive markers (the steps).- Returns:
- a partition of the stage1 markers into a sequence of sets of consecutive markers (the steps)
-
stage1RefGT
public java.util.Optional<RefGT> stage1RefGT()
Returns the optional phased, nonmissing reference genotypes for the stage1 markers. The returned allele data is stored in marker-major order.- Returns:
- the optional phased, nonmissing reference genotypes for the stage1 markers
-
stage1XRefGT
public java.util.Optional<XRefGT> stage1XRefGT()
Returns the optional phased, nonmissing reference genotypes for the stage1 markers. The returned allele data is stored in haplotype-major order.- Returns:
- the optional phased, nonmissing reference genotypes for the stage1 markers
-
stage1TargGT
public GT stage1TargGT()
Returns the input target genotypes at the stage1 markers. The returned allele data is stored in marker-major order.- Returns:
- the input target genotypes at the stage1 markers
-
stage1Maf
public FloatArray stage1Maf()
Returns a list whosej
-th element is the estimated minor allele frequency of thej
-th the stage1 marker.- Returns:
- the estimated stage1 minor allele frequencies
-
stage1Overlap
public int stage1Overlap()
Returns the number of stage1 markers that have phased target genotypes due to overlap with the previous window.- Returns:
- the number of stage1 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
-
stage1To2
public IntArray stage1To2()
Returns a map from stage1 marker index to marker index- Returns:
- a map from stage1 marker index to marker index
-
stage1Ibs2
public Ibs2 stage1Ibs2()
Returns the IBS2 data for the stage1 markers.- Returns:
- the IBS2 data for the stage1 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()
-
prevStage1Marker
public int prevStage1Marker(int marker)
Returns the index of the closest stage1 marker (in the list of stage1 markers) with position less than or equal to the position of the specified marker, or 0 if no such stage1 marker exists.- Parameters:
marker
- a marker index- Returns:
- the index of the closest preceding stage1 marker
- Throws:
java.lang.IndexOutOfBoundsException
- ifmarker < 0 || marker >= this.targGT().nMarkers()
-
prevStage1Wt
public float prevStage1Wt(int marker)
Returns the linear interpolation weight associated with the preceding stage1 marker (seethis.prevStage1Marker(marker)
).- Parameters:
marker
- a marker index- Returns:
- the linear interpolation weight associated with the preceding stage1 marker
- Throws:
java.lang.IndexOutOfBoundsException
- ifmarker < 0 || marker >= this.targGT().nMarkers()
-
-