Package htsjdk.samtools
Class IndexMerger<T>
java.lang.Object
htsjdk.samtools.IndexMerger<T>
- Type Parameters:
T- the type of the index (e.g.AbstractBAMFileIndexfor a BAM index).
- Direct Known Subclasses:
BAMIndexMerger,CRAIIndexMerger,SBIIndexMerger,TabixIndexMerger
Merges index files for (headerless) parts of a partitioned main file into a single index file.
The file and directory structure for the partitioned file is defined in subclasses, but the general pattern is as
follows.
A partitioned file (e.g BAM, CRAM, or VCF) is a directory containing the following files:
- A file named header containing all header bytes.
- Zero or more files named part-00000, part-00001, ... etc, containing file records, with no header.
- A file named terminator containing a file terminator. (This may be absent if it is not required by the format.)
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidfinish(long dataFileLength) Finish merging the indexes, and close the output stream.abstract voidprocessIndex(T index, long partLength) Process the next index and add to the merged index.
-
Field Details
-
out
-
partLengths
-
-
Constructor Details
-
IndexMerger
Create an index merger.- Parameters:
out- the output stream to write the merged index to. Must be uncompressed since the implementation of this class will provide appropriate compression.headerLength- the length of the header file, in bytes.
-
-
Method Details
-
processIndex
Process the next index and add to the merged index.- Parameters:
index- the index to mergepartLength- the length of the part file corresponding to the index, in bytes.
-
finish
Finish merging the indexes, and close the output stream.- Parameters:
dataFileLength- the length of the total data file, in bytes.- Throws:
IOException- if an error occurs
-