Prevent out of bound error in case read span > reference context + indel length. Can happen in RNAseq reads with long N CIGAR operators in the middle.
This commit is contained in:
parent
c62082ba1b
commit
32a77a8a56
|
|
@ -555,11 +555,16 @@ public class PairHMMIndelErrorModel {
|
|||
// cut haplotype bases
|
||||
long indStart = start - haplotype.getStartPosition();
|
||||
long indStop = stop - haplotype.getStartPosition();
|
||||
double readLikelihood;
|
||||
|
||||
if (indStart < 0 || indStop >= haplotype.getBasesAsBytes().length) {
|
||||
// read spanned more than allowed reference context: we currently can't deal with this
|
||||
readLikelihood =0;
|
||||
} else
|
||||
{
|
||||
final byte[] haplotypeBases = Arrays.copyOfRange(haplotype.getBasesAsBytes(),
|
||||
(int)indStart, (int)indStop);
|
||||
|
||||
double readLikelihood;
|
||||
if (matchMetricArray == null) {
|
||||
final int X_METRIC_LENGTH = readBases.length+1;
|
||||
final int Y_METRIC_LENGTH = haplotypeBases.length+1;
|
||||
|
|
@ -585,12 +590,14 @@ public class PairHMMIndelErrorModel {
|
|||
|
||||
readLikelihood = computeReadLikelihoodGivenHaplotypeAffineGaps(haplotypeBases, readBases, readQuals,
|
||||
currentContextGOP, currentContextGCP, startIdx, matchMetricArray, XMetricArray, YMetricArray);
|
||||
|
||||
if (DEBUG) {
|
||||
System.out.println("H:"+new String(haplotypeBases));
|
||||
System.out.println("R:"+new String(readBases));
|
||||
System.out.format("L:%4.2f\n",readLikelihood);
|
||||
System.out.format("StPos:%d\n", startIdx);
|
||||
}
|
||||
}
|
||||
readEl.put(a,readLikelihood);
|
||||
readLikelihoods[readIdx][j++] = readLikelihood;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue