Package htsjdk.samtools
Class CRAMCRAIIndexer
java.lang.Object
htsjdk.samtools.CRAMCRAIIndexer
- All Implemented Interfaces:
CRAMIndexer
Indexer for creating/reading/writing a CRAIIndex for a CRAM file/stream. There
are three ways to obtain an index:
- create an index for an entire CRAM stream and write it to an output stream
- create an index on-the-fly by processing one container at a time
- read an existing index from an input stream
-
Constructor Summary
ConstructorsConstructorDescriptionCRAMCRAIIndexer(OutputStream os, SAMFileHeader samHeader) Create a CRAMCRAIIndexer that writes to the given output stream.CRAMCRAIIndexer(OutputStream os, SAMFileHeader samHeader, Collection<CRAIEntry> entries) Create a CRAMCRAIIndexer that writes to the given output stream, initialized with a Collection ofCRAIEntryobjects. -
Method Summary
Modifier and TypeMethodDescriptionvoidfinish()Finish creating the index by writing the accumulated entries out to the stream.voidprocessContainer(Container container) Create index entries for a single container.voidprocessContainer(Container container, ValidationStringency validationStringency) Create index entries for a single container.static CRAIIndexreadIndex(InputStream is) Read an input stream containing a .crai index and return a CRAIIndex object.static voidwriteIndex(SeekableStream cramStream, OutputStream craiStream) Generate and write a CRAI index to an output stream from a CRAM input stream
-
Constructor Details
-
CRAMCRAIIndexer
Create a CRAMCRAIIndexer that writes to the given output stream.- Parameters:
os- output stream to which the index will be writtensamHeader- SAMFileHeader - user to verify sort order
-
CRAMCRAIIndexer
Create a CRAMCRAIIndexer that writes to the given output stream, initialized with a Collection ofCRAIEntryobjects.- Parameters:
os- output stream to which the index will be writtensamHeader- SAMFileHeader - user to verify sort orderentries- the CRAI entries to index
-
-
Method Details
-
processContainer
Create index entries for a single container.- Parameters:
container- the container to index
-
processContainer
Description copied from interface:CRAMIndexerCreate index entries for a single container.- Specified by:
processContainerin interfaceCRAMIndexer- Parameters:
container- the container to indexvalidationStringency- 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}
-
finish
public void finish()Finish creating the index by writing the accumulated entries out to the stream.- Specified by:
finishin interfaceCRAMIndexer
-
writeIndex
Generate and write a CRAI index to an output stream from a CRAM input stream- Parameters:
cramStream- CRAM stream to index; must be coordinate sortedcraiStream- stream for output index
-
readIndex
Read an input stream containing a .crai index and return a CRAIIndex object.- Parameters:
is- Input stream to read- Returns:
- A CRAIIndex object representing the index.
-