public final class BwaMemIndex
extends java.lang.Object
implements java.lang.AutoCloseable
| Modifier and Type | Class and Description |
|---|---|
static class |
BwaMemIndex.Algorithm
Indexing algorithms supported by Bwa.
|
| Modifier and Type | Field and Description |
|---|---|
static java.util.List<java.lang.String> |
FASTA_FILE_EXTENSIONS |
static java.lang.String |
IMAGE_FILE_EXTENSION |
static java.util.List<java.lang.String> |
INDEX_FILE_EXTENSIONS |
| Constructor and Description |
|---|
BwaMemIndex(java.lang.String indexImageFile)
Loads an index from an image file.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the index and release the (non-Java) memory that's been allocated
|
static java.lang.String |
createIndexImageFromFastaFile(java.lang.String fasta)
Create the index image file for a fasta file.
|
static void |
createIndexImageFromFastaFile(java.lang.String fasta,
java.lang.String imageFile)
Creates the index image file for a reference fasta file.
|
static void |
createIndexImageFromFastaFile(java.lang.String fasta,
java.lang.String imageFile,
BwaMemIndex.Algorithm algo)
Creates the index image file for a reference fasta file.
|
static void |
createIndexImageFromIndexFiles(java.lang.String indexPrefix,
java.lang.String imageFile)
Create the index image file for a complete set of BWA index files
|
void |
deRefIndex()
done using the index -- if ref count has fallen to 0, a call to close can be expected to succeed
|
static java.lang.String |
getBWAVersion()
returns github GUID for the version of bwa that has been compiled
|
static java.lang.String |
getDefaultIndexImageNameFromFastaFile(java.lang.String fasta)
Gets the default index image name for the provided FASTA.
|
java.util.List<java.lang.String> |
getReferenceContigNames()
retrieve list of contig names in the reference dictionary
|
boolean |
isOpen()
true if index has not been closed
|
long |
refIndex()
there's someone using the index -- don't allow it to be closed
|
public static final java.util.List<java.lang.String> INDEX_FILE_EXTENSIONS
public static final java.lang.String IMAGE_FILE_EXTENSION
public static final java.util.List<java.lang.String> FASTA_FILE_EXTENSIONS
public BwaMemIndex(java.lang.String indexImageFile)
You can use other methods to create such
indexes from fasta reference (createIndexImageFromFastaFile(java.lang.String) or their index files
(createIndexImageFromIndexFiles(java.lang.String, java.lang.String)).
WARNING!: Notice that currently this method is making JNI call that might result in an abrupt process interruption (e.g. exit or abort system call) and so the control may never be returned.
java.lang.IllegalArgumentException - if indexImageFile is null.CouldNotReadImageException - if some problem occurred when loading the
image file.public static void createIndexImageFromIndexFiles(java.lang.String indexPrefix,
java.lang.String imageFile)
indexPrefix - the location of the index files.imageFile - the location of the new index image file.
WARNING!: Notice that currently this method is making JNI call that might result in an abrupt process interruption (e.g. exit or abort system call) and so the control may never be returned.
java.lang.IllegalArgumentException - if indexPrefix is null
or it does not look like it points to a complete set of index files.java.lang.IllegalArgumentException - if imageFile is null.public static java.lang.String createIndexImageFromFastaFile(java.lang.String fasta)
The name of the output index file will be determined by the name of the fasta file using
getDefaultIndexImageNameFromFastaFile(String).
This is equivalent to calling
{@link #createIndexImageFromFastaFile(String,String) createIndexImageFromFastaFile(X, getDefaultIndexImageNameFromFastaFile(X)))}
WARNING!: Notice that currently this method is making JNI call that might result in an abrupt process interruption (e.g. exit or abort system call) and so the control may never be returned.
fasta - the location of the fasta reference file.getDefaultIndexImageNameFromFastaFile(String)).java.lang.IllegalArgumentException - if fasta is null or
does not finish with out of the standard fasta extension names (listed in FASTA_FILE_EXTENSIONS).InvalidFileFormatException - if fasta does not seem to be a fasta formatted regular readable file.CouldNotCreateIndexImageException - if for some reason we could not create the index file.getDefaultIndexImageNameFromFastaFile(String)public static java.lang.String getDefaultIndexImageNameFromFastaFile(java.lang.String fasta)
The default name is substitutes its extension (typically .fasta or .fa)
by IMAGE_FILE_EXTENSION (.img).
fasta - the location of the fasta reference file.java.lang.IllegalArgumentException - if fasta is null or
does not finish with out of the standard fasta extension names (listed in FASTA_FILE_EXTENSIONS).public static void createIndexImageFromFastaFile(java.lang.String fasta,
java.lang.String imageFile)
The index will be created using the default algorithm BwaMemIndex.Algorithm.AUTO.
Calling this method is equivalent to calling createIndexImageFromFastaFile(a, b, Algorithm.AUTO)
WARNING!: Notice that currently this method is making JNI call that might result in an abrupt process interruption (e.g. exit or abort system call) and so the control may never be returned.
fasta - the location of the targeted reference.imageFile - the location of the new index image file.java.lang.IllegalArgumentException - if fasta is null
or it does not look like it points to a fasta formatted readable file.java.lang.IllegalArgumentException - if imageFile is null.InvalidFileFormatException - if fasta does not seem to be
a fasta formatted regular and readable file.CouldNotCreateIndexImageException - if there was a problem creating
the output image.CouldNotCreateIndexException - if there was some problem while creating
the intermediary index file set.public static void createIndexImageFromFastaFile(java.lang.String fasta,
java.lang.String imageFile,
BwaMemIndex.Algorithm algo)
WARNING!: Notice that currently this method is making JNI call that might result in an abrupt process interruption (e.g. exit or abort system call) and so the control may never be returned.
fasta - the location of the targeted reference.imageFile - the location of the new index image file.algo - the algorithm to use to construct the index (see BwaMemIndex.Algorithm to see what there is available.).java.lang.IllegalArgumentException - if fasta is null
or it does not look like it points to a fasta formatted readable file.java.lang.IllegalArgumentException - if imageFile is null.InvalidFileFormatException - if fasta does not seem to be
a fasta formatted regular and readable file.CouldNotCreateIndexImageException - if there was a problem creating
the output image.CouldNotCreateIndexException - if there was some problem while creating
the intermediary index file set.public boolean isOpen()
public long refIndex()
public void deRefIndex()
public void close()
WARNING!: Notice that currently this method is making JNI call that might result in an abrupt process interruption (e.g. exit or abort system call) and so the control may never be returned.
close in interface java.lang.AutoCloseablepublic java.util.List<java.lang.String> getReferenceContigNames()
public static java.lang.String getBWAVersion()