Package haplotype
Class HapPairPhasedGT
- java.lang.Object
-
- haplotype.HapPairPhasedGT
-
-
Constructor Summary
Constructors Constructor Description HapPairPhasedGT(Samples samples, java.util.List<BitHapPair> hapPairList)
Constructs a newBasicPhasedGT
instance from the specified data.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
allele(int marker, int haplotype)
Returns the allele on the specified haplotype for the specified marker or return -1 if the allele is missing.int
allele1(int marker, int hapPair)
Returns the first allele for the specified marker and sample or return -1 if the allele is missing.int
allele2(int marker, int hapPair)
Returns the second allele for the specified marker and sample or return -1 if the allele is missing.boolean
isPhased()
Returnstrue
if the genotype for each marker and sample is a phased, non-missing genotype, and returnsfalse
otherwise.boolean
isPhased(int sample)
Returnstrue
if the genotype for each marker for the specified sample is a phased, nonmissing genotype, and returnsfalse
otherwise.boolean
isPhased(int marker, int sample)
Returnstrue
if the genotype for the specified marker and sample is a phased, nonmissing genotype, and returnsfalse
otherwise.Marker
marker(int marker)
Returns the specified marker.Markers
markers()
Returns the list of markers.int
nHaps()
Returns the number of haplotypes.int
nMarkers()
Returns the number of markers.int
nSamples()
Returns the number of samples.Samples
samples()
Returns the list of samples.
-
-
-
Constructor Detail
-
HapPairPhasedGT
public HapPairPhasedGT(Samples samples, java.util.List<BitHapPair> hapPairList)
Constructs a newBasicPhasedGT
instance from the specified data.- Parameters:
samples
- a list of sampleshapPairList
- a list of haplotype pairs corresponding to the specified list of samples- Throws:
java.lang.IllegalArgumentException
- ifhapPairList.isEmpty() == true
java.lang.IllegalArgumentException
- ifhapPairList.get(j).markers().equals(hapPairList.get(k).markers()) == false
for any indicesj, k
satisfying0 <= j && j < k && k < hapPairList.size()
java.lang.IllegalArgumentException
- if the list of samples does not match the list of samples determined byhapPairList
java.lang.IllegalArgumentException
- ifsamples.nSamples() != hapPairs.size()
java.lang.IllegalArgumentException
- if(samples.idIndex(j) != hapPairs.get(j).idIndex())
for anyj
satisfying0 <= j && j < hapPairList.size()
java.lang.NullPointerException
- ifsamples == null
java.lang.NullPointerException
- if(hapPairList == null || hapPairList(j) == null)
for anyj
satisfying(0 <= j && j < hapPairList.size())
-
-
Method Detail
-
isPhased
public boolean isPhased(int marker, int sample)
Description copied from interface:GT
Returnstrue
if the genotype for the specified marker and sample is a phased, nonmissing genotype, and returnsfalse
otherwise.
-
isPhased
public boolean isPhased(int sample)
Description copied from interface:GT
Returnstrue
if the genotype for each marker for the specified sample is a phased, nonmissing genotype, and returnsfalse
otherwise.
-
isPhased
public boolean isPhased()
Description copied from interface:GT
Returnstrue
if the genotype for each marker and sample is a phased, non-missing genotype, and returnsfalse
otherwise.
-
allele1
public int allele1(int marker, int hapPair)
Description copied from interface:GT
Returns the first allele for the specified marker and sample or return -1 if the allele is missing. The two alleles for a sample are arbitrarily ordered ifthis.unphased(marker, sample) == false
.
-
allele2
public int allele2(int marker, int hapPair)
Description copied from interface:GT
Returns the second allele for the specified marker and sample or return -1 if the allele is missing. The two alleles for a sample are arbitrarily ordered ifthis.unphased(marker, sample) == false
.
-
allele
public int allele(int marker, int haplotype)
Description copied from interface:GT
Returns the allele on the specified haplotype for the specified marker or return -1 if the allele is missing. The two alleles for an individual are arbitrarily ordered ifthis.unphased(marker, hap/2) == false
.
-
nMarkers
public int nMarkers()
Description copied from interface:GT
Returns the number of markers.
-
marker
public Marker marker(int marker)
Description copied from interface:GT
Returns the specified marker.
-
nHaps
public int nHaps()
Description copied from interface:GT
Returns the number of haplotypes. The returned value is equal to2*this.nSamples()
.
-
nSamples
public int nSamples()
Description copied from interface:GT
Returns the number of samples.
-
-