コード例 #1
0
  /**
   * Get all reference bases in this context. The results are cached in this object for future
   * queries. Will always return an empty array if there is no backing data source and/or interval
   * to query.
   *
   * <p>Call {@link #setWindow} before calling this method if you want to configure the amount of
   * extra reference context to include around the current interval
   *
   * @return reference bases in this context, as a byte array
   */
  public byte[] getBases() {
    if (dataSource == null || window == null) {
      return new byte[0];
    }

    // Only perform a query if we haven't fetched the bases in this context previously
    if (cachedSequence == null) {
      cachedSequence = dataSource.queryAndPrefetch(window);
    }
    return cachedSequence.getBases();
  }