Make computeConsensusAlleles protected inside IndelGenotypeLikelihoodsCalculationModel so we can use it in unit tests, b) make ConsensusAlleleCounter work if no extended event pileup is present (necessary for ext. event removal)

This commit is contained in:
Guillermo del Angel 2012-03-28 15:41:39 -04:00
parent d2586911a4
commit 1eee9d512d
2 changed files with 18 additions and 4 deletions

View File

@ -33,7 +33,9 @@ import org.broadinstitute.sting.utils.GenomeLocParser;
import org.broadinstitute.sting.utils.clipping.ReadClipper;
import org.broadinstitute.sting.utils.collections.Pair;
import org.broadinstitute.sting.utils.pileup.ExtendedEventPileupElement;
import org.broadinstitute.sting.utils.pileup.PileupElement;
import org.broadinstitute.sting.utils.pileup.ReadBackedExtendedEventPileup;
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
import org.broadinstitute.sting.utils.sam.GATKSAMRecord;
import org.broadinstitute.sting.utils.sam.ReadUtils;
import org.broadinstitute.sting.utils.variantcontext.Allele;
@ -101,9 +103,21 @@ public class ConsensusAlleleCounter {
for (Map.Entry<String, AlignmentContext> sample : contexts.entrySet()) {
AlignmentContext context = AlignmentContextUtils.stratify(sample.getValue(), contextType);
final ReadBackedExtendedEventPileup indelPileup = context.getExtendedEventPileup();
insCount += indelPileup.getNumberOfInsertions();
delCount += indelPileup.getNumberOfDeletions();
if (context.hasExtendedEventPileup()) {
final ReadBackedExtendedEventPileup indelPileup = context.getExtendedEventPileup();
insCount += indelPileup.getNumberOfInsertions();
delCount += indelPileup.getNumberOfDeletions();
}
else {
// todo - this should be version to be used when extended events are removed
// todo - maybe we should create utility functions in ReadBackedPileup definition to do the equivalent thing?
for (PileupElement p: context.getBasePileup()) {
if (p.isBeforeDeletion())
delCount++;
else if (p.isBeforeInsertion())
insCount++;
}
}
}
if (insCount < minIndelCountForGenotyping && delCount < minIndelCountForGenotyping)

View File

@ -88,7 +88,7 @@ public class IndelGenotypeLikelihoodsCalculationModel extends GenotypeLikelihood
ignoreSNPAllelesWhenGenotypingIndels = UAC.IGNORE_SNP_ALLELES;
}
private List<Allele> computeConsensusAlleles(ReferenceContext ref,
protected List<Allele> computeConsensusAlleles(ReferenceContext ref,
Map<String, AlignmentContext> contexts,
AlignmentContextUtils.ReadOrientation contextType,
GenomeLocParser locParser) {