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
    --- | --- | ---
    `void` | `addSnp​(Snp snp)` | Adds a SNP to the haplotype.
    `int` | `compareTo​(HaplotypeBlock that)` |
    `boolean` | `contains​(Snp snp)` | Returns true if the SNP is contained within the haplotype block, false otherwise.
    `boolean` | `equals​(Object o)` |
    `DiploidHaplotype` | `getDiploidHaplotype​(Snp snp, DiploidGenotype gt)` | Gets the diploid haplotype for this haplotype block given the provided SNP and SNP genotype.
    `Snp` | `getFirstSnp()` | Gets the arbitrarily first SNP in the haplotype.
    `double[]` | `getHaplotypeFrequencies()` | Gets the set of haplotype frequencies.
    `double` | `getHaplotypeFrequency​(int i)` | Gets the frequency of the i'th diploid haplotype where haplotypes are ordered accorinding to DiploidHaplotype.
    `double` | `getMaf()` | Returns the minor allele frequency of this haplotype.
    `Snp` | `getSnp​(String name)` | Gets a SNP by name if it belongs to this haplotype.
    `DiploidGenotype` | `getSnpGenotype​(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.
    `int` | `hashCode()` |
    `int` | `size()` | Returns the number of SNPs within the haplotype block.
    `String` | `toString()` |

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### HaplotypeBlock

          public HaplotypeBlock​(double maf)

      Constructs a haplotype block with the provided minor allele frequency.

  - ### 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.

    - #### getSnp

          public Snp getSnp​(String name)

      Gets a SNP by name if it belongs to this haplotype.

    - #### 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:
        `compareTo` in interface `Comparable<HaplotypeBlock>`

    - #### equals

          public boolean equals​(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`