private AbstractSequence cutRegion( AbstractSequence s, BlastAnalysis.Result blastResult, BlastAnalysis.Region region) { int rs = Math.max(0, region.getBegin() - blastResult.getStart()); int re = Math.min(s.getLength(), s.getLength() - (blastResult.getEnd() - region.getEnd())); AbstractSequence s2 = re > rs ? new SubSequence(s.getName(), s.getDescription(), s, rs, re) : s; return s2; }
private List<Region> findOverlappingRegions(Result blastResult) { List<Region> result = new ArrayList<Region>(); for (BlastAnalysis.Region region : blastResult.getReference().getRegions()) if (region.overlaps(blastResult.getStart(), blastResult.getEnd(), MINIMUM_REGION_OVERLAP)) result.add(region); return result; }