public final class BasicSampleHapPairs extends java.lang.Object implements SampleHapPairs
Class BasicSampleHapPairs
stores a list of samples and a
haplotype pair for each sample.
Instance of class BasicSampleHapPairs
are immutable.
Constructor and Description |
---|
BasicSampleHapPairs(Samples samples,
java.util.List<HapPair> hapPairList)
Constructs a new
BasicSampleHapPairs instance. |
Modifier and Type | Method and Description |
---|---|
int |
allele(int marker,
int haplotype)
Returns the allele for the specified marker and haplotype.
|
int |
allele1(int marker,
int hapPair)
Returns the first allele for the specified marker and haplotype pair.
|
int |
allele2(int marker,
int hapPair)
Returns the second allele for the specified marker and haplotype pair.
|
int |
alleleCount(int marker,
int allele)
Returns the number of haplotypes that carry the specified allele.
|
int |
hapIndex(int marker,
int allele,
int copy)
Returns index of the haplotype that carries the specified copy of the
specified allele.
|
int |
majorAllele(int marker)
Returns the index of the major allele.
|
Marker |
marker(int marker)
Returns the specified marker.
|
Markers |
markers()
Returns the markers.
|
int |
nAlleles(int marker)
Returns the number of marker alleles.
|
int |
nHapPairs()
Returns the number of haplotype pairs.
|
int |
nHaps()
Returns the number of haplotypes.
|
int |
nMarkers()
Returns the number of markers.
|
int |
nSamples()
Returns the number of samples.
|
int |
sampleIndex(int hapPair)
Returns the index of the sample associated with the specified
haplotype pair in the list of samples returned by
this.samples() . |
Samples |
samples()
Returns the samples.
|
Samples |
samples(int hapPair)
Returns a list of samples containing the sample associated with
the specified haplotype pair
|
boolean |
storesNonMajorIndices(int marker)
Returns
true if this object stores the indices of haplotypes
that carry non-major alleles, and returns false otherwise. |
public BasicSampleHapPairs(Samples samples, java.util.List<HapPair> hapPairList)
BasicSampleHapPairs
instance.samples
- a list of sampleshapPairList
- a list of haplotype pairs corresponding to the
specified list of samplesjava.lang.IllegalArgumentException
- if
hapPairList.isEmpty() == true
java.lang.IllegalArgumentException
- if
hapPairList.get(j).markers().equals(hapPairList.get(k).markers())
== false
for any indices j, k
satisfying
0 <= j && j < k && k < hapPairList.size()
java.lang.IllegalArgumentException
- if the list of samples does not
match the list of samples determined by hapPairList
java.lang.NullPointerException
- if samples == null
java.lang.NullPointerException
- if
(hapPairList == null || hapPairList(j) == null)
for any j
satisfying (0 <= j && j < hapPairList.size())
public int allele1(int marker, int hapPair)
HapPairs
public int allele2(int marker, int hapPair)
HapPairs
public int allele(int marker, int haplotype)
HapPairs
public int nMarkers()
HapPairs
public Marker marker(int marker)
HapPairs
public int nHaps()
HapPairs
2*this.nHapPairs()
.public int nHapPairs()
HapPairs
this.nHaps()/2
.public int nSamples()
SampleHapPairs
nSamples
in interface SampleHapPairs
public Samples samples()
SampleHapPairs
k
-th sample corresponds to
the k
-th haplotype pair.samples
in interface SampleHapPairs
public Samples samples(int hapPair)
HapPairs
public int sampleIndex(int hapPair)
HapPairs
this.samples()
.sampleIndex
in interface HapPairs
hapPair
- a haplotype pair indexthis.samples()
public int nAlleles(int marker)
SampleHapPairs
nAlleles
in interface SampleHapPairs
marker
- a marker indexpublic boolean storesNonMajorIndices(int marker)
SampleHapPairs
true
if this object stores the indices of haplotypes
that carry non-major alleles, and returns false
otherwise.storesNonMajorIndices
in interface SampleHapPairs
marker
- a marker indextrue
if this object stores the indices of haplotypes
that carry non-major allelespublic int majorAllele(int marker)
SampleHapPairs
majorAllele
in interface SampleHapPairs
marker
- a marker indexpublic int alleleCount(int marker, int allele)
SampleHapPairs
alleleCount
in interface SampleHapPairs
marker
- a marker indexallele
- an allele indexpublic int hapIndex(int marker, int allele, int copy)
SampleHapPairs
hapIndex
in interface SampleHapPairs
marker
- a marker indexallele
- an allele indexcopy
- a copy index.