Search in sources :

Example 6 with GenomeRegion

use of com.hartwig.hmftools.common.region.GenomeRegion in project hmftools by hartwigmedical.

the class FragileSiteAnnotator method loadFragileSitesFile.

public void loadFragileSitesFile(final String filename) {
    if (filename.isEmpty())
        return;
    try {
        BufferedReader fileReader = new BufferedReader(new FileReader(filename));
        String line;
        while ((line = fileReader.readLine()) != null) {
            if (line.contains("Chromosome"))
                continue;
            // parse CSV data
            String[] items = line.split(",");
            if (items.length < 7)
                continue;
            final GenomeRegion genomeRegion = GenomeRegionFactory.create(items[0], Long.parseLong(items[1]), Long.parseLong(items[2]));
            if (items[6].equals(CSV_FS_TYPE_IDENTIFIED))
                mIdentifiedFragileSites.add(genomeRegion);
            else
                mFragileSites.add(genomeRegion);
        // LOGGER.debug("loaded fragile site: chr({}) pos({}-{})",
        // genomeRegion.chromosome(), genomeRegion.start(), genomeRegion.end());
        }
        LOGGER.debug("loaded {} known fragile site records, {} identified", mFragileSites.size(), mIdentifiedFragileSites.size());
    } catch (IOException exception) {
        LOGGER.error("Failed to read fragile site CSV file({})", filename);
    }
}
Also used : GenomeRegion(com.hartwig.hmftools.common.region.GenomeRegion) BufferedReader(java.io.BufferedReader) FileReader(java.io.FileReader) IOException(java.io.IOException)

Example 7 with GenomeRegion

use of com.hartwig.hmftools.common.region.GenomeRegion 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)

Example 8 with GenomeRegion

use of com.hartwig.hmftools.common.region.GenomeRegion in project hmftools by hartwigmedical.

the class SvUtilities method getChromosomalArmLength.

public long getChromosomalArmLength(final String chromosome, final String armType) {
    final GenomeRegion region = CENTROMERES.get(chromosome);
    if (region == null)
        return 0;
    if (armType.equals(CHROMOSOME_ARM_P)) {
        return region.start();
    }
    long chrLength = CHROMOSOME_LENGTHS.get(chromosome);
    return chrLength - region.end();
}
Also used : GenomeRegion(com.hartwig.hmftools.common.region.GenomeRegion)

Example 9 with GenomeRegion

use of com.hartwig.hmftools.common.region.GenomeRegion 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)

Example 10 with GenomeRegion

use of com.hartwig.hmftools.common.region.GenomeRegion 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)

Aggregations

GenomeRegion (com.hartwig.hmftools.common.region.GenomeRegion)13 Test (org.junit.Test)6 GCProfile (com.hartwig.hmftools.common.gc.GCProfile)5 ImmutableGCProfile (com.hartwig.hmftools.common.gc.ImmutableGCProfile)5 Slicer (com.hartwig.hmftools.common.slicing.Slicer)2 SomaticVariant (com.hartwig.hmftools.common.variant.SomaticVariant)2 BufferedReader (java.io.BufferedReader)2 FileReader (java.io.FileReader)2 IOException (java.io.IOException)2 NotNull (org.jetbrains.annotations.NotNull)2 CobaltRatio (com.hartwig.hmftools.common.cobalt.CobaltRatio)1 ImmutablePCFPosition (com.hartwig.hmftools.common.pcf.ImmutablePCFPosition)1 PCFPosition (com.hartwig.hmftools.common.pcf.PCFPosition)1 PurityAdjuster (com.hartwig.hmftools.common.purple.PurityAdjuster)1 PurpleCopyNumber (com.hartwig.hmftools.common.purple.copynumber.PurpleCopyNumber)1 PurityContext (com.hartwig.hmftools.common.purple.purity.PurityContext)1 FittedRegion (com.hartwig.hmftools.common.purple.region.FittedRegion)1 HmfGenomeRegion (com.hartwig.hmftools.common.region.hmfslicer.HmfGenomeRegion)1 ImmutableHmfGenomeRegion (com.hartwig.hmftools.common.region.hmfslicer.ImmutableHmfGenomeRegion)1 ClonalityFactory (com.hartwig.hmftools.common.variant.ClonalityFactory)1