public class HaplotypeCluster
A HaplotypeCluster is a List of Haplotypes that are all similar. Size and score are alternate methods of measuring cluster importance. For score, Haplotypes are weighted by the number of clusters to which they belong since a Haplotype can belong to more than one cluster. The natural order for clusters is determined by score then by size, both in descending order.
public static net.maizegenetics.analysis.clustering.HaplotypeCluster.TYPE ReturnHaplotype
The TYPE used to represent all HaplotypeClusters
public HaplotypeCluster(java.util.ArrayList<net.maizegenetics.analysis.clustering.Haplotype> hapList)
hapList - an ArrayList of Haplotypespublic HaplotypeCluster(Haplotype hap)
hap - a single Haplotype used to seed the clusterpublic HaplotypeCluster(Haplotype hap, double initialScore)
hap - a HaplotypeinitialScore - the initial cluster score, usually set to 1public HaplotypeCluster(java.util.ArrayList<net.maizegenetics.analysis.clustering.Haplotype> hapList,
double initialScore)
hapList - an ArrayList of Haplotype objectsinitialScore - the initial score assigned to this clusterpublic int getSize()
public java.util.ArrayList<net.maizegenetics.analysis.clustering.Haplotype> getHaplotypeList()
public double getScore()
public void setScore(double newScore)
Sets the score of this haplotype to the new score.
newScore - the new scorepublic void incrementScore(double val)
val - the value to be added to the cluster scorepublic Haplotype get(int index)
index - the index of a Haplotype in this clusterpublic void add(Haplotype hap)
hap - a Haplotypepublic void remove(Haplotype hap)
hap - a Haplotype to be removed from the clusterpublic void removeAll(HaplotypeCluster cluster)
All haplotypes in cluster that are also in this cluster will be removed from this cluster
cluster - another clusterpublic void addAll(HaplotypeCluster cluster)
This function does not prevent Haplotypes from being duplicated. To avoid duplicates use addAllUnique.
cluster - Adds all Haplotypes in cluster to this cluster.public java.util.Iterator<net.maizegenetics.analysis.clustering.Haplotype> getIterator()
public void addAllUnique(HaplotypeCluster cluster)
Adds Haplotypes from cluster that are not already contained in this cluster
cluster - another clusterpublic int getCountOfHaplotypesNotInThisCluster(HaplotypeCluster cluster)
Counts the number of Haplotypes in cluster that are not also in this cluster
cluster - another clusterpublic int getMaximumDistance(Haplotype hap)
hap - a Haplotypepublic kotlin.Array[] getAllelesAtSite(int site)
site - public void countAllelesAtAllSites()
public HaplotypeCluster copy()
This function returns a copy of the component Haplotypes not references to them.
public int compareTo(HaplotypeCluster cluster)
public kotlin.Array[] getHaplotype()
The common haplotype of this cluster. The type is determined by the field ReturnHaplotype.
public java.lang.String getHaplotypeAsString()
The common haplotype of this cluster. The type is determined by the field ReturnHaplotype.
public kotlin.Array[] getMajorityHaplotype()
The majority haplotype of this cluster where each site is assigned value of the major allele within the cluster.
public kotlin.Array[] getCensoredMajorityHaplotype(double maxMinorFreq,
int maxMinorCount)
This returns the majority haplotype for sites with either minor allele frequency below maxMinorFreq or minor allele count less than or equal to maxMinorCount. Missing is returned at sites not meeting the stated criteria.
maxMinorFreq - the maximum proportion of offtypes (alternate alleles) allowed before site is set to missingmaxMinorCount - the maximum minor allele count allowed before site is set to missingpublic kotlin.Array[] getUnanimousHaplotype()
The unanimous haplotype of this cluster. Only monomorphic sites are reported. Others will be unknown.
public java.lang.String byteHaplotypeAsString(kotlin.Array[] hap)
Converts a byte sequence to a String
hap - an array of byte genotype or haplotype valuespublic int getNumberOfSites()
public kotlin.Array[] listTaxaInCluster()
public int countTaxaSharedWith(HaplotypeCluster hapCluster)
public boolean contains(Haplotype hap)
public int countHeterozygousSites()
public java.lang.String toString()