public final class HomogeneousPloidyModel extends java.lang.Object implements PloidyModel
PloidyModel
implementation tailored to work with a homogeneous constant ploidy
across samples and positions.EMPTY_LIST
Constructor and Description |
---|
HomogeneousPloidyModel(SampleList sampleList,
int ploidy)
Constructs a homogeneous ploidy model given the sample list and ploidy.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getSample(int index)
Returns the element given its index within the set.
|
int |
indexOfSample(java.lang.String sample)
Returns the index of an object.
|
boolean |
isHomogeneous()
Checks whether the ploidy is homogeneous across all samples.
|
int |
numberOfSamples()
Returns number of elements in the list.
|
int |
samplePloidy(int sampleIndex)
Return the assumed ploidy for a sample given its index.
|
int |
totalPloidy()
Sum of all ploidy across all samples.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
asListOfSamples, asSetOfSamples, emptySampleList, equals, singletonSampleList
public HomogeneousPloidyModel(SampleList sampleList, int ploidy)
sampleList
- the sample list.ploidy
- the common ploidy for all samples in samples
.java.lang.IllegalArgumentException
- if sampleList
is null
,
or ploidy is 0 or less.public int numberOfSamples()
SampleList
numberOfSamples
in interface SampleList
public java.lang.String getSample(int index)
SampleList
getSample
in interface SampleList
index
- the target samples's index.null
; as null is not a valid element.public int indexOfSample(java.lang.String sample)
SampleList
indexOfSample
in interface SampleList
sample
- the sample of interest.-1
if such a sample is not an element of this set, otherwise is index in the set thus a
values within [0,SampleList.numberOfSamples()
).public int samplePloidy(int sampleIndex)
PloidyModel
samplePloidy
in interface PloidyModel
sampleIndex
- target sample index.public boolean isHomogeneous()
PloidyModel
isHomogeneous
in interface PloidyModel
true
if all samples has the same ploidy.public int totalPloidy()
PloidyModel
It must match the sum of all ploidies across samples.
totalPloidy
in interface PloidyModel