Fix for potential HaplotypeCaller bug in annotation ordering
-- Annotations were being called on VariantContext that might needed to be trimmed. Simply inverted the order of operations so trimming occurs before the annotations are added. -- Minor cleanup of call to PairHMM in LikelihoodCalculationEngine
This commit is contained in:
parent
559a4bc05d
commit
a783f19ab1
|
|
@ -273,16 +273,19 @@ public class GenotypingEngine {
|
||||||
final Map<String, PerReadAlleleLikelihoodMap> alleleReadMap_annotations = ( USE_FILTERED_READ_MAP_FOR_ANNOTATIONS ? alleleReadMap :
|
final Map<String, PerReadAlleleLikelihoodMap> alleleReadMap_annotations = ( USE_FILTERED_READ_MAP_FOR_ANNOTATIONS ? alleleReadMap :
|
||||||
convertHaplotypeReadMapToAlleleReadMap( haplotypeReadMap, alleleMapper, 0.0, UG_engine.getUAC().contaminationLog ) );
|
convertHaplotypeReadMapToAlleleReadMap( haplotypeReadMap, alleleMapper, 0.0, UG_engine.getUAC().contaminationLog ) );
|
||||||
final Map<String, PerReadAlleleLikelihoodMap> stratifiedReadMap = filterToOnlyOverlappingReads( genomeLocParser, alleleReadMap_annotations, perSampleFilteredReadList, call );
|
final Map<String, PerReadAlleleLikelihoodMap> stratifiedReadMap = filterToOnlyOverlappingReads( genomeLocParser, alleleReadMap_annotations, perSampleFilteredReadList, call );
|
||||||
VariantContext annotatedCall = annotationEngine.annotateContext(stratifiedReadMap, call);
|
|
||||||
|
VariantContext annotatedCall = call;
|
||||||
|
// TODO -- should be before annotated call, so that QDL works correctly
|
||||||
|
if( annotatedCall.getAlleles().size() != mergedVC.getAlleles().size() ) { // some alleles were removed so reverseTrimming might be necessary!
|
||||||
|
annotatedCall = GATKVariantContextUtils.reverseTrimAlleles(annotatedCall);
|
||||||
|
}
|
||||||
|
|
||||||
|
annotatedCall = annotationEngine.annotateContext(stratifiedReadMap, annotatedCall);
|
||||||
|
|
||||||
// maintain the set of all called haplotypes
|
// maintain the set of all called haplotypes
|
||||||
for ( final Allele calledAllele : call.getAlleles() )
|
for ( final Allele calledAllele : call.getAlleles() )
|
||||||
calledHaplotypes.addAll(alleleMapper.get(calledAllele));
|
calledHaplotypes.addAll(alleleMapper.get(calledAllele));
|
||||||
|
|
||||||
if( annotatedCall.getAlleles().size() != mergedVC.getAlleles().size() ) { // some alleles were removed so reverseTrimming might be necessary!
|
|
||||||
annotatedCall = GATKVariantContextUtils.reverseTrimAlleles(annotatedCall);
|
|
||||||
}
|
|
||||||
|
|
||||||
returnCalls.add( annotatedCall );
|
returnCalls.add( annotatedCall );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -151,9 +151,12 @@ public class LikelihoodCalculationEngine {
|
||||||
final int haplotypeStart = ( previousHaplotypeSeen == null ? 0 : PairHMM.findFirstPositionWhereHaplotypesDiffer(haplotype.getBases(), previousHaplotypeSeen.getBases()) );
|
final int haplotypeStart = ( previousHaplotypeSeen == null ? 0 : PairHMM.findFirstPositionWhereHaplotypesDiffer(haplotype.getBases(), previousHaplotypeSeen.getBases()) );
|
||||||
previousHaplotypeSeen = haplotype;
|
previousHaplotypeSeen = haplotype;
|
||||||
|
|
||||||
perReadAlleleLikelihoodMap.add(read, alleleVersions.get(haplotype),
|
final boolean isFirstHaplotype = jjj == 0;
|
||||||
pairHMM.computeReadLikelihoodGivenHaplotypeLog10(haplotype.getBases(), read.getReadBases(),
|
final double log10l = pairHMM.computeReadLikelihoodGivenHaplotypeLog10(haplotype.getBases(),
|
||||||
readQuals, readInsQuals, readDelQuals, overallGCP, haplotypeStart, jjj == 0));
|
read.getReadBases(), readQuals, readInsQuals, readDelQuals,
|
||||||
|
overallGCP, haplotypeStart, isFirstHaplotype);
|
||||||
|
|
||||||
|
perReadAlleleLikelihoodMap.add(read, alleleVersions.get(haplotype), log10l);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return perReadAlleleLikelihoodMap;
|
return perReadAlleleLikelihoodMap;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue