# Interface ReadsDecoder

All Superinterfaces:
  `AutoCloseable, Closeable, HtsDecoder<SAMFileHeader, SAMRecord>, HtsQuery<SAMRecord>, Iterable<SAMRecord>, ReadsQuery<SAMRecord>`

All Known Implementing Classes:
  `BAMDecoder, BAMDecoderV1_0, CRAMDecoder, CRAMDecoderV2_1, CRAMDecoderV3_0, CRAMDecoderV3_1, HtsgetBAMDecoder, HtsgetBAMDecoderV1_2, SAMDecoder, SAMDecoderV1_0`

public interface ReadsDecoder extends HtsDecoder<SAMFileHeader, SAMRecord>, ReadsQuery<SAMRecord>
Base class for all `HtsContentType.ALIGNED_READS` decoders. Defines the type parameters instantiated for reads decoders.

## Method Summary

Modifier and Type
Method
Description
`Optional<SAMRecord>`
`queryMate(SAMRecord rec)`
Fetch the mate for the given read.
`CloseableIterator<SAMRecord>`
`queryUnmapped()`
Get an iterator of unmapped reads.

### Methods inherited from interface HtsDecoder

`close, getDisplayName, getFileFormat, getHeader, getVersion`

### Methods inherited from interface HtsQuery

`hasIndex, isQueryable, iterator, query, query, query, query, queryContained, queryContained, queryContained, queryOverlapping, queryOverlapping, queryOverlapping, queryStart`

### Methods inherited from interface Iterable

`forEach, spliterator`

## Method Details

### queryUnmapped

CloseableIterator<SAMRecord> queryUnmapped()
Get an iterator of unmapped reads. Requires an index resource to be included in the input `Bundle`.

Specified by:
  `queryUnmapped` in interface `ReadsQuery<SAMRecord>`

### queryMate

Optional<SAMRecord> queryMate(SAMRecord rec)
Fetch the mate for the given read. Requires an index resource to be included in the input `Bundle`.

Specified by:
  `queryMate` in interface `ReadsQuery<SAMRecord>`
Parameters:
  `rec` - the source record
Returns:
  the source record's mate, or Optional.empty() if the source record has no mate