use of com.hartwig.hmftools.common.pileup.Pileup in project hmftools by hartwigmedical.
the class BAFFactory method create.
@NotNull
List<AmberBAF> create(@NotNull final List<Pileup> normalPileup, @NotNull final List<Pileup> tumorPileup) {
final GenomePositionSelector<Pileup> tumorSelector = GenomePositionSelectorFactory.create(tumorPileup);
int medianDepth = medianReadCount(normalPileup);
int minDepth = (int) Math.round(medianDepth * minDepthPercentage);
int maxDepth = (int) Math.round(medianDepth * maxDepthPercentage);
final List<AmberBAF> result = Lists.newArrayList();
for (Pileup normal : normalPileup) {
final int readCount = normal.readCount();
final int altCount = maxMismatchReadCount(normal);
if (isValidPileup(normal) && between(readCount, minDepth, maxDepth) && isHeterozygousRef(normal.referenceCount(), readCount) && isHeterozygousAlt(altCount, readCount)) {
final Character alt = alt(altCount, normal);
tumorSelector.select(normal).filter(BAFFactory::isValidPileup).map(x -> create(alt, normal, x)).filter(BAFFactory::isValidBAF).ifPresent(result::add);
}
}
return result;
}
use of com.hartwig.hmftools.common.pileup.Pileup in project hmftools by hartwigmedical.
the class BAFFactoryTest method testNoTumorReadCount.
@Test
public void testNoTumorReadCount() {
final Pileup tumor = PileupFile.fromString("seq2\t156\tA\t0\t*\t*");
final List<AmberBAF> result = VICTIM.create(Collections.singletonList(GOOD_NORMAL), Collections.singletonList(tumor));
assertEquals(0, result.size());
}
use of com.hartwig.hmftools.common.pileup.Pileup in project hmftools by hartwigmedical.
the class BAFFactoryTest method testDepths.
@Test
public void testDepths() {
final Pileup normal = PileupFile.fromString("seq2\t156\tA\t11\t.$......+2AG.+2AG.+2AGGG\t<975;:<<<<<");
final Pileup tumor = PileupFile.fromString("seq2\t156\tA\t31\t.$......+2AG.+2AG.+2AGGG\t<975;:<<<<<");
assertNotEquals(normal.readCount(), tumor.readCount());
final AmberBAF victim = BAFFactory.create('A', normal, tumor);
assertEquals(normal.readCount(), victim.normalDepth());
assertEquals(tumor.readCount(), victim.tumorDepth());
}
use of com.hartwig.hmftools.common.pileup.Pileup in project hmftools by hartwigmedical.
the class BAFFactoryTest method testWorking.
@Test
public void testWorking() {
final Pileup tumor = PileupFile.fromString("seq2\t156\tA\t10\t.GGGGGGGGG\t<975;:<<<<<");
final List<AmberBAF> result = VICTIM.create(Collections.singletonList(GOOD_NORMAL), Collections.singletonList(tumor));
assertEquals(1, result.size());
AmberBAF baf = result.get(0);
assertEquals(10, baf.normalDepth());
assertEquals(0.5, baf.normalBAF(), EPSILON);
assertEquals(10, baf.tumorDepth());
assertEquals(0.9, baf.tumorBAF(), EPSILON);
}
use of com.hartwig.hmftools.common.pileup.Pileup in project hmftools by hartwigmedical.
the class BAFFactoryTest method testInvalidBAF.
@Test
public void testInvalidBAF() {
final Pileup tumor = PileupFile.fromString("seq2\t156\tA\t10\tCCCCCCCCCC\t*");
final List<AmberBAF> result = VICTIM.create(Collections.singletonList(GOOD_NORMAL), Collections.singletonList(tumor));
assertEquals(0, result.size());
}
Aggregations