public class CRAMBAIIndexer extends java.lang.Object implements CRAMIndexer
CRAMContainerStreamWriter and proceeds by calling processContainer(htsjdk.samtools.cram.structure.Container, htsjdk.samtools.ValidationStringency)
after each Container is built, and finish() is called at the end.
2) is driven by CRAIIndex.openCraiFileAsBaiStream(InputStream, SAMSequenceDictionary)
and proceeds by processing CRAIEntry elements obtained from
CRAMCRAIIndexer.readIndex(InputStream). processAsSingleReferenceSlice(Slice)
is called on each CRAIEntry and finish() is called at the end.
NOTE: a third pattern of building a BAI from a CRAM file is also supported by this class,
but it is unused. This would be accomplished via createIndex(SeekableStream, File, Log, ValidationStringency).| Constructor and Description |
|---|
CRAMBAIIndexer(java.io.OutputStream output,
SAMFileHeader fileHeader)
Create a CRAM indexer that writes BAI to a stream.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
createIndex(SeekableStream stream,
java.io.File output,
Log log,
ValidationStringency validationStringency)
Generates a BAI index file from an input CRAM stream
|
void |
finish()
After all the slices have been processed, finish is called.
|
void |
processAsSingleReferenceSlice(Slice slice)
Record index information for a given CRAM slice that contains either
unmapped-unplaced reads, reads mapped to a single reference, or
a "fake" slice which represents a portion of a multi-ref slice.
|
void |
processContainer(Container container,
ValidationStringency validationStringency)
Index a container, any of mapped, unmapped and multiple references are allowed.
|
public CRAMBAIIndexer(java.io.OutputStream output,
SAMFileHeader fileHeader)
output - Index will be written here. output will be closed when finish() method is called.fileHeader - header for the corresponding bam file.public void processContainer(Container container, ValidationStringency validationStringency)
processContainer in interface CRAMIndexercontainer - container to be indexedvalidationStringency - stringency for validating records, passed to Container.getSpans(ValidationStringency)public void processAsSingleReferenceSlice(Slice slice)
slice - The CRAM slice or "fake" sub-sliceSAMException - if slice refers to multiple reference sequences.public void finish()
finish in interface CRAMIndexerpublic static void createIndex(SeekableStream stream, java.io.File output, Log log, ValidationStringency validationStringency)
stream - CRAM stream to indexoutput - File for output index filelog - optional Log to output progress