public final class SplittingBAMIndexer extends Object
BAMInputFormat. Writes splitting BAM indices as
understood by SplittingBAMIndex.
There are two ways of using this class:
1) Building a splitting BAM index from an existing BAM file
2) Building a splitting BAM index while building the BAM file
For 1), use the static index(InputStream, OutputStream, long, int) method,
which takes the input BAM and output stream to write the index to.
For 2), use one of the constructors that takes an output stream, then pass SAMRecord objects via the processAlignment(htsjdk.samtools.SAMRecord) method, and then call finish(long) to complete writing the index.| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_GRANULARITY |
static String |
OUTPUT_FILE_EXTENSION |
| Constructor and Description |
|---|
SplittingBAMIndexer(int g)
Deprecated.
use one of the other constructors to create an index while building a
BAM file or
index(InputStream, OutputStream, long, int) for an existing BAM
file. |
SplittingBAMIndexer(OutputStream out)
Prepare to index a BAM file.
|
SplittingBAMIndexer(OutputStream out,
int granularity)
Prepare to index a BAM file.
|
| Modifier and Type | Method and Description |
|---|---|
void |
finish(long inputSize)
Complete the index by writing the input BAM file size to the index, and closing
the output stream.
|
static void |
index(InputStream rawIn,
OutputStream out,
long inputSize,
int granularity)
Perform indexing on the given BAM file, at the granularity level specified.
|
static void |
main(String[] args) |
void |
processAlignment(htsjdk.samtools.SAMRecord rec)
Process the given record for the index.
|
static void |
run(org.apache.hadoop.conf.Configuration conf)
Invoke a new SplittingBAMIndexer object, operating on the supplied
Configuration object instead of a supplied
argument list |
void |
writeVirtualOffset(long virtualOffset)
Write the given virtual offset to the index.
|
public static final String OUTPUT_FILE_EXTENSION
public static final int DEFAULT_GRANULARITY
@Deprecated public SplittingBAMIndexer(int g)
index(InputStream, OutputStream, long, int) for an existing BAM
file.g - granularity levelpublic SplittingBAMIndexer(OutputStream out)
out - the stream to write the index topublic SplittingBAMIndexer(OutputStream out, int granularity)
out - the stream to write the index togranularity - write the offset of every n-th alignment to the indexpublic static void main(String[] args)
public static void run(org.apache.hadoop.conf.Configuration conf)
throws IOException
Configuration object instead of a supplied
argument listIllegalArgumentException - if the "input" property is not
in the ConfigurationIOExceptionpublic void processAlignment(htsjdk.samtools.SAMRecord rec)
throws IOException
rec - the record from the file being indexedIOExceptionpublic void writeVirtualOffset(long virtualOffset)
throws IOException
virtualOffset - virtual file pointerIOExceptionpublic void finish(long inputSize)
throws IOException
inputSize - the size of the input BAM fileIOExceptionpublic static void index(InputStream rawIn, OutputStream out, long inputSize, int granularity) throws IOException
IOExceptionCopyright © 2016. All rights reserved.