public class TabixReader extends 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(String fn) |
TabixReader(String fn,
SeekableStream stream) |
TabixReader(String fn,
String idxFn) |
TabixReader(String fn,
String idxFn,
SeekableStream stream) |
Modifier and Type | Method and 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
|
static void |
main(String[] args) |
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 fn) throws IOException
fn
- File name of the data fileIOException
public TabixReader(String fn, String idxFn) throws IOException
fn
- File name of the data fileidxFn
- Full path to the index file. Auto-generated if nullIOException
public TabixReader(String fn, SeekableStream stream) throws IOException
fn
- File name of the data file (used for error messages only)stream
- Seekable stream from which the data is readIOException
public TabixReader(String fn, String idxFn, SeekableStream stream) throws IOException
fn
- File name of the data file (used for error messages only)idxFn
- Full path to the index file. Auto-generated if nullstream
- 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 static void main(String[] args)
public void close()