Package picard.fingerprint
Class HaplotypeProbabilitiesFromGenotypeLikelihoods
- java.lang.Object
-
- picard.fingerprint.HaplotypeProbabilities
-
- picard.fingerprint.HaplotypeProbabilitiesFromGenotypeLikelihoods
-
public class HaplotypeProbabilitiesFromGenotypeLikelihoods extends HaplotypeProbabilities
Represents the likelihood of the HaplotypeBlock given the GenotypeLikelihoods (GL field from a VCF, which is actually a log10-likelihood) for each of the SNPs in that block. By convention the alleles stored for each SNP are in phase.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class picard.fingerprint.HaplotypeProbabilities
HaplotypeProbabilities.Genotype
-
-
Constructor Summary
Constructors Constructor Description HaplotypeProbabilitiesFromGenotypeLikelihoods(HaplotypeBlock haplotypeBlock)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddToLogLikelihoods(Snp snp, List<htsjdk.variant.variantcontext.Allele> alleles, double[] logGenotypeLikelihoods)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.double[]getLikelihoods()getter for likelihoods;doublegetLodMostProbableGenotype()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 loglikelihoods natively, we override and return the native variabledouble[]getPosteriorProbabilities()getter for posteriorsSnpgetRepresentativeSnp()Simple returns the SNP from the haplotype that has the lowest genome coordinate.booleanhasEvidence()Returns true if evidence has been added, false if the probabilities are just the priors.voidmerge(HaplotypeProbabilities other)Merges information from another haplotype probabilities object for the same haplotype into this object.voidsetLogLikelihoods(double[] ll)-
Methods inherited from class picard.fingerprint.HaplotypeProbabilities
getHaplotype, getMostLikelyGenotype, getMostLikelyHaplotype, getObsAllele1, getObsAllele2, getPriorProbablities, getTotalObs, scaledEvidenceProbabilityUsingGenotypeFrequencies, shiftedLogEvidenceProbability, shiftedLogEvidenceProbabilityGivenOtherEvidence, shiftedLogEvidenceProbabilityUsingGenotypeFrequencies
-
-
-
-
Constructor Detail
-
HaplotypeProbabilitiesFromGenotypeLikelihoods
public HaplotypeProbabilitiesFromGenotypeLikelihoods(HaplotypeBlock haplotypeBlock)
-
-
Method Detail
-
addToLogLikelihoods
public void addToLogLikelihoods(Snp snp, List<htsjdk.variant.variantcontext.Allele> alleles, double[] logGenotypeLikelihoods)
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 the likelihoods belongalleles- the (ordered) alleles to which the biallelic genotype likelihoods correspond. So that if the alleles are [A,B], thelogGenotypeLikelihoods- correspond to the logLikelihoods of [AA, AB, BB]. Log is assumed to be in base 10.
-
getRepresentativeSnp
public Snp getRepresentativeSnp()
Simple returns the SNP from the haplotype that has the lowest genome coordinate.- Specified by:
getRepresentativeSnpin classHaplotypeProbabilities
-
hasEvidence
public boolean hasEvidence()
Description copied from class:HaplotypeProbabilitiesReturns true if evidence has been added, false if the probabilities are just the priors.- Overrides:
hasEvidencein classHaplotypeProbabilities
-
merge
public void 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.- Specified by:
mergein classHaplotypeProbabilities- Parameters:
other- Another haplotype probabilities object to merge in (must of the the same class and for the same HaplotypeBlock)
-
getPosteriorProbabilities
public double[] getPosteriorProbabilities()
getter for posteriors- Overrides:
getPosteriorProbabilitiesin classHaplotypeProbabilities
-
getLikelihoods
public double[] getLikelihoods()
getter for likelihoods;- Specified by:
getLikelihoodsin classHaplotypeProbabilities
-
getLogLikelihoods
public double[] getLogLikelihoods()
Since this class uses loglikelihoods natively, we override and return the native variable- Overrides:
getLogLikelihoodsin classHaplotypeProbabilities
-
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:
getLodMostProbableGenotypein classHaplotypeProbabilities
-
-