public class Slice
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static int |
EMBEDDED_REFERENCE_ABSENT_CONTENT_ID |
static int |
UNINITIALIZED_INDEXING_PARAMETER |
| Constructor and Description |
|---|
Slice(CRAMVersion cramVersion,
CompressionHeader compressionHeader,
java.io.InputStream inputStream,
long containerByteOffset)
Create a slice by reading a serialized Slice from an input stream.
|
Slice(java.util.List<CRAMCompressionRecord> records,
CompressionHeader compressionHeader,
long containerByteOffset,
long globalRecordCounter)
Create a single Slice from CRAM Compression Records and a Compression Header.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.ArrayList<CRAMCompressionRecord> |
deserializeCRAMRecords(CompressorCache compressorCache,
ValidationStringency validationStringency)
Reads and decodes the underlying blocks and returns a list of CRAMCompressionRecord.
|
AlignmentContext |
getAlignmentContext() |
java.util.List<BAIEntry> |
getBAIEntries(CompressorCache compressorCache)
Generate a BAIEntry Index entry from this Slice and other container parameters,
splitting Multiple Reference slices into constituent reference sequence entries.
|
long |
getBaseCount() |
int |
getByteOffsetOfSliceHeaderBlock()
The Slice's offset in bytes from the beginning of the Container's Compression Header
(or the end of the Container Header), equal to
ContainerHeader.getLandmarks()
Used by BAI and CRAI indexing |
int |
getByteSizeOfSliceBlocks()
The Slice's size in bytes
Used by CRAI indexing only
|
CompressionHeader |
getCompressionHeader() |
java.util.List<java.lang.Integer> |
getContentIDs() |
java.util.List<CRAIEntry> |
getCRAIEntries(CompressorCache compressorCache)
Generate a CRAI Index entry from this Slice and other container parameters,
splitting Multiple Reference slices into constituent reference sequence entries.
|
Block |
getEmbeddedReferenceBlock()
Return the embedded reference block, if any.
|
int |
getEmbeddedReferenceContentID()
Get the content ID of the embedded reference block.
|
long |
getGlobalRecordCounter() |
java.util.Map<ReferenceContext,AlignmentSpan> |
getMultiRefAlignmentSpans(CompressorCache compressorCache,
ValidationStringency validationStringency)
Uses a Multiple Reference Slice Alignment Reader to determine the reference spans of a MULTI_REF Slice.
|
int |
getNumberOfBlocks() |
int |
getNumberOfRecords() |
byte[] |
getReferenceMD5() |
SliceBlocks |
getSliceBlocks() |
Block |
getSliceHeaderBlock() |
SAMBinaryTagAndValue |
getSliceTags() |
void |
normalizeCRAMRecords(java.util.List<CRAMCompressionRecord> cramCompressionRecords,
CRAMReferenceRegion cramReferenceRegion)
Normalize a list of CRAMCompressionRecord that have been read in from a CRAM stream.
|
void |
setAttribute(java.lang.String tag,
java.lang.Object value)
Set a value for the tag.
|
void |
setByteOffsetOfSliceHeaderBlock(int byteOffsetOfSliceHeaderBlock) |
void |
setByteSizeOfSliceBlocks(int byteSizeOfSliceBlocks) |
void |
setEmbeddedReferenceBlock(Block embeddedReferenceBlock) |
void |
setEmbeddedReferenceContentID(int embeddedReferenceBlockContentID)
Set the content ID of the embedded reference block.
|
void |
setLandmarkIndex(int landmarkIndex) |
void |
setReferenceMD5(CRAMReferenceRegion cramReferenceRegion) |
java.lang.String |
toString() |
void |
write(CRAMVersion cramVersion,
java.io.OutputStream outputStream) |
public static final int UNINITIALIZED_INDEXING_PARAMETER
public static final int EMBEDDED_REFERENCE_ABSENT_CONTENT_ID
public Slice(CRAMVersion cramVersion, CompressionHeader compressionHeader, java.io.InputStream inputStream, long containerByteOffset)
cramVersion - the version of the CRAM stream being readcompressionHeader - the compression header for the contain in which the Slice residesinputStream - the input stream to be readcontainerByteOffset - the stream byte offset of start of the container in which this Slice residespublic Slice(java.util.List<CRAMCompressionRecord> records, CompressionHeader compressionHeader, long containerByteOffset, long globalRecordCounter)
records - input CRAM Compression RecordscompressionHeader - the enclosing Container's Compression HeadercontainerByteOffset - globalRecordCounter - CRAMCompressionRecord.isPlaced(),
ReferenceContextTypepublic Block getSliceHeaderBlock()
public AlignmentContext getAlignmentContext()
public SliceBlocks getSliceBlocks()
public int getNumberOfRecords()
public long getGlobalRecordCounter()
public int getNumberOfBlocks()
public java.util.List<java.lang.Integer> getContentIDs()
public byte[] getReferenceMD5()
public int getByteOffsetOfSliceHeaderBlock()
ContainerHeader.getLandmarks()
Used by BAI and CRAI indexingpublic void setByteOffsetOfSliceHeaderBlock(int byteOffsetOfSliceHeaderBlock)
public int getByteSizeOfSliceBlocks()
public void setByteSizeOfSliceBlocks(int byteSizeOfSliceBlocks)
public void setLandmarkIndex(int landmarkIndex)
public long getBaseCount()
public SAMBinaryTagAndValue getSliceTags()
public void setEmbeddedReferenceContentID(int embeddedReferenceBlockContentID)
EMBEDDED_REFERENCE_ABSENT_CONTENT_ID) to indicate no embedded reference block is
present. If the reference block content ID already has a non-EMBEDDED_REFERENCE_ABSENT_CONTENT_ID
value, it cannot be reset. If the embedded reference block has already been set, the provided
reference block content ID must agree with the content ID of the existing block.embeddedReferenceBlockContentID - public int getEmbeddedReferenceContentID()
EMBEDDED_REFERENCE_ABSENT_CONTENT_ID (-1) to indicate no embedded reference block is
present.EMBEDDED_REFERENCE_ABSENT_CONTENT_IDpublic void setEmbeddedReferenceBlock(Block embeddedReferenceBlock)
public Block getEmbeddedReferenceBlock()
public CompressionHeader getCompressionHeader()
public java.util.ArrayList<CRAMCompressionRecord> deserializeCRAMRecords(CompressorCache compressorCache, ValidationStringency validationStringency)
normalizeCRAMRecords(java.util.List<htsjdk.samtools.cram.structure.CRAMCompressionRecord>, htsjdk.samtools.cram.build.CRAMReferenceRegion) for more information about normalization.compressorCache - cached compressor objects to use to decode streamsvalidationStringency - validation stringency to usenormalizeCRAMRecords(java.util.List<htsjdk.samtools.cram.structure.CRAMCompressionRecord>, htsjdk.samtools.cram.build.CRAMReferenceRegion))public void normalizeCRAMRecords(java.util.List<CRAMCompressionRecord> cramCompressionRecords, CRAMReferenceRegion cramReferenceRegion)
cramCompressionRecords - CRAMCompressionRecords to normalizecramReferenceRegion - the reference region for this slicepublic void write(CRAMVersion cramVersion, java.io.OutputStream outputStream)
public java.lang.String toString()
toString in class java.lang.Objectpublic void setReferenceMD5(CRAMReferenceRegion cramReferenceRegion)
public void setAttribute(java.lang.String tag,
java.lang.Object value)
tag - tag ID as a short integer as returned by SAMTag.makeBinaryTag(String)value - tag valuepublic java.util.Map<ReferenceContext,AlignmentSpan> getMultiRefAlignmentSpans(CompressorCache compressorCache, ValidationStringency validationStringency)
validationStringency - how strict to be when reading CRAM recordspublic java.util.List<CRAIEntry> getCRAIEntries(CompressorCache compressorCache)
public java.util.List<BAIEntry> getBAIEntries(CompressorCache compressorCache)