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;
}
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());
}
Aggregations