Class 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 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 written
        samHeader - 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 sorted
        craiStream - 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.