public class CRAMContainerStreamWriter extends Object
Modifier and Type | Field | Description |
---|---|---|
protected int |
containerSize |
|
protected int |
recordsPerSlice |
Constructor | Description |
---|---|
CRAMContainerStreamWriter(OutputStream outputStream,
OutputStream indexStream,
CRAMReferenceSource source,
SAMFileHeader samFileHeader,
String cramId) |
Create a CRAMContainerStreamWriter for writing SAM records into a series of CRAM
containers on output stream, with an optional index.
|
Modifier and Type | Method | Description |
---|---|---|
void |
finish(boolean writeEOFContainer) |
Finish writing to the stream.
|
protected void |
flushContainer() |
Complete the current container and flush it to the output stream.
|
Set<String> |
getCaptureTags() |
|
Set<String> |
getIgnoreTags() |
|
List<PreservationPolicy> |
getPreservationPolicies() |
|
boolean |
isCaptureAllTags() |
|
boolean |
isPreserveReadNames() |
|
void |
setCaptureAllTags(boolean captureAllTags) |
|
void |
setCaptureTags(Set<String> captureTags) |
|
void |
setIgnoreTags(Set<String> ignoreTags) |
|
void |
setPreserveReadNames(boolean preserveReadNames) |
|
protected boolean |
shouldFlushContainer(SAMRecord nextRecord) |
Decide if the current container should be completed and flushed.
|
void |
writeAlignment(SAMRecord alignment) |
Write an alignment record.
|
void |
writeHeader(SAMFileHeader header) |
Write a CRAM file header and SAM header to the stream.
|
protected final int recordsPerSlice
protected final int containerSize
public CRAMContainerStreamWriter(OutputStream outputStream, OutputStream indexStream, CRAMReferenceSource source, SAMFileHeader samFileHeader, String cramId)
outputStream
- where to write the CRAM stream.indexStream
- where to write the output index. Can be null if no index is required.source
- reference sourcesamFileHeader
- SAMFileHeader
to be used. Sort order is determined by the sortOrder property of this arg.cramId
- used for display in error message displaypublic void writeAlignment(SAMRecord alignment)
alignment
- must not be nullpublic void writeHeader(SAMFileHeader header)
header
- SAMFileHeader to writepublic void finish(boolean writeEOFContainer)
writeEOFContainer
- true if an EOF container should be written. Only use false if writing a CRAM file
fragment which will later be aggregated into a complete CRAM file.public boolean isPreserveReadNames()
public void setPreserveReadNames(boolean preserveReadNames)
public List<PreservationPolicy> getPreservationPolicies()
public boolean isCaptureAllTags()
public void setCaptureAllTags(boolean captureAllTags)
protected boolean shouldFlushContainer(SAMRecord nextRecord)
nextRecord
- the record to be added into the current or next containerprotected void flushContainer() throws IllegalArgumentException, IllegalAccessException, IOException