use of com.hartwig.hmftools.common.window.Window in project hmftools by hartwigmedical.
the class PCFFile method readPositions.
@NotNull
public static ListMultimap<String, PCFPosition> readPositions(int windowSize, @NotNull PCFSource source, @NotNull final String filename) throws IOException {
ListMultimap<String, PCFPosition> result = ArrayListMultimap.create();
final Window window = new Window(windowSize);
long end = 0;
for (String line : Files.readAllLines(new File(filename).toPath())) {
if (!line.startsWith(HEADER_PREFIX)) {
String[] values = line.split(DELIMITER);
final String chromosomeName = values[1];
long start = window.start(Long.valueOf(values[3]));
if (start != end) {
result.put(chromosomeName, position(chromosomeName, start, source));
}
end = window.start(Long.valueOf(values[4])) + windowSize;
result.put(chromosomeName, position(chromosomeName, end, source));
}
}
return result;
}
use of com.hartwig.hmftools.common.window.Window 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;
}
Aggregations