Class TribbleIndexedFeatureReader<T extends Feature,SOURCE>

java.lang.Object
htsjdk.tribble.AbstractFeatureReader<T,SOURCE>
htsjdk.tribble.TribbleIndexedFeatureReader<T,SOURCE>
All Implemented Interfaces:
FeatureReader<T>, Closeable, AutoCloseable

public class TribbleIndexedFeatureReader<T extends Feature,SOURCE> extends AbstractFeatureReader<T,SOURCE>
A reader for text feature files (i.e. not tabix files). This includes tribble-indexed and non-indexed files. If index both iterate() and query() methods are supported.

Note: Non-indexed files can be gzipped, but not bgzipped.

Since:
2/11/12
  • Constructor Details

  • Method Details

    • close

      public void close() throws IOException
      Description copied from interface: FeatureReader
      Closes the reader
      Throws:
      IOException
    • getSequenceNames

      public List<String> getSequenceNames()
      Return the sequence (chromosome/contig) names in this file, if known.
      Returns:
      list of strings of the contig names
    • hasIndex

      public boolean hasIndex()
      Description copied from class: AbstractFeatureReader
      Whether the reader has an index or not Default implementation returns false
      Overrides:
      hasIndex in class AbstractFeatureReader<T extends Feature,SOURCE>
      Returns:
      false
    • isQueryable

      public boolean isQueryable()
      Specified by:
      isQueryable in interface FeatureReader<T extends Feature>
      Overrides:
      isQueryable in class AbstractFeatureReader<T extends Feature,SOURCE>
      Returns:
      true if the reader has an index, which means that it can be queried.
    • query

      public CloseableTribbleIterator<T> query(String chr, int start, int end) throws IOException
      Return an iterator to iterate over features overlapping the specified interval

      Note that TribbleIndexedFeatureReader only supports issuing and manipulating a single query for each reader. That is, the behavior of the following code is undefined:

      reader = new TribbleIndexedFeatureReader() Iterator it1 = reader.query("x", 10, 20) Iterator it2 = reader.query("x", 1000, 1010)

      As a consequence of this, the TribbleIndexedFeatureReader are also not thread-safe.

      Parameters:
      chr - contig
      start - start position
      end - end position
      Returns:
      an iterator of records in this interval
      Throws:
      IOException
    • iterator

      public CloseableTribbleIterator<T> iterator() throws IOException
      Description copied from interface: FeatureReader
      Provides access to all the features in the reader
      Returns:
      Return an iterator to iterate over the entire file
      Throws:
      IOException