Package htsjdk.samtools
Class Bin
java.lang.Object
htsjdk.samtools.Bin
- All Implemented Interfaces:
Comparable<Bin>
- Direct Known Subclasses:
BinWithOffset
An individual bin in a BAM file.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a chunk to the bin (may be the first chunk or a later one).void
addInitialChunk
(Chunk newChunk) Adds the first chunk to the binint
Compare two bins to see what ordering they should appear in.boolean
Returns whether the bin currently contains chunks.boolean
See whether two bins are equal.int
Gets the list of chunks associated with this bin.Warning: Currently only valid during index building, not when reading existing index, (AbstractBAMFileIndex.optimizeChunkList doesn't maintain this)protected int
int
hashCode()
Compute a unique hash code for the given reference sequence and bin number.void
setChunkList
(List<Chunk> list) Sets the chunks associated with this binvoid
Optimization to keep lastChunk instead of iterating over all chunks repeatedly
-
Constructor Details
-
Bin
public Bin(int referenceSequence, int binNumber)
-
-
Method Details
-
getReferenceSequence
protected int getReferenceSequence() -
getBinNumber
public int getBinNumber() -
equals
See whether two bins are equal. If the ref seq and the bin number are equal, assume equality of the chunk list. -
hashCode
public int hashCode()Compute a unique hash code for the given reference sequence and bin number. -
containsChunks
public boolean containsChunks()Returns whether the bin currently contains chunks.- Returns:
- True if the bin has chunks, false otherwise.
-
compareTo
Compare two bins to see what ordering they should appear in.- Specified by:
compareTo
in interfaceComparable<Bin>
- Parameters:
other
- Other bin to which this bin should be compared.- Returns:
- -1 if this < other, 0 if this == other, 1 if this > other.
-
addInitialChunk
Adds the first chunk to the bin -
addChunk
Adds a chunk to the bin (may be the first chunk or a later one).- Parameters:
newChunk
- the chunk to add
-
setChunkList
Sets the chunks associated with this bin -
getChunkList
Gets the list of chunks associated with this bin.- Returns:
- the chunks in this bin. If no chunks are associated, an empty list will be returned.
-
setLastChunk
Optimization to keep lastChunk instead of iterating over all chunks repeatedly -
getLastChunk
Warning: Currently only valid during index building, not when reading existing index, (AbstractBAMFileIndex.optimizeChunkList doesn't maintain this)- Returns:
- the last Chunk of the chunkList
-