Package htsjdk.tribble.readers
Class TabixReader
java.lang.Object
htsjdk.tribble.readers.TabixReader
- All Implemented Interfaces:
AutoCloseable
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
protected static class
protected static class
-
Field Summary
-
Constructor Summary
ConstructorDescriptionTabixReader
(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) -
Method Summary
Modifier and TypeMethodDescriptionint
return chromosome ID or -1 if it is unknownvoid
close()
return the chromosomes in that tabix filereturn the source (filename/URL) of that readerint[]
Parse a region in the format of "chr1", "chr1:100" or "chr1:100-1000"query
(int tid, int beg, int end) Get an iterator for an interval specified by the sequence id and begin and end coordinatesGet an iterator for an interval specified by the sequence id and begin and end coordinatesstatic int
readInt
(InputStream is) readLine()
Read one line from the data file.static String
readLine
(InputStream is) static long
readLong
(InputStream is) toString()
-
Field Details
-
mIndex
-
-
Constructor Details
-
TabixReader
- Parameters:
filePath
- path to the data file/uri- Throws:
IOException
-
TabixReader
- Parameters:
filePath
- path to the of the data file/uriindexPath
- Full path to the index file. Auto-generated if null- Throws:
IOException
-
TabixReader
public TabixReader(String filePath, String indexPath, Function<SeekableByteChannel, SeekableByteChannel> wrapper, Function<SeekableByteChannel, throws IOExceptionSeekableByteChannel> indexWrapper) - Parameters:
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 aPath
indexWrapper
- a wrapper to apply to the raw byte stream of the index file if it is a uri representing aPath
- Throws:
IOException
-
TabixReader
- Parameters:
filePath
- Path to the data file (used for error messages only)stream
- Seekable stream from which the data is read- Throws:
IOException
-
TabixReader
- Parameters:
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 read- Throws:
IOException
-
TabixReader
public TabixReader(String filePath, String indexPath, SeekableStream stream, Function<SeekableByteChannel, SeekableByteChannel> indexWrapper) throws IOException- Parameters:
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 aPath
stream
- Seekable stream from which the data is read- Throws:
IOException
-
-
Method Details
-
getSource
return the source (filename/URL) of that reader -
readInt
- Throws:
IOException
-
readLong
- Throws:
IOException
-
readLine
- Throws:
IOException
-
readLine
Read one line from the data file.- Throws:
IOException
-
chr2tid
return chromosome ID or -1 if it is unknown -
getChromosomes
return the chromosomes in that tabix file -
parseReg
Parse a region in the format of "chr1", "chr1:100" or "chr1:100-1000"- Parameters:
reg
- Region string- Returns:
- An array where the three elements are sequence_id, region_begin and region_end. On failure, sequence_id==-1.
-
query
Get an iterator for an interval specified by the sequence id and begin and end coordinates- Parameters:
tid
- Sequence id, if non-existent returns EOF_ITERATORbeg
- beginning of interval, genomic coords (0-based, closed-open)end
- end of interval, genomic coords (0-based, closed-open)- Returns:
- an iterator over the specified interval
-
query
- Parameters:
reg
- A region string of the form acceptable byparseReg(String)
- Returns:
- an iterator over the specified interval
- See Also:
-
query
Get an iterator for an interval specified by the sequence id and begin and end coordinates- Parameters:
reg
- a chromosomestart
- start intervalend
- end interval- Returns:
- a tabix iterator over the specified interval
- See Also:
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-
toString
-