Package htsjdk.samtools
Class CRAMCRAIIndexer
- java.lang.Object
-
- htsjdk.samtools.CRAMCRAIIndexer
-
- All Implemented Interfaces:
CRAMIndexer
public class CRAMCRAIIndexer extends Object implements 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
Constructors Constructor Description CRAMCRAIIndexer(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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfinish()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 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
-
CRAMCRAIIndexer
public CRAMCRAIIndexer(OutputStream os, SAMFileHeader samHeader, Collection<CRAIEntry> entries)
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 Detail
-
processContainer
public void processContainer(Container container)
Create index entries for a single container.- Parameters:
container- the container to index
-
processContainer
public void processContainer(Container container, ValidationStringency validationStringency)
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
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.
-
-