# Class SAMDecoderV1_0

java.lang.Object
htsjdk.beta.codecs.reads.sam.SAMDecoder
htsjdk.beta.codecs.reads.sam.samV1_0.SAMDecoderV1_0

All Implemented Interfaces:
  `HtsDecoder<SAMFileHeader, SAMRecord>, HtsQuery<SAMRecord>, ReadsDecoder, ReadsQuery<SAMRecord>, Closeable, AutoCloseable, Iterable<SAMRecord>`

public class SAMDecoderV1_0 extends SAMDecoder
SAM v1.0 decoder.

## Constructor Summary

Constructors
Constructor
Description
`SAMDecoderV1_0(Bundle inputBundle, ReadsDecoderOptions readsDecoderOptions)`
Create a V1.0 SAM decoder for the given input bundle.

## Method Summary

Modifier and Type
Method
Description
`void`
`close()`
Close any resources associated with this decoder.
`SAMFileHeader`
`getHeader()`
Get the file header for this decoder.
`HtsVersion`
`getVersion()`
Get the version of the file format supported by this decoder.
`boolean`
`hasIndex()`
Return true if the underlying resource has an index.
`boolean`
`isQueryable()`
Gte true if the underlying resource is queryable.
`CloseableIterator<SAMRecord>`
`iterator()`
Get an iterator of all records in the underlying resource.
`Optional<SAMRecord>`
`queryMate(SAMRecord rec)`
Fetch the mate for the given read.
`CloseableIterator<SAMRecord>`
`queryUnmapped()`
Get an iterator of unmapped reads.

### Methods inherited from class SAMDecoder

`getDisplayName, getFileFormat, getInputBundle, getReadsDecoderOptions`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface HtsQuery

`query, query, query, query, queryContained, queryContained, queryContained, queryOverlapping, queryOverlapping, queryOverlapping, queryStart`

### Methods inherited from interface Iterable

`forEach, spliterator`

## Constructor Details

### SAMDecoderV1_0

public SAMDecoderV1_0(Bundle inputBundle, ReadsDecoderOptions readsDecoderOptions)
Create a V1.0 SAM decoder for the given input bundle. The primary resource in the bundle must have content type `BundleResourceType.CT_ALIGNED_READS`, and the resource must be an appropriate format and version for this encoder (to find an encoder for a bundle, see `ReadsResolver`.

Parameters:
  `inputBundle` - bundle to decoder
  `readsDecoderOptions` - options to use

## Method Details

### getVersion

public HtsVersion getVersion()
Description copied from interface: `HtsDecoder`
Get the version of the file format supported by this decoder.

### getHeader

public SAMFileHeader getHeader()
Description copied from interface: `HtsDecoder`
Get the file header for this decoder.

Returns:
  the file header for this decoder, of type `H`

### iterator

public CloseableIterator<SAMRecord> iterator()
Description copied from interface: `HtsQuery`
Get an iterator of all records in the underlying resource.

Returns:
  an iterator of all records in the underlying resource

### isQueryable

public boolean isQueryable()
Description copied from interface: `HtsQuery`
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 `HtsQuery.hasIndex()`

### hasIndex

public boolean hasIndex()
Description copied from interface: `HtsQuery`
Return true if the underlying resource has an index.

Returns:
  true if the underlying resource has an index

### close

public void close()
Description copied from interface: `HtsDecoder`
Close any resources associated with this decoder.

### queryUnmapped

public CloseableIterator<SAMRecord> queryUnmapped()
Description copied from interface: `ReadsDecoder`
Get an iterator of unmapped reads. Requires an index resource to be included in the input `Bundle`.

### queryMate

public Optional<SAMRecord> queryMate(SAMRecord rec)
Description copied from interface: `ReadsDecoder`
Fetch the mate for the given read. Requires an index resource to be included in the input `Bundle`.

Parameters:
  `rec` - the source record
Returns:
  the source record's mate, or Optional.empty() if the source record has no mate