Пример #1
0
 private boolean overlaps(SAMRecord r) {
   if (intervals == null
       || (r.getReadUnmappedFlag() && r.getAlignmentStart() == SAMRecord.NO_ALIGNMENT_START)) {
     return true;
   }
   if (r.getReadUnmappedFlag()) { // special case for unmapped reads with coordinate set
     for (Locatable interval : intervals) {
       if (interval.getStart() <= r.getStart() && interval.getEnd() >= r.getStart()) {
         // This follows the behavior of htsjdk's SamReader which states that
         // "an unmapped read will be returned by this call if it has a coordinate for
         // the purpose of sorting that is in the query region".
         return true;
       }
     }
   }
   final Interval interval = new Interval(r.getContig(), r.getStart(), r.getEnd());
   Collection<Interval> overlaps = overlapDetector.getOverlaps(interval);
   return !overlaps.isEmpty();
 }