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)
. processBAIEntry(BAIEntry)
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 |
processBAIEntry(BAIEntry baiEntry) |
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 CRAMIndexer
container
- container to be indexedvalidationStringency
- stringency for validating records (used when processing multi-reference slices,
since creating an index on a multi-ref slices requires actually decoding the
records in order to resove the constituent reference spans}public final void processBAIEntry(BAIEntry baiEntry)
public void finish()
finish
in interface CRAMIndexer
public 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