# Class DiskBasedBAMFileIndex

java.lang.Object
htsjdk.samtools.AbstractBAMFileIndex
htsjdk.samtools.DiskBasedBAMFileIndex

All Implemented Interfaces:
  `BAMIndex, Closeable, AutoCloseable`

public class DiskBasedBAMFileIndex extends AbstractBAMFileIndex
A class for reading BAM file indices, hitting the disk once per query.

## Field Summary

### Fields inherited from interface BAMIndex

`BAI_INDEX_SUFFIX, BAMIndexSuffix, CSI_INDEX_SUFFIX`

## Constructor Summary

Constructors
Constructor
Description
`DiskBasedBAMFileIndex(SeekableStream stream, SAMSequenceDictionary dictionary)`
`DiskBasedBAMFileIndex(File file, SAMSequenceDictionary dictionary)`
`DiskBasedBAMFileIndex(File file, SAMSequenceDictionary dictionary, boolean useMemoryMapping)`

## Method Summary

Modifier and Type
Method
Description
`protected htsjdk.samtools.BAMIndexContent`
`getQueryResults(int reference)`
`BAMFileSpan`
`getSpanOverlapping(int referenceIndex, int startPos, int endPos)`
Get list of regions of BAM file that may contain SAMRecords for the given range

### Methods inherited from class AbstractBAMFileIndex

`close, getBamDictionary, getFirstBinInLevel, getFirstLocusInBin, getLastLocusInBin, getLevelForBin, getLevelSize, getMaxAddressibleGenomicLocation, getMetaData, getNoCoordinateCount, getNumberOfReferences, getNumIndexLevels, getStartOfLastLinearBin, initParameters, optimizeChunkList, position, query, readBytes, readChunks, readInteger, readLong, regionToBins, seek, setSequenceIndexes, skipBytes, skipToSequence, verifyIndexMagicNumber`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### DiskBasedBAMFileIndex

public DiskBasedBAMFileIndex(File file, SAMSequenceDictionary dictionary)

### DiskBasedBAMFileIndex

public DiskBasedBAMFileIndex(SeekableStream stream, SAMSequenceDictionary dictionary)

### DiskBasedBAMFileIndex

public DiskBasedBAMFileIndex(File file, SAMSequenceDictionary dictionary, boolean useMemoryMapping)

## Method Details

### getSpanOverlapping

public BAMFileSpan getSpanOverlapping(int referenceIndex, int startPos, int endPos)
Get list of regions of BAM file that may contain SAMRecords for the given range

Parameters:
  `referenceIndex` - sequence of desired SAMRecords
  `startPos` - 1-based start of the desired interval, inclusive
  `endPos` - 1-based end of the desired interval, inclusive
Returns:
  array of pairs of virtual file positions. Each pair is the first and last virtual file position in a range that can be scanned to find SAMRecords that overlap the given positions. The last position in each pair is a virtual file pointer to the first SAMRecord beyond the range that may contain the indicated SAMRecords.

### getQueryResults

protected htsjdk.samtools.BAMIndexContent getQueryResults(int reference)

Specified by:
  `getQueryResults` in class `AbstractBAMFileIndex`