Package haplotype
Interface HapPair
-
- All Known Implementing Classes:
BitHapPair,WrappedHapPair
public interface HapPairInterface
All instances ofHapPairrepresents a pair of haplotypes for a sample. The pair of haplotypes are guaranteed to have non-missing alleles at each marker.HapPairare required to be immutable.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description intallele1(int marker)Returns the first allele for the specified marker.intallele2(int marker)Returns the second allele for the specified marker.static java.util.Comparator<HapPair>comparator(Samples samples)Returns aComparator<HapPairInterface>whosecompare(hp1, hp2)method returns -1, 0, or 1 depending on whethersamples.index(hp1.idIndex())is less than, equal, or greater thansamples.index(hp2.idIndex()).intidIndex()Returns the sample identifier index.Markermarker(int marker)Returns the specified marker.Markersmarkers()Returns the markers.intnMarkers()Returns the number of markers.
-
-
-
Method Detail
-
allele1
int allele1(int marker)
Returns the first allele for the specified marker.- Parameters:
marker- a marker index- Returns:
- the first allele for the specified marker
- Throws:
java.lang.IndexOutOfBoundsException- ifmarker < 0 || marker >= this.nMarkers()
-
allele2
int allele2(int marker)
Returns the second allele for the specified marker.- Parameters:
marker- a marker index- Returns:
- the second allele for the specified marker
- Throws:
java.lang.IndexOutOfBoundsException- ifmarker < 0 || marker >= this.nMarkers()
-
markers
Markers markers()
Returns the markers.- Returns:
- the markers
-
marker
Marker marker(int marker)
Returns the specified marker.- Parameters:
marker- a marker index- Returns:
- the specified marker
- Throws:
java.lang.IndexOutOfBoundsException- ifmarker < 0 || marker >= this.nMarkers()
-
nMarkers
int nMarkers()
Returns the number of markers.- Returns:
- the number of markers
-
idIndex
int idIndex()
Returns the sample identifier index.- Returns:
- the sample identifier index
-
comparator
static java.util.Comparator<HapPair> comparator(Samples samples)
Returns aComparator<HapPairInterface>whosecompare(hp1, hp2)method returns -1, 0, or 1 depending on whethersamples.index(hp1.idIndex())is less than, equal, or greater thansamples.index(hp2.idIndex()).- Parameters:
samples- the list of samples used to compareHapsPairobjects- Returns:
- a
Comparator<HapPairInterface>whosecompare(hp1, hp2)method compares two haplotype pairs for order - Throws:
java.lang.NullPointerException- ifsamples == null
-
-