Search in sources :

Example 1 with CobaltRatio

use of com.hartwig.hmftools.common.cobalt.CobaltRatio in project hmftools by hartwigmedical.

the class ObservedRegionFactory method combine.

@NotNull
public List<ObservedRegion> combine(@NotNull final List<PurpleSegment> regions, @NotNull final Multimap<String, AmberBAF> bafs, @NotNull final Multimap<String, CobaltRatio> ratios, @NotNull final Multimap<String, GCProfile> gcProfiles) {
    final List<ObservedRegion> result = Lists.newArrayList();
    final GenomePositionSelector<CobaltRatio> cobaltSelector = GenomePositionSelectorFactory.create(ratios);
    final GenomePositionSelector<AmberBAF> bafSelector = GenomePositionSelectorFactory.create(bafs);
    final GenomeRegionSelector<GCProfile> gcSelector = GenomeRegionSelectorFactory.create(gcProfiles);
    for (final PurpleSegment region : regions) {
        final BAFAccumulator baf = new BAFAccumulator();
        final CobaltAccumulator cobalt = new CobaltAccumulator(windowSize, region);
        final GCAccumulator gc = new GCAccumulator(region);
        bafSelector.select(region, baf);
        cobaltSelector.select(region, cobalt);
        gcSelector.select(region, gc);
        double tumorRatio = cobalt.tumorMeanRatio();
        double normalRatio = cobalt.referenceMeanRatio();
        final EnrichedRegion copyNumber = ImmutableEnrichedRegion.builder().from(region).bafCount(baf.count()).observedBAF(baf.medianBaf()).observedTumorRatio(tumorRatio).observedNormalRatio(normalRatio).ratioSupport(region.ratioSupport()).support(region.support()).observedTumorRatioCount(cobalt.tumorCount()).gcContent(gc.averageGCContent()).status(statusFactory.status(region, normalRatio, tumorRatio)).svCluster(region.svCluster()).build();
        result.add(copyNumber);
    }
    return result;
}
Also used : CobaltRatio(com.hartwig.hmftools.common.cobalt.CobaltRatio) AmberBAF(com.hartwig.hmftools.common.amber.AmberBAF) PurpleSegment(com.hartwig.hmftools.common.purple.segment.PurpleSegment) GCProfile(com.hartwig.hmftools.common.gc.GCProfile) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with CobaltRatio

use of com.hartwig.hmftools.common.cobalt.CobaltRatio in project hmftools by hartwigmedical.

the class CobaltAccumulatorTest method assertTumorCount.

private void assertTumorCount(int expectedCount, long regionStart, long regionEnd, long... ratios) {
    final GenomeRegion region = GenomeRegionFactory.create(CHROMOSOME, regionStart, regionEnd);
    final ObservedRegionFactory.CobaltAccumulator accumulator = new ObservedRegionFactory.CobaltAccumulator(WINDOW_SIZE, region);
    final GenomePositionSelector<CobaltRatio> selector = createSelector(ratios);
    selector.select(region, accumulator);
    assertEquals(expectedCount, accumulator.tumorCount());
}
Also used : CobaltRatio(com.hartwig.hmftools.common.cobalt.CobaltRatio) GenomeRegion(com.hartwig.hmftools.common.region.GenomeRegion)

Aggregations

CobaltRatio (com.hartwig.hmftools.common.cobalt.CobaltRatio)2 AmberBAF (com.hartwig.hmftools.common.amber.AmberBAF)1 GCProfile (com.hartwig.hmftools.common.gc.GCProfile)1 PurpleSegment (com.hartwig.hmftools.common.purple.segment.PurpleSegment)1 GenomeRegion (com.hartwig.hmftools.common.region.GenomeRegion)1 NotNull (org.jetbrains.annotations.NotNull)1