TumorBAFFactory { void addEvidence(@NotNull final ModifiableTumorBAF evidence, @NotNull final SAMRecord samRecord) { int quality = getBaseQuality(evidence, samRecord); if (quality >= minBaseQuality) { evidence.setTumorReadDepth(evidence.tumorReadDepth() + 1); int bafPosition = (int) evidence.position(); int readPosition = samRecord.getReadPositionAtReferencePosition(bafPosition); if (readPosition != 0) { if (!indel(bafPosition, readPosition, samRecord)) { final String base = String.valueOf(samRecord.getReadString().charAt(readPosition - 1)); if (base.equals(evidence.ref())) { evidence.setTumorRefSupport(evidence.tumorRefSupport() + 1); } else if (base.equals(evidence.alt())) { evidence.setTumorAltSupport(evidence.tumorAltSupport() + 1); evidence.setTumorAltQuality(evidence.tumorAltQuality() + quality); } } else { evidence.setTumorIndelCount(evidence.tumorIndelCount() + 1); } } } } TumorBAFFactory(final int minBaseQuality); @NotNull static ModifiableTumorBAF create(@NotNull final BaseDepth normal);  }
@Test public void useQualityOfBaseAfterDel() { int minQuality = SAMRecords.getBaseQuality('J'); final SAMRecord lowQualDel = SAMRecordsTest.buildSamRecord(1000, "1M1D1M", "CT", "FI"); final SAMRecord highQualDel = SAMRecordsTest.buildSamRecord(1000, "1M1D1M", "CT", "FJ"); final ModifiableTumorBAF victim = createDefault("5", 1001); new TumorBAFFactory(minQuality).addEvidence(victim, lowQualDel); assertEquals(0, victim.tumorReadDepth()); new TumorBAFFactory(minQuality).addEvidence(victim, highQualDel); assertEquals(1, victim.tumorReadDepth()); }