public abstract class PairHMM
extends java.lang.Object
implements java.io.Closeable
Modifier and Type | Class and Description |
---|---|
static class |
PairHMM.Implementation |
Modifier and Type | Field and Description |
---|---|
static byte |
BASE_QUALITY_SCORE_THRESHOLD |
protected boolean |
constantsAreInitialized |
protected boolean |
doNotUseTristateCorrection |
protected static java.lang.Boolean |
doProfiling |
protected int |
hapStartIndex |
protected boolean |
initialized |
protected static org.apache.logging.log4j.Logger |
logger |
protected int |
maxHaplotypeLength |
protected int |
maxReadLength |
protected double[] |
mLogLikelihoodArray |
protected int |
paddedHaplotypeLength |
protected int |
paddedMaxHaplotypeLength |
protected int |
paddedMaxReadLength |
protected int |
paddedReadLength |
protected static long |
pairHMMComputeTime |
protected byte[] |
previousHaplotypeBases |
protected long |
startTime |
protected long |
threadLocalPairHMMComputeTimeDiff |
Constructor and Description |
---|
PairHMM() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Called at the end of the program to close files, print profiling information etc
|
void |
computeLog10Likelihoods(LikelihoodMatrix<Haplotype> logLikelihoods,
java.util.List<GATKRead> processedReads,
java.util.Map<GATKRead,byte[]> gcp)
Given a list of reads and haplotypes, for every read compute the total probability of said read arising from
each haplotype given base substitution, insertion, and deletion probabilities.
|
protected void |
doNotUseTristateCorrection() |
static int |
findFirstPositionWhereHaplotypesDiffer(byte[] haplotype1,
byte[] haplotype2)
Compute the first position at which two haplotypes differ
If the haplotypes are exact copies of each other, returns the min length of the two haplotypes.
|
double[] |
getLogLikelihoodArray()
Return the results of the computeLogLikelihoods function
|
void |
initialize(int readMaxLength,
int haplotypeMaxLength)
Initialize this PairHMM, making it suitable to run against a read and haplotype with given lengths
Note: Do not worry about padding, just provide the true max length of the read and haplotype.
|
void |
initialize(java.util.List<Haplotype> haplotypes,
java.util.Map<java.lang.String,java.util.List<GATKRead>> perSampleReadList,
int readMaxLength,
int haplotypeMaxLength)
Initialize this PairHMM, making it suitable to run against a read and haplotype with given lengths
This function is used by the JNI implementations to transfer all data once to the native code
|
protected abstract double |
subComputeReadLikelihoodGivenHaplotypeLog10(byte[] haplotypeBases,
byte[] readBases,
byte[] readQuals,
byte[] insertionGOP,
byte[] deletionGOP,
byte[] overallGCP,
int hapStartIndex,
boolean recacheReadValues,
int nextHapStartIndex)
To be implemented by subclasses to do calculation for #computeReadLikelihoodGivenHaplotypeLog10
|
protected static final org.apache.logging.log4j.Logger logger
public static final byte BASE_QUALITY_SCORE_THRESHOLD
protected boolean constantsAreInitialized
protected byte[] previousHaplotypeBases
protected int hapStartIndex
protected int maxHaplotypeLength
protected int maxReadLength
protected int paddedMaxReadLength
protected int paddedMaxHaplotypeLength
protected int paddedReadLength
protected int paddedHaplotypeLength
protected boolean initialized
protected boolean doNotUseTristateCorrection
protected double[] mLogLikelihoodArray
protected static java.lang.Boolean doProfiling
protected static long pairHMMComputeTime
protected long threadLocalPairHMMComputeTimeDiff
protected long startTime
protected void doNotUseTristateCorrection()
public void initialize(int readMaxLength, int haplotypeMaxLength) throws java.lang.IllegalArgumentException
haplotypeMaxLength
- the max length of haplotypes we want to use with this PairHMMreadMaxLength
- the max length of reads we want to use with this PairHMMjava.lang.IllegalArgumentException
- if readMaxLength or haplotypeMaxLength is less than or equal to zeropublic void initialize(java.util.List<Haplotype> haplotypes, java.util.Map<java.lang.String,java.util.List<GATKRead>> perSampleReadList, int readMaxLength, int haplotypeMaxLength)
haplotypes
- the list of haplotypesperSampleReadList
- map from sample name to list of readshaplotypeMaxLength
- the max length of haplotypes we want to use with this PairHMMreadMaxLength
- the max length of reads we want to use with this PairHMMpublic void computeLog10Likelihoods(LikelihoodMatrix<Haplotype> logLikelihoods, java.util.List<GATKRead> processedReads, java.util.Map<GATKRead,byte[]> gcp)
processedReads
- reads to analyze instead of the ones present in the destination read-likelihoods.logLikelihoods
- where to store the log likelihoods where position [a][r] is reserved for the log likelihood of reads[r]
conditional to alleles[a]
.gcp
- penalty for gap continuations base array map for processed reads.protected abstract double subComputeReadLikelihoodGivenHaplotypeLog10(byte[] haplotypeBases, byte[] readBases, byte[] readQuals, byte[] insertionGOP, byte[] deletionGOP, byte[] overallGCP, int hapStartIndex, boolean recacheReadValues, int nextHapStartIndex)
public static int findFirstPositionWhereHaplotypesDiffer(byte[] haplotype1, byte[] haplotype2) throws java.lang.IllegalArgumentException
haplotype1
- the first haplotype1haplotype2
- the second haplotype1java.lang.IllegalArgumentException
- if haplotype1 or haplotype2 are null or zero lengthpublic double[] getLogLikelihoodArray()
public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable