Package picard.fingerprint
Class HaplotypeBlock
- java.lang.Object
-
- picard.fingerprint.HaplotypeBlock
-
- All Implemented Interfaces:
Comparable<HaplotypeBlock>
public class HaplotypeBlock extends Object implements Comparable<HaplotypeBlock>
Represents information about a group of SNPs that form a haplotype in perfect LD with one another.
-
-
Constructor Summary
Constructors Constructor Description HaplotypeBlock(double maf)Constructs a haplotype block with the provided minor allele frequency.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddSnp(Snp snp)Adds a SNP to the haplotype.intcompareTo(HaplotypeBlock that)booleancontains(Snp snp)Returns true if the SNP is contained within the haplotype block, false otherwise.booleanequals(Object o)DiploidHaplotypegetDiploidHaplotype(Snp snp, DiploidGenotype gt)Gets the diploid haplotype for this haplotype block given the provided SNP and SNP genotype.SnpgetFirstSnp()Gets the arbitrarily first SNP in the haplotype.double[]getHaplotypeFrequencies()Gets the set of haplotype frequencies.doublegetHaplotypeFrequency(int i)Gets the frequency of the i'th diploid haplotype where haplotypes are ordered accorinding to DiploidHaplotype.doublegetMaf()Returns the minor allele frequency of this haplotype.SnpgetSnp(String name)Gets a SNP by name if it belongs to this haplotype.DiploidGenotypegetSnpGenotype(Snp snp, DiploidHaplotype haplotype)Gets the expected genotype of the provided SNP given the provided haplotype of this haplotype block.Collection<Snp>getSnps()Returns an unmodifiable, unordered, collection of all SNPs in this haplotype block.inthashCode()intsize()Returns the number of SNPs within the haplotype block.StringtoString()
-
-
-
Method Detail
-
getHaplotypeFrequencies
public double[] getHaplotypeFrequencies()
Gets the set of haplotype frequencies.
-
addSnp
public void addSnp(Snp snp)
Adds a SNP to the haplotype. Will throw an exception if the SNP is on the wrong chromosome.
-
getFirstSnp
public Snp getFirstSnp()
Gets the arbitrarily first SNP in the haplotype.
-
contains
public boolean contains(Snp snp)
Returns true if the SNP is contained within the haplotype block, false otherwise.
-
size
public int size()
Returns the number of SNPs within the haplotype block.
-
getSnps
public Collection<Snp> getSnps()
Returns an unmodifiable, unordered, collection of all SNPs in this haplotype block.
-
getHaplotypeFrequency
public double getHaplotypeFrequency(int i)
Gets the frequency of the i'th diploid haplotype where haplotypes are ordered accorinding to DiploidHaplotype.
-
getMaf
public double getMaf()
Returns the minor allele frequency of this haplotype.
-
getSnpGenotype
public DiploidGenotype getSnpGenotype(Snp snp, DiploidHaplotype haplotype)
Gets the expected genotype of the provided SNP given the provided haplotype of this haplotype block.
-
getDiploidHaplotype
public DiploidHaplotype getDiploidHaplotype(Snp snp, DiploidGenotype gt)
Gets the diploid haplotype for this haplotype block given the provided SNP and SNP genotype.
-
compareTo
public int compareTo(HaplotypeBlock that)
- Specified by:
compareToin interfaceComparable<HaplotypeBlock>
-
-