public class TabixReader
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
TabixReader.Iterator |
protected static class |
TabixReader.TIndex |
protected static class |
TabixReader.TPair64 |
Modifier and Type | Field and Description |
---|---|
protected TabixReader.TIndex[] |
mIndex |
Constructor and Description |
---|
TabixReader(java.lang.String filePath) |
TabixReader(java.lang.String filePath,
SeekableStream stream) |
TabixReader(java.lang.String filePath,
java.lang.String indexPath) |
TabixReader(java.lang.String filePath,
java.lang.String indexPath,
java.util.function.Function<java.nio.channels.SeekableByteChannel,java.nio.channels.SeekableByteChannel> wrapper,
java.util.function.Function<java.nio.channels.SeekableByteChannel,java.nio.channels.SeekableByteChannel> indexWrapper) |
TabixReader(java.lang.String filePath,
java.lang.String indexPath,
SeekableStream stream) |
TabixReader(java.lang.String filePath,
java.lang.String indexPath,
SeekableStream stream,
java.util.function.Function<java.nio.channels.SeekableByteChannel,java.nio.channels.SeekableByteChannel> indexWrapper) |
Modifier and Type | Method and Description |
---|---|
int |
chr2tid(java.lang.String chr)
return chromosome ID or -1 if it is unknown
|
void |
close() |
java.util.Set<java.lang.String> |
getChromosomes()
return the chromosomes in that tabix file
|
java.lang.String |
getSource()
return the source (filename/URL) of that reader
|
int[] |
parseReg(java.lang.String reg)
Parse a region in the format of "chr1", "chr1:100" or "chr1:100-1000"
|
TabixReader.Iterator |
query(int tid,
int beg,
int end)
Return
|
TabixReader.Iterator |
query(java.lang.String reg) |
TabixReader.Iterator |
query(java.lang.String reg,
int start,
int end) |
static int |
readInt(java.io.InputStream is) |
java.lang.String |
readLine()
Read one line from the data file.
|
static java.lang.String |
readLine(java.io.InputStream is) |
static long |
readLong(java.io.InputStream is) |
java.lang.String |
toString() |
protected TabixReader.TIndex[] mIndex
public TabixReader(java.lang.String filePath) throws java.io.IOException
filePath
- path to the data file/urijava.io.IOException
public TabixReader(java.lang.String filePath, java.lang.String indexPath) throws java.io.IOException
filePath
- path to the of the data file/uriindexPath
- Full path to the index file. Auto-generated if nulljava.io.IOException
public TabixReader(java.lang.String filePath, java.lang.String indexPath, java.util.function.Function<java.nio.channels.SeekableByteChannel,java.nio.channels.SeekableByteChannel> wrapper, java.util.function.Function<java.nio.channels.SeekableByteChannel,java.nio.channels.SeekableByteChannel> indexWrapper) throws java.io.IOException
filePath
- path to the data file/uriindexPath
- Full path to the index file. Auto-generated if nullwrapper
- a wrapper to apply to the raw byte stream of the data file if is a uri representing a Path
indexWrapper
- a wrapper to apply to the raw byte stream of the index file if it is a uri representing a Path
java.io.IOException
public TabixReader(java.lang.String filePath, SeekableStream stream) throws java.io.IOException
filePath
- Path to the data file (used for error messages only)stream
- Seekable stream from which the data is readjava.io.IOException
public TabixReader(java.lang.String filePath, java.lang.String indexPath, SeekableStream stream) throws java.io.IOException
filePath
- Path to the data file (used for error messages only)indexPath
- Full path to the index file. Auto-generated if nullstream
- Seekable stream from which the data is readjava.io.IOException
public TabixReader(java.lang.String filePath, java.lang.String indexPath, SeekableStream stream, java.util.function.Function<java.nio.channels.SeekableByteChannel,java.nio.channels.SeekableByteChannel> indexWrapper) throws java.io.IOException
filePath
- Path to the data file (used for error messages only)indexPath
- Full path to the index file. Auto-generated if nullindexWrapper
- a wrapper to apply to the raw byte stream of the index file if it is a uri representing a Path
stream
- Seekable stream from which the data is readjava.io.IOException
public java.lang.String getSource()
public static int readInt(java.io.InputStream is) throws java.io.IOException
java.io.IOException
public static long readLong(java.io.InputStream is) throws java.io.IOException
java.io.IOException
public static java.lang.String readLine(java.io.InputStream is) throws java.io.IOException
java.io.IOException
public java.lang.String readLine() throws java.io.IOException
java.io.IOException
public int chr2tid(java.lang.String chr)
public java.util.Set<java.lang.String> getChromosomes()
public int[] parseReg(java.lang.String reg)
reg
- Region stringpublic TabixReader.Iterator query(int tid, int beg, int end)
tid
- Sequence idbeg
- beginning of interval, genomic coordsend
- end of interval, genomic coordspublic TabixReader.Iterator query(java.lang.String reg)
reg
- A region string of the form acceptable by parseReg(String)
parseReg(String)
public TabixReader.Iterator query(java.lang.String reg, int start, int end)
reg
- a chromosomestart
- start intervalend
- end intervalparseReg(String)
public void close()
public java.lang.String toString()
toString
in class java.lang.Object