# Class HaplotypeProbabilitiesFromSequence

java.lang.Object
picard.fingerprint.HaplotypeProbabilities
picard.fingerprint.HaplotypeProbabilitiesFromSequence

Direct Known Subclasses:
  `HaplotypeProbabilitiesFromContaminatorSequence`

public class HaplotypeProbabilitiesFromSequence extends HaplotypeProbabilities
Represents the probability of the underlying haplotype given the data. By convention the alleles stored for each SNP are in phase.

## Nested Class Summary

### Nested classes/interfaces inherited from class HaplotypeProbabilities

`HaplotypeProbabilities.Genotype`

## Field Summary

Fields
Modifier and Type
Field
Description
`protected int`
`obsAllele1`
`protected int`
`obsAllele2`
`protected int`
`obsAlleleOther`

## Constructor Summary

Constructors
Constructor
Description
`HaplotypeProbabilitiesFromSequence(HaplotypeBlock haplotypeBlock)`
`HaplotypeProbabilitiesFromSequence(HaplotypeProbabilitiesFromSequence other)`

## Method Summary

Modifier and Type
Method
Description
`void`
`addToProbs(Snp snp, byte base, byte qual)`
Adds a base observation with the observed quality to the evidence for this haplotype based on the fact that the SNP is part of the haplotype.
`HaplotypeProbabilitiesFromSequence`
`deepCopy()`
`double`
`getFractionUnexpectedAlleleObs()`
`double[]`
`getLikelihoods()`
Converts the loglikelihoods into linear-space with normalizing.
`double[]`
`getLikelihoods0()`
`double`
`getLodMostProbableGenotype()`
Overridden to calculate the LOD from the loglikelihoods instead of the probabilities because it will allow for more accurate calculation before overflowing.
`double[]`
`getLogLikelihoods()`
Since this class uses log-rawLikelihoods natively, we override and return the native variable
`int`
`getObsAllele1()`
Returns the number of bases/reads that support the first allele.
`int`
`getObsAllele2()`
Returns the number of bases/reads that support the second allele.
`double[]`
`getPosteriorProbabilities()`
getter for posteriorProbs
`protected double[]`
`getPosteriorProbabilities0()`
Returns the posterior probability of the haplotypes given the evidence (uses the internal prior)
`Snp`
`getRepresentativeSnp()`
Simple returns the SNP from the haplotype that has the lowest genome coordinate.
`int`
`getTotalObs()`
Gets the total number of observations presented at this locus.
`boolean`
`hasEvidence()`
Returns true if evidence has been added, false if the probabilities are just the priors.
`HaplotypeProbabilitiesFromSequence`
`merge(HaplotypeProbabilities other)`
Merges information from another haplotype probabilities object for the same haplotype into this object.
`void`
`setLogLikelihoods(double[] ll)`

### Methods inherited from class HaplotypeProbabilities

`getHaplotype, getMostLikelyGenotype, getMostLikelyHaplotype, getPosteriorLikelihoods, getPriorProbablities, scaledEvidenceProbabilityUsingGenotypeFrequencies, shiftedLogEvidenceProbability, shiftedLogEvidenceProbabilityGivenOtherEvidence, shiftedLogEvidenceProbabilityUsingGenotypeFrequencies`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### obsAllele1

protected int obsAllele1

### obsAllele2

protected int obsAllele2

### obsAlleleOther

protected int obsAlleleOther

## Constructor Details

### HaplotypeProbabilitiesFromSequence

public HaplotypeProbabilitiesFromSequence(HaplotypeBlock haplotypeBlock)

### HaplotypeProbabilitiesFromSequence

public HaplotypeProbabilitiesFromSequence(HaplotypeProbabilitiesFromSequence other)

## Method Details

### hasEvidence

public boolean hasEvidence()
Description copied from class: `HaplotypeProbabilities`
Returns true if evidence has been added, false if the probabilities are just the priors.

### addToProbs

public void addToProbs(Snp snp, byte base, byte qual)
Adds a base observation with the observed quality to the evidence for this haplotype based on the fact that the SNP is part of the haplotype.

Parameters:
  `snp` - The snp in the HaplotypeBlock to which evidence is being added
  `base` - the base observed
  `qual` - the quality of the observed base

### merge

public HaplotypeProbabilitiesFromSequence merge(HaplotypeProbabilities other)
Merges information from another haplotype probabilities object for the same haplotype into this object. Useful for when probabilities need to be merged to levels higher than the read group, e.g. the sample or individual.

Parameters:
  `other` - Another haplotype probabilities object to merge in
Returns:

### deepCopy

public HaplotypeProbabilitiesFromSequence deepCopy()

Specified by:
  `deepCopy` in class `HaplotypeProbabilities`

### getObsAllele1

public int getObsAllele1()
Returns the number of bases/reads that support the first allele.

Overrides:
  `getObsAllele1` in class `HaplotypeProbabilities`
Returns:
  int

### getObsAllele2

public int getObsAllele2()
Returns the number of bases/reads that support the second allele.

Overrides:
  `getObsAllele2` in class `HaplotypeProbabilities`
Returns:
  int

### getTotalObs

public int getTotalObs()
Gets the total number of observations presented at this locus.

Overrides:
  `getTotalObs` in class `HaplotypeProbabilities`
Returns:
  int

### getFractionUnexpectedAlleleObs

public double getFractionUnexpectedAlleleObs()

### getRepresentativeSnp

public Snp getRepresentativeSnp()
Simple returns the SNP from the haplotype that has the lowest genome coordinate.

Specified by:
  `getRepresentativeSnp` in class `HaplotypeProbabilities`

### getPosteriorProbabilities0

protected double[] getPosteriorProbabilities0()
Returns the posterior probability of the haplotypes given the evidence (uses the internal prior)

### getPosteriorProbabilities

public double[] getPosteriorProbabilities()
getter for posteriorProbs

Overrides:
  `getPosteriorProbabilities` in class `HaplotypeProbabilities`

### getLikelihoods

public double[] getLikelihoods()
Converts the loglikelihoods into linear-space with normalizing.

Specified by:
  `getLikelihoods` in class `HaplotypeProbabilities`

### getLikelihoods0

public double[] getLikelihoods0()

### getLogLikelihoods

public double[] getLogLikelihoods()
Since this class uses log-rawLikelihoods natively, we override and return the native variable

Overrides:
  `getLogLikelihoods` in class `HaplotypeProbabilities`

### setLogLikelihoods

public void setLogLikelihoods(double[] ll)

### getLodMostProbableGenotype

public double getLodMostProbableGenotype()
Overridden to calculate the LOD from the loglikelihoods instead of the probabilities because it will allow for more accurate calculation before overflowing.

Overrides:
  `getLodMostProbableGenotype` in class `HaplotypeProbabilities`