public class TabixReader extends Object
Modifier and Type | Class | Description |
---|---|---|
static interface |
TabixReader.Iterator |
|
protected static class |
TabixReader.TIndex |
|
protected static class |
TabixReader.TPair64 |
Modifier and Type | Field | Description |
---|---|---|
protected TabixReader.TIndex[] |
mIndex |
Constructor | Description |
---|---|
TabixReader(String filePath) |
|
TabixReader(String filePath,
SeekableStream stream) |
|
TabixReader(String filePath,
String indexPath) |
|
TabixReader(String filePath,
String indexPath,
SeekableStream stream) |
|
TabixReader(String filePath,
String indexPath,
SeekableStream stream,
Function<SeekableByteChannel,SeekableByteChannel> indexWrapper) |
|
TabixReader(String filePath,
String indexPath,
Function<SeekableByteChannel,SeekableByteChannel> wrapper,
Function<SeekableByteChannel,SeekableByteChannel> indexWrapper) |
Modifier and Type | Method | Description |
---|---|---|
int |
chr2tid(String chr) |
return chromosome ID or -1 if it is unknown
|
void |
close() |
|
Set<String> |
getChromosomes() |
return the chromosomes in that tabix file
|
String |
getSource() |
return the source (filename/URL) of that reader
|
int[] |
parseReg(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(String reg) |
|
TabixReader.Iterator |
query(String reg,
int start,
int end) |
|
static int |
readInt(InputStream is) |
|
String |
readLine() |
Read one line from the data file.
|
static String |
readLine(InputStream is) |
|
static long |
readLong(InputStream is) |
|
String |
toString() |
protected TabixReader.TIndex[] mIndex
public TabixReader(String filePath) throws IOException
filePath
- path to the data file/uriIOException
public TabixReader(String filePath, String indexPath) throws IOException
filePath
- path to the of the data file/uriindexPath
- Full path to the index file. Auto-generated if nullIOException
public TabixReader(String filePath, String indexPath, Function<SeekableByteChannel,SeekableByteChannel> wrapper, Function<SeekableByteChannel,SeekableByteChannel> indexWrapper) throws 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
IOException
public TabixReader(String filePath, SeekableStream stream) throws IOException
filePath
- Path to the data file (used for error messages only)stream
- Seekable stream from which the data is readIOException
public TabixReader(String filePath, String indexPath, SeekableStream stream) throws 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 readIOException
public TabixReader(String filePath, String indexPath, SeekableStream stream, Function<SeekableByteChannel,SeekableByteChannel> indexWrapper) throws 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 readIOException
public String getSource()
public static int readInt(InputStream is) throws IOException
IOException
public static long readLong(InputStream is) throws IOException
IOException
public static String readLine(InputStream is) throws IOException
IOException
public String readLine() throws IOException
IOException
public int chr2tid(String chr)
public int[] parseReg(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(String reg)
reg
- A region string of the form acceptable by parseReg(String)
parseReg(String)
public TabixReader.Iterator query(String reg, int start, int end)
reg
- a chromosomestart
- start intervalend
- end intervalparseReg(String)
public void close()