Package htsjdk.samtools
Class CRAMCRAIIndexer
- java.lang.Object
-
- htsjdk.samtools.CRAMCRAIIndexer
-
public class CRAMCRAIIndexer extends Object
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
Constructors Constructor Description CRAMCRAIIndexer(OutputStream os, SAMFileHeader samHeader)
Create a CRAMCRAIIndexer that writes to the given output stream.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addEntry(CRAIEntry entry)
void
finish()
Finish creating the index by writing the accumulated entries out to the stream.void
processContainer(Container container)
Create index entries for a single container.static CRAIIndex
readIndex(InputStream is)
Read an input stream containing a .crai index and return a CRAIIndex object.static void
writeIndex(SeekableStream cramStream, OutputStream craiStream)
Generate and write a CRAI index to an output stream from a CRAM input stream
-
-
-
Constructor Detail
-
CRAMCRAIIndexer
public CRAMCRAIIndexer(OutputStream os, SAMFileHeader samHeader)
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
-
-
Method Detail
-
processContainer
public void processContainer(Container container)
Create index entries for a single container.- Parameters:
container
- the container to index
-
addEntry
public void addEntry(CRAIEntry entry)
-
finish
public void finish()
Finish creating the index by writing the accumulated entries out to the stream.
-
writeIndex
public static void writeIndex(SeekableStream cramStream, OutputStream craiStream)
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
public static CRAIIndex readIndex(InputStream is)
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.
-
-