Search in sources :

Example 1 with GCProfile

use of com.hartwig.hmftools.common.gc.GCProfile 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 GCProfile

use of com.hartwig.hmftools.common.gc.GCProfile in project hmftools by hartwigmedical.

the class GCAccumulatorTest method testExcludeFromBothEnds.

@Test
public void testExcludeFromBothEnds() {
    final GenomeRegion region = GenomeRegionFactory.create(CHROMOSOME, 1100, 2999);
    final GCAccumulator victim = new GCAccumulator(region);
    final GenomeRegionSelector<GCProfile> selector = selector(profile(1001, 0.90), profile(2001, 0.91));
    selector.select(region, victim);
    assertEquals(0, victim.averageGCContent(), EPSILON);
}
Also used : GenomeRegion(com.hartwig.hmftools.common.region.GenomeRegion) ImmutableGCProfile(com.hartwig.hmftools.common.gc.ImmutableGCProfile) GCProfile(com.hartwig.hmftools.common.gc.GCProfile) Test(org.junit.Test)

Example 3 with GCProfile

use of com.hartwig.hmftools.common.gc.GCProfile in project hmftools by hartwigmedical.

the class GCAccumulatorTest method testStandard.

@Test
public void testStandard() {
    final GenomeRegion region = GenomeRegionFactory.create(CHROMOSOME, 1001, 10000);
    final GCAccumulator victim = new GCAccumulator(region);
    final GenomeRegionSelector<GCProfile> selector = selector(profile(1001, 0.30), profile(4001, 0.31), profile(9001, 0.35));
    selector.select(region, victim);
    assertEquals(0.32, victim.averageGCContent(), EPSILON);
}
Also used : GenomeRegion(com.hartwig.hmftools.common.region.GenomeRegion) ImmutableGCProfile(com.hartwig.hmftools.common.gc.ImmutableGCProfile) GCProfile(com.hartwig.hmftools.common.gc.GCProfile) Test(org.junit.Test)

Example 4 with GCProfile

use of com.hartwig.hmftools.common.gc.GCProfile in project hmftools by hartwigmedical.

the class GCAccumulatorTest method testExcludeOverlapFromEnd.

@Test
public void testExcludeOverlapFromEnd() {
    final GenomeRegion region = GenomeRegionFactory.create(CHROMOSOME, 1001, 2999);
    final GCAccumulator victim = new GCAccumulator(region);
    final GenomeRegionSelector<GCProfile> selector = selector(profile(1001, 0.90), profile(2001, 0.91));
    selector.select(region, victim);
    assertEquals(0.90, victim.averageGCContent(), EPSILON);
}
Also used : GenomeRegion(com.hartwig.hmftools.common.region.GenomeRegion) ImmutableGCProfile(com.hartwig.hmftools.common.gc.ImmutableGCProfile) GCProfile(com.hartwig.hmftools.common.gc.GCProfile) Test(org.junit.Test)

Example 5 with GCProfile

use of com.hartwig.hmftools.common.gc.GCProfile in project hmftools by hartwigmedical.

the class GCAccumulatorTest method testExcludeUnmappable.

@Test
public void testExcludeUnmappable() {
    final GenomeRegion region = GenomeRegionFactory.create(CHROMOSOME, 1001, 3000);
    final GCAccumulator victim = new GCAccumulator(region);
    final GenomeRegionSelector<GCProfile> selector = selector(profile(1001, 0.90), unmappableProfile(2001, 0.91));
    selector.select(region, victim);
    assertEquals(0.90, victim.averageGCContent(), EPSILON);
}
Also used : GenomeRegion(com.hartwig.hmftools.common.region.GenomeRegion) ImmutableGCProfile(com.hartwig.hmftools.common.gc.ImmutableGCProfile) GCProfile(com.hartwig.hmftools.common.gc.GCProfile) Test(org.junit.Test)

Aggregations

GCProfile (com.hartwig.hmftools.common.gc.GCProfile)6 ImmutableGCProfile (com.hartwig.hmftools.common.gc.ImmutableGCProfile)5 GenomeRegion (com.hartwig.hmftools.common.region.GenomeRegion)5 Test (org.junit.Test)5 AmberBAF (com.hartwig.hmftools.common.amber.AmberBAF)1 CobaltRatio (com.hartwig.hmftools.common.cobalt.CobaltRatio)1 PurpleSegment (com.hartwig.hmftools.common.purple.segment.PurpleSegment)1 NotNull (org.jetbrains.annotations.NotNull)1