Search in sources :

Example 1 with PurpleSegment

use of com.hartwig.hmftools.common.purple.segment.PurpleSegment 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)

Aggregations

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