public class Container
extends java.lang.Object
| Constructor and Description |
|---|
Container(CompressionHeader compressionHeader,
java.util.List<Slice> containerSlices,
long containerByteOffset,
long globalRecordCounter)
Create a Container with a
ReferenceContext derived from its Slices. |
Container(ContainerHeader containerHeader,
long containerByteOffset)
Create a container for use by CramContainerHeaderIterator, which is only used to
find the offsets within a CRAM stream where containers start.
|
Container(CRAMVersion cramVersion,
java.io.InputStream inputStream,
long containerByteOffset)
Read a Container from a CRAM stream.
|
| Modifier and Type | Method and Description |
|---|---|
AlignmentContext |
getAlignmentContext() |
java.util.List<BAIEntry> |
getBAIEntries(CompressorCache compressorCache)
Retrieve the list of BAIEntry Index entries corresponding to this Container
|
CompressionHeader |
getCompressionHeader() |
long |
getContainerByteOffset() |
ContainerHeader |
getContainerHeader() |
java.util.List<CRAIEntry> |
getCRAIEntries(CompressorCache compressorCache)
Retrieve the list of CRAI Index entries corresponding to this Container
|
java.util.List<SAMRecord> |
getSAMRecords(ValidationStringency validationStringency,
CRAMReferenceRegion cramReferenceRegion,
CompressorCache compressorCache,
SAMFileHeader samFileHeader)
Get SAMRecords from all Slices in this container.
|
java.util.List<Slice> |
getSlices() |
boolean |
isEOF() |
static SAMFileHeader |
readSAMFileHeaderContainer(CRAMVersion cramVersion,
java.io.InputStream inputStream,
java.lang.String id)
Reads the special container that contains the SAMFileHeader from a CRAM stream, and returns just
the SAMFileHeader (we don't want to hand out the container since its not a real container in that
it has no compression header block, slices, etc).
|
java.lang.String |
toString() |
int |
write(CRAMVersion cramVersion,
java.io.OutputStream outputStream)
Writes a complete
Container with it's header to a OutputStream. |
static long |
writeSAMFileHeaderContainer(CRAMVersion cramVersion,
SAMFileHeader samFileHeader,
java.io.OutputStream os)
Write a SAMFileHeader container to a CRAM stream.
|
public Container(CompressionHeader compressionHeader, java.util.List<Slice> containerSlices, long containerByteOffset, long globalRecordCounter)
ReferenceContext derived from its Slices.
A Single Reference Container contains only Single Reference Slices mapped to the same reference.
- set the Container's ReferenceContext to be the same as those slices
- set the Container's Alignment Start and Span to cover all slices
A Multiple Reference Container contains only Multiple Reference Slices.
- set the Container's ReferenceContext to MULTIPLE_REFERENCE_CONTEXT
- unset the Container's Alignment Start and Span
An Unmapped Container contains only Unmapped Slices.
- set the Container's ReferenceContext to UNMAPPED_UNPLACED_CONTEXT
- unset the Container's Alignment Start and Span
Any other combination is invalid.compressionHeader - the CRAM CompressionHeader to use for the ContainercontainerSlices - the Slices for the ContainercontainerByteOffset - the Container's byte offset from the start of the streamglobalRecordCounter - the global record count for the first record in this containerCRAMException - for invalid Container statespublic Container(ContainerHeader containerHeader, long containerByteOffset)
containerHeader - the container header for the containercontainerByteOffset - the byte offset of this container in the containing streampublic Container(CRAMVersion cramVersion, java.io.InputStream inputStream, long containerByteOffset)
cramVersion - CRAM version of the input streaminputStream - input stream to readcontainerByteOffset - byte offset within the stream of this containerpublic int write(CRAMVersion cramVersion, java.io.OutputStream outputStream)
Container with it's header to a OutputStream.cramVersion - the CRAM version to assumeoutputStream - the stream to write topublic static SAMFileHeader readSAMFileHeaderContainer(CRAMVersion cramVersion, java.io.InputStream inputStream, java.lang.String id)
cramVersion - CRAM version being readinputStream - stream from which to read the header containerid - id from the cram header, for error reportingSAMFileHeader for this CRAM streampublic static long writeSAMFileHeaderContainer(CRAMVersion cramVersion, SAMFileHeader samFileHeader, java.io.OutputStream os)
cramVersion - CRAM version being written.samFileHeader - SAMFileHeader to writeos - stream to which the header container should be writtenpublic java.util.List<SAMRecord> getSAMRecords(ValidationStringency validationStringency, CRAMReferenceRegion cramReferenceRegion, CompressorCache compressorCache, SAMFileHeader samFileHeader)
validationStringency - validation stringency to use (when reading tags)cramReferenceRegion - reference region to use to restore basescompressorCache - compressor cache to use for decompressing streamssamFileHeader - the SAMFileHeader for this CRAM stream (for resolving read groups)SAMRecords from this containerpublic ContainerHeader getContainerHeader()
public CompressionHeader getCompressionHeader()
public AlignmentContext getAlignmentContext()
public long getContainerByteOffset()
public java.util.List<Slice> getSlices()
public boolean isEOF()
public java.util.List<CRAIEntry> getCRAIEntries(CompressorCache compressorCache)
public java.util.List<BAIEntry> getBAIEntries(CompressorCache compressorCache)
public java.lang.String toString()
toString in class java.lang.Object