Package htsjdk.samtools
Class Bin
- java.lang.Object
-
- htsjdk.samtools.Bin
-
- All Implemented Interfaces:
Comparable<Bin>
- Direct Known Subclasses:
BinWithOffset
public class Bin extends Object implements Comparable<Bin>
An individual bin in a BAM file.
-
-
Constructor Summary
Constructors Constructor Description Bin(int referenceSequence, int binNumber)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddChunk(Chunk newChunk)Adds a chunk to the bin (may be the first chunk or a later one).voidaddInitialChunk(Chunk newChunk)Adds the first chunk to the binintcompareTo(Bin other)Compare two bins to see what ordering they should appear in.booleancontainsChunks()Returns whether the bin currently contains chunks.booleanequals(Object other)See whether two bins are equal.intgetBinNumber()List<Chunk>getChunkList()Gets the list of chunks associated with this bin.ChunkgetLastChunk()Warning: Currently only valid during index building, not when reading existing index, (AbstractBAMFileIndex.optimizeChunkList doesn't maintain this)protected intgetReferenceSequence()inthashCode()Compute a unique hash code for the given reference sequence and bin number.voidsetChunkList(List<Chunk> list)Sets the chunks associated with this binvoidsetLastChunk(Chunk c)Optimization to keep lastChunk instead of iterating over all chunks repeatedly
-
-
-
Method Detail
-
getReferenceSequence
protected int getReferenceSequence()
-
getBinNumber
public int getBinNumber()
-
equals
public boolean equals(Object other)
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
public int compareTo(Bin other)
Compare two bins to see what ordering they should appear in.- Specified by:
compareToin 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
public void addInitialChunk(Chunk newChunk)
Adds the first chunk to the bin
-
addChunk
public void addChunk(Chunk newChunk)
Adds a chunk to the bin (may be the first chunk or a later one).- Parameters:
newChunk- the chunk to add
-
getChunkList
public List<Chunk> 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
public void setLastChunk(Chunk c)
Optimization to keep lastChunk instead of iterating over all chunks repeatedly
-
getLastChunk
public Chunk 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
-
-