/** * Returns true if any of the file spans in this FilePointer overlap their counterparts in * the other FilePointer. "Overlap" is defined as having an overlapping extent (the region * from the start of the first chunk to the end of the last chunk). * * @param other the FilePointer against which to check overlap with this FilePointer * @return true if any file spans overlap their counterparts in other, otherwise false */ public boolean hasFileSpansOverlappingWith( FilePointer other ) { for ( Map.Entry<SAMReaderID, SAMFileSpan> thisFilePointerEntry : fileSpans.entrySet() ) { GATKBAMFileSpan thisFileSpan = new GATKBAMFileSpan(thisFilePointerEntry.getValue()); SAMFileSpan otherEntry = other.fileSpans.get(thisFilePointerEntry.getKey()); if ( otherEntry == null ) { continue; // no counterpart for this file span in other } GATKBAMFileSpan otherFileSpan = new GATKBAMFileSpan(otherEntry); if ( thisFileSpan.getExtent().overlaps(otherFileSpan.getExtent()) ) { return true; } } return false; }
(currentChunk.overlaps(unmergedUnion.peek()) || currentChunk.isAdjacentTo(unmergedUnion.peek())) ) {
private List<GATKChunk> optimizeChunkList(final List<GATKChunk> chunks, final long minimumOffset) { GATKChunk lastChunk = null; Collections.sort(chunks); final List<GATKChunk> result = new ArrayList<GATKChunk>(); for (final GATKChunk chunk : chunks) { if (chunk.getChunkEnd() <= minimumOffset) { continue; // linear index optimization } if (result.isEmpty()) { result.add(chunk); lastChunk = chunk; continue; } // Coalesce chunks that are in adjacent file blocks. // This is a performance optimization. if (!lastChunk.overlaps(chunk) && !lastChunk.isAdjacentTo(chunk)) { result.add(chunk); lastChunk = chunk; } else { if (chunk.getChunkEnd() > lastChunk.getChunkEnd()) { lastChunk.setChunkEnd(chunk.getChunkEnd()); } } } return result; }
if(thisChunk.overlaps(otherChunk)) {
if(thisChunk.overlaps(otherChunk)) {