Search in sources :

Example 1 with PCFPosition

use of com.hartwig.hmftools.common.pcf.PCFPosition in project hmftools by hartwigmedical.

the class PurpleSegmentFactory method create.

@NotNull
@VisibleForTesting
static List<PurpleSegment> create(@NotNull final ChromosomeLength chromosome, @NotNull final Collection<Cluster> clusters) {
    final List<PurpleSegment> result = Lists.newArrayList();
    ModifiablePurpleSegment segment = create(chromosome.chromosome(), 1).setSupport(SegmentSupport.TELOMERE);
    for (final Cluster cluster : clusters) {
        boolean ratioSupport = !cluster.ratios().isEmpty();
        final List<ClusterVariantLeg> variants = cluster.variants();
        if (!variants.isEmpty()) {
            for (final ClusterVariantLeg variant : variants) {
                if (variant.position() != segment.start()) {
                    result.add(updatedStatusForCentromere(segment.setEnd(variant.position() - 1)));
                    segment = createFromCluster(cluster, variant, ratioSupport);
                } else {
                    segment.setSupport(SegmentSupport.MULTIPLE);
                }
            }
            segment.setSvCluster(false);
        } else {
            final List<PCFPosition> pcfPositions = cluster.pcfPositions();
            // JOBA: DO FIRST
            final GenomePosition firstRatioBreak = pcfPositions.get(0);
            result.add(updatedStatusForCentromere(segment.setEnd(firstRatioBreak.position() - 1)));
            segment = create(firstRatioBreak.chromosome(), firstRatioBreak.position());
        }
    }
    result.add(segment.setEnd(chromosome.length()));
    return result;
}
Also used : GenomePosition(com.hartwig.hmftools.common.position.GenomePosition) PCFPosition(com.hartwig.hmftools.common.pcf.PCFPosition) VisibleForTesting(com.google.common.annotations.VisibleForTesting) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with PCFPosition

use of com.hartwig.hmftools.common.pcf.PCFPosition in project hmftools by hartwigmedical.

the class PCFPositionsSupplier method centromeres.

@NotNull
private static Multimap<String, PCFPosition> centromeres(int windowSize) {
    final Window window = new Window(windowSize);
    final Multimap<String, PCFPosition> result = ArrayListMultimap.create();
    for (final Map.Entry<String, GenomeRegion> entry : Centromeres.grch37().entrySet()) {
        final GenomeRegion centromere = entry.getValue();
        result.put(entry.getKey(), create(centromere.chromosome(), window.start(centromere.start())));
        result.put(entry.getKey(), create(centromere.chromosome(), window.start(centromere.end()) + windowSize));
    }
    return result;
}
Also used : Window(com.hartwig.hmftools.common.window.Window) GenomeRegion(com.hartwig.hmftools.common.region.GenomeRegion) Map(java.util.Map) ImmutablePCFPosition(com.hartwig.hmftools.common.pcf.ImmutablePCFPosition) PCFPosition(com.hartwig.hmftools.common.pcf.PCFPosition) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

PCFPosition (com.hartwig.hmftools.common.pcf.PCFPosition)2 NotNull (org.jetbrains.annotations.NotNull)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 ImmutablePCFPosition (com.hartwig.hmftools.common.pcf.ImmutablePCFPosition)1 GenomePosition (com.hartwig.hmftools.common.position.GenomePosition)1 GenomeRegion (com.hartwig.hmftools.common.region.GenomeRegion)1 Window (com.hartwig.hmftools.common.window.Window)1 Map (java.util.Map)1