# Interface HtsQuery<RECORD>

Type Parameters:
  `RECORD` - the type of records/iterators returned by queries

All Superinterfaces:
  `Iterable<RECORD>`

All Known Subinterfaces:
  `HaploidReferenceDecoder, HtsDecoder<H,R>, ReadsDecoder, VariantsDecoder`

All Known Implementing Classes:
  `BAMDecoder, BAMDecoderV1_0, CRAMDecoder, CRAMDecoderV2_1, CRAMDecoderV3_0, CRAMDecoderV3_1, FASTADecoderV1_0, HtsgetBAMDecoder, HtsgetBAMDecoderV1_2, SAMDecoder, SAMDecoderV1_0, VCFDecoder, VCFDecoderV3_2, VCFDecoderV3_3, VCFDecoderV4_0, VCFDecoderV4_1, VCFDecoderV4_2, VCFDecoderV4_3`

public interface HtsQuery<RECORD> extends Iterable<RECORD>
Common query interface for `HtsDecoder`s

## Method Summary

Modifier and Type
Method
Description
`boolean`
`hasIndex()`
Return true if the underlying resource has an index.
`boolean`
`isQueryable()`
Gte true if the underlying resource is queryable.
`CloseableIterator<RECORD>`
`iterator()`
Get an iterator of all records in the underlying resource.
`default CloseableIterator<RECORD>`
`query(HtsInterval interval, HtsQueryRule queryRule)`
Get an iterator over all records from the underlying resource that match the query arguments
`default CloseableIterator<RECORD>`
`query(String queryString)`
Get an iterator over all records from the underlying resource that match the query string
`default CloseableIterator<RECORD>`
`query(String queryName, long start, long end, HtsQueryRule queryRule)`
Get an iterator over all records from the underlying resource that match the query arguments
`default CloseableIterator<RECORD>`
`query(List<HtsInterval> intervals, HtsQueryRule queryRule)`
Get an iterator over all records from the underlying resource that match the query arguments.
`default CloseableIterator<RECORD>`
`queryContained(HtsInterval interval)`
Get an iterator over all records from the underlying resource that are contained within the query interval
`default CloseableIterator<RECORD>`
`queryContained(String queryName, long start, long end)`
Gte an iterator over all records from the underlying resource that match the query arguments
`default CloseableIterator<RECORD>`
`queryContained(List<HtsInterval> intervals)`
Get an iterator over all records from the underlying resource that are contained within the query intervals
`default CloseableIterator<RECORD>`
`queryOverlapping(HtsInterval interval)`
Get an iterator over all records from the underlying resource that overlap the query interval
`default CloseableIterator<RECORD>`
`queryOverlapping(String queryName, long start, long end)`
Get an iterator over all records from the underlying resource that match the query arguments
`default CloseableIterator<RECORD>`
`queryOverlapping(List<HtsInterval> intervals)`
Get an iterator over all records from the underlying resource that overlap the query intervals
`default CloseableIterator<RECORD>`
`queryStart(String queryName, long start)`
Get an iterator over all records from the underlying resource that overlap the start position

### Methods inherited from interface Iterable

`forEach, spliterator`

## Method Details

### iterator

CloseableIterator<RECORD> iterator()
Get an iterator of all records in the underlying resource.

Specified by:
  `iterator` in interface `Iterable<RECORD>`
Returns:
  an iterator of all records in the underlying resource

### isQueryable

boolean isQueryable()
Gte true if the underlying resource is queryable.

Returns:
  true if the underlying resource is queryable. this may be true even if the underlying resource returns false for `hasIndex()`

### hasIndex

boolean hasIndex()
Return true if the underlying resource has an index.

Returns:
  true if the underlying resource has an index

### query

default CloseableIterator<RECORD> query(String queryString)
Get an iterator over all records from the underlying resource that match the query string

Parameters:
  `queryString` - decoder specific query string
Returns:
  an iterator over all records from the underlying resource that match the query string

### query

default CloseableIterator<RECORD> query(String queryName, long start, long end, HtsQueryRule queryRule)
Get an iterator over all records from the underlying resource that match the query arguments

Parameters:
  `queryName` - name to match
  `start` - start of query interval
  `end` - end of query interval
  `queryRule` - query rule value to use (from `HtsQueryRule`
Returns:
  an iterator over all records from the underlying resource that match the query arguments

### queryOverlapping

default CloseableIterator<RECORD> queryOverlapping(String queryName, long start, long end)
Get an iterator over all records from the underlying resource that match the query arguments

Parameters:
  `queryName` - name to match
  `start` - start of query interval
  `end` - end of query interval
Returns:
  an iterator over all records from the underlying resource that match the query arguments

### queryContained

default CloseableIterator<RECORD> queryContained(String queryName, long start, long end)
Gte an iterator over all records from the underlying resource that match the query arguments

Parameters:
  `queryName` - name to match
  `start` - start of query interval
  `end` - end of query interval
Returns:
  an iterator over all records from the underlying resource that match the query arguments

### query

default CloseableIterator<RECORD> query(HtsInterval interval, HtsQueryRule queryRule)
Get an iterator over all records from the underlying resource that match the query arguments

Parameters:
  `interval` - interval to match
  `queryRule` - query rule to use, from `HtsQueryRule`
Returns:
  an iterator over all records from the underlying resource that match the query arguments

### queryOverlapping

default CloseableIterator<RECORD> queryOverlapping(HtsInterval interval)
Get an iterator over all records from the underlying resource that overlap the query interval

Parameters:
  `interval` - interval to match
Returns:
  an iterator over all records from the underlying resource that overlap the query interval

### queryContained

default CloseableIterator<RECORD> queryContained(HtsInterval interval)
Get an iterator over all records from the underlying resource that are contained within the query interval

Parameters:
  `interval` - interval to match
Returns:
  an iterator over all records from the underlying resource that are contained within the query interval

### query

default CloseableIterator<RECORD> query(List<HtsInterval> intervals, HtsQueryRule queryRule)
Get an iterator over all records from the underlying resource that match the query arguments. Callers much ensure that the intervals are in increasing order and do not overlap or abut.

Parameters:
  `intervals` - list of intervals to match
  `queryRule` - query rule to use, from `HtsQueryRule`
Returns:
  an iterator over all records from the underlying resource that match the query arguments

### queryOverlapping

default CloseableIterator<RECORD> queryOverlapping(List<HtsInterval> intervals)
Get an iterator over all records from the underlying resource that overlap the query intervals

Parameters:
  `intervals` - list of intervals to use
Returns:
  an iterator over all records from the underlying resource that overlap the query intervals

### queryContained

default CloseableIterator<RECORD> queryContained(List<HtsInterval> intervals)
Get an iterator over all records from the underlying resource that are contained within the query intervals

Parameters:
  `intervals` - list of intervals to use
Returns:
  an iterator over all records from the underlying resource that are contained within the query intervals

### queryStart

default CloseableIterator<RECORD> queryStart(String queryName, long start)
Get an iterator over all records from the underlying resource that overlap the start position

Parameters:
  `queryName` - name to match
  `start` - start position to overlap
Returns:
  an iterator over all records from the underlying resource that overlap the start position