use of com.hartwig.hmftools.common.position.GenomePosition in project hmftools by hartwigmedical.
the class GenomeRegionSelectorImpl method select.
@Override
public void select(@NotNull final GenomeRegion region, @NotNull final Consumer<R> handler) {
final GenomePosition start = GenomePositions.create(region.chromosome(), region.start());
final GenomePosition end = GenomePositions.create(region.chromosome(), region.end());
if (lastPosition != null && start.compareTo(lastPosition) < 0) {
throw new IllegalArgumentException("Selector only goes forward, never backwards!");
}
while (next != null && compare(start, next) > 0) {
next = regions.hasNext() ? this.regions.next() : null;
}
while (next != null && compare(start, next) <= 0 && compare(end, next) >= 0) {
handler.accept(next);
next = regions.hasNext() ? this.regions.next() : null;
}
lastPosition = end;
}
use of com.hartwig.hmftools.common.position.GenomePosition in project hmftools by hartwigmedical.
the class BachelorEligibility method processStructuralVariant.
private Collection<EligibilityReport> processStructuralVariant(final String patient, final GenomePosition position, final GenomePosition other, final StructuralVariantType svType) {
final List<EligibilityReport> results = Lists.newArrayList();
// TODO: can we do better than this performance wise? new map?
for (final HmfGenomeRegion region : allGenesByChromosomeMap.get(position.chromosome())) {
if (!region.contains(position)) {
continue;
}
// skip non-inversion intronic variants
if (region.contains(other) && svType != StructuralVariantType.INV) {
final int intronStart = intron(region.exome(), position);
final int intronEnd = intron(region.exome(), other);
// the variant is intronic in a gene -- we will filter it
if (intronStart >= 0 && intronStart == intronEnd) {
continue;
}
}
programs.stream().filter(p -> p.disruptionProcessor().test(region)).map(p -> ImmutableEligibilityReport.builder().patient(patient).source(SOMATIC_DISRUPTION).program(p.name()).id("").genes(region.gene()).chrom(region.chromosome()).pos(position.position()).ref("").alts("").effects("").build()).forEach(results::add);
}
return results;
}
Aggregations