public class FastaSequenceIndex extends java.lang.Object implements java.lang.Iterable<FastaSequenceIndexEntry>
Modifier | Constructor and Description |
---|---|
protected |
FastaSequenceIndex()
Empty, protected constructor for unit testing.
|
|
FastaSequenceIndex(java.io.File indexFile)
Build a sequence index from the specified file.
|
|
FastaSequenceIndex(java.io.InputStream in)
Build a sequence index from the specified input stream.
|
|
FastaSequenceIndex(java.nio.file.Path indexFile)
Build a sequence index from the specified file.
|
Modifier and Type | Method and Description |
---|---|
protected void |
add(FastaSequenceIndexEntry indexEntry)
Add a new index entry to the list.
|
boolean |
equals(java.lang.Object other)
Compare two FastaSequenceIndex objects for equality.
|
FastaSequenceIndexEntry |
getIndexEntry(java.lang.String contigName)
Retrieve the index entry associated with the given contig.
|
boolean |
hasIndexEntry(java.lang.String contigName)
Does the given contig name have a corresponding entry?
|
java.util.Iterator<FastaSequenceIndexEntry> |
iterator()
Creates an iterator which can iterate through all entries in a fasta index.
|
protected void |
rename(FastaSequenceIndexEntry entry,
java.lang.String newName)
Renames the existing index entry to the new index entry with the specified name.
|
int |
size()
Returns the number of elements in the index.
|
void |
write(java.nio.file.Path indexFile)
Writes this index to the specified path.
|
public FastaSequenceIndex(java.io.File indexFile)
indexFile
- File to open.java.io.FileNotFoundException
- if the index file cannot be found.public FastaSequenceIndex(java.nio.file.Path indexFile)
indexFile
- File to open.java.io.FileNotFoundException
- if the index file cannot be found.public FastaSequenceIndex(java.io.InputStream in)
in
- InputStream to read from.protected FastaSequenceIndex()
protected void add(FastaSequenceIndexEntry indexEntry)
indexEntry
- New index entry to add.protected void rename(FastaSequenceIndexEntry entry, java.lang.String newName)
entry
- entry to update.newName
- New name for the index entry.public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
other
- Another FastaSequenceIndex to comparepublic void write(java.nio.file.Path indexFile) throws java.io.IOException
indexFile
- index file to output the index in the .fai formatjava.io.IOException
- if an IO error occurs.public boolean hasIndexEntry(java.lang.String contigName)
contigName
- The contig name for which to search.public FastaSequenceIndexEntry getIndexEntry(java.lang.String contigName)
contigName
- Name of the contig for which to search.SAMException
- if the associated index entry can't be found.public java.util.Iterator<FastaSequenceIndexEntry> iterator()
iterator
in interface java.lang.Iterable<FastaSequenceIndexEntry>
public int size()