Package htsjdk.beta.plugin.registry

# Class ReadsResolver

java.lang.Object
htsjdk.beta.plugin.registry.HtsCodecResolver<ReadsCodec>
htsjdk.beta.plugin.registry.ReadsResolver

public class ReadsResolver extends HtsCodecResolver<ReadsCodec>
Class with methods for resolving inputs and outputs to reads encoders and decoders.

Provides a convenient typesafe layer over the `HtsCodecResolver` used by an `HtsCodecRegistry` to manage `ReadsCodec`s (see `HtsCodecRegistry.getHaploidReferenceResolver()`).

Provides typesafe conversion of argument and return types to types that conform to those used with `ReadsCodec`s, such as `ReadsDecoder`, `ReadsEncoder`, `ReadsDecoderOptions`.

## Constructor Summary

Constructors
Constructor
Description
`ReadsResolver()`
Create a ReadsResolver.

## Method Summary

Modifier and Type
Method
Description
`protected List<ReadsCodec>`
`filterByVersion(List<ReadsCodec> candidateCodecs, HtsVersion htsVersion)`
Temporarily override to remove the CRAM 3.1 codec from the list of candidate codecs when the request is for the newest version, since it has no write implementation yet.
`ReadsDecoder`
`getReadsDecoder(Bundle inputBundle)`
Get a `ReadsDecoder` suitable for decoding `inputBundle`.
`ReadsDecoder`
`getReadsDecoder(Bundle inputBundle, ReadsDecoderOptions readsDecoderOptions)`
Get a `ReadsDecoder` suitable for decoding `inputBundle` using options in `readsDecoderOptions`.
`ReadsDecoder`
`getReadsDecoder(IOPath inputPath)`
Get a `ReadsDecoder` suitable for decoding `inputPath`.
`ReadsDecoder`
`getReadsDecoder(IOPath inputPath, ReadsDecoderOptions readsDecoderOptions)`
Grt a `ReadsDecoder` suitable for decoding `inputPath` using options in `readsDecoderOptions`.
`ReadsEncoder`
`getReadsEncoder(Bundle outputBundle, ReadsEncoderOptions readsEncoderOptions)`
Get a `ReadsEncoder` suitable for encoding to `outputBundle`, using the options in `readsEncoderOptions`.
`ReadsEncoder`
`getReadsEncoder(Bundle outputBundle, ReadsEncoderOptions readsEncoderOptions, String readsFormat, HtsVersion formatVersion)`
Get a `ReadsEncoder` suitable for encoding to `outputBundle`, using the options in `readsEncoderOptions`, and the file format and version specified in readsFormat and formatVersion.
`ReadsEncoder`
`getReadsEncoder(IOPath outputPath)`
Get a `ReadsEncoder` suitable for encoding to `outputPath`.
`ReadsEncoder`
`getReadsEncoder(IOPath outputPath, ReadsEncoderOptions readsEncoderOptions)`
Get a `ReadsEncoder` suitable for encoding to `outputPath`, using the options in `readsEncoderOptions`.

### Methods inherited from class htsjdk.beta.plugin.registry.HtsCodecResolver

`getCodecs, registerCodec, resolveForDecoding, resolveForEncoding, resolveForEncoding, resolveForFormat, resolveFormatAndVersion`

### Methods inherited from class java.lang.Object

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

## Constructor Details

### ReadsResolver

public ReadsResolver()
Create a ReadsResolver.

## Method Details

### getReadsDecoder

public ReadsDecoder getReadsDecoder(IOPath inputPath)
Get a `ReadsDecoder` suitable for decoding `inputPath`. The `inputPath` is inspected to determine the appropriate file format/version. The index is automatically resolved. To bypass index resolution, use `getReadsDecoder(htsjdk.io.IOPath)`.

Parameters:
  `inputPath` - the IOPath to be decoded
Returns:
  a `ReadsDecoder` suitable for decoding `inputPath`
Throws:
  `HtsjdkException` - if no registered codecs can handle the resource
  `HtsjdkPluginException` - if more than one codec claims to handle the resource. this usually indicates that the registry contains an incorrectly written codec.

### getReadsDecoder

public ReadsDecoder getReadsDecoder(IOPath inputPath, ReadsDecoderOptions readsDecoderOptions)
Grt a `ReadsDecoder` suitable for decoding `inputPath` using options in `readsDecoderOptions`. The `inputPath` is inspected to determine the appropriate file format/version. The index is automatically resolved. To bypass index resolution, use `getReadsDecoder(htsjdk.io.IOPath)`.

Parameters:
  `inputPath` - the IOPath to be decoded
  `readsDecoderOptions` - options to use
Returns:
  a `ReadsDecoder` suitable for decoding `inputPath`
Throws:
  `HtsjdkException` - if no registered codecs can handle the resource
  `HtsjdkPluginException` - if more than one codec claims to handle the resource. this usually indicates that the registry contains an incorrectly written codec.

### getReadsDecoder

public ReadsDecoder getReadsDecoder(Bundle inputBundle)
Get a `ReadsDecoder` suitable for decoding `inputBundle`. The `inputBundle` is inspected to determine the appropriate file format/version.

Parameters:
  `inputBundle` - the bundle to be decoded
Returns:
  a `ReadsDecoder` suitable for decoding `inputBundle`
Throws:
  `HtsjdkException` - if no registered codecs can handle the resource
  `HtsjdkPluginException` - if more than one codec claims to handle the resource. this usually indicates that the registry contains an incorrectly written codec.

### getReadsDecoder

public ReadsDecoder getReadsDecoder(Bundle inputBundle, ReadsDecoderOptions readsDecoderOptions)
Get a `ReadsDecoder` suitable for decoding `inputBundle` using options in `readsDecoderOptions`. The `inputBundle` is inspected to determine the appropriate file format/version.

Parameters:
  `inputBundle` - the bundle to be decoded
  `readsDecoderOptions` - `ReadsDecoderOptions` options to be used by the decoder
Returns:
  a `ReadsDecoder` suitable for decoding `inputBundle`
Throws:
  `HtsjdkException` - if no registered codecs can handle the resource
  `HtsjdkPluginException` - if more than one codec claims to handle the resource. this usually indicates that the registry contains an incorrectly written codec.

### getReadsEncoder

public ReadsEncoder getReadsEncoder(IOPath outputPath)
Get a `ReadsEncoder` suitable for encoding to `outputPath`. The path must include a file extension suitable for determining the appropriate file format to use; the newest version of the file format available will be used. To request a specific file format and/or version, use `getReadsEncoder(Bundle, ReadsEncoderOptions, String, HtsVersion)`.

Parameters:
  `outputPath` - the IOPath target for encoding
Returns:
  a `ReadsEncoder` suitable for encoding to `outputPath`
Throws:
  `HtsjdkException` - if no registered codecs can handle the resource
  `HtsjdkPluginException` - if more than one codec claims to handle the resource. this usually indicates that the registry contains an incorrectly written codec.

### getReadsEncoder

public ReadsEncoder getReadsEncoder(IOPath outputPath, ReadsEncoderOptions readsEncoderOptions)
Get a `ReadsEncoder` suitable for encoding to `outputPath`, using the options in `readsEncoderOptions`. The path must include a file extension suitable for determining the appropriate file format to use; the newest version of the file format available will be used. To request a specific file format and/or version, use `getReadsEncoder(Bundle, ReadsEncoderOptions, String, HtsVersion)`.

Parameters:
  `outputPath` - target path to encode
  `readsEncoderOptions` - `ReadsEncoderOptions` options to be used by the encoder
Returns:
  `ReadsEncoder` suitable for encoding to `outputPath`
Throws:
  `HtsjdkException` - if no registered codecs can handle the resource
  `HtsjdkPluginException` - if more than one codec claims to handle the resource. this usually indicates that the registry contains an incorrectly written codec.

### getReadsEncoder

public ReadsEncoder getReadsEncoder(Bundle outputBundle, ReadsEncoderOptions readsEncoderOptions)
Get a `ReadsEncoder` suitable for encoding to `outputBundle`, using the options in `readsEncoderOptions`. The outputBundle must include a primary resource with a file extension suitable for determining the appropriate file format to use; or the resource must include a format. The newest version of the selected file format available will be used. To request a specific file format and/or version, use `getReadsEncoder(Bundle, ReadsEncoderOptions, String, HtsVersion)`.

Parameters:
  `outputBundle` - target output to encode to
  `readsEncoderOptions` - `ReadsEncoderOptions` to be used by the encoder
Returns:
  `ReadsEncoder` suitable for encoding to `outputPath`
Throws:
  `HtsjdkException` - if no registered codecs can handle the resource
  `HtsjdkPluginException` - if more than one codec claims to handle the resource. this usually indicates that the registry contains an incorrectly written codec.

### getReadsEncoder

public ReadsEncoder getReadsEncoder(Bundle outputBundle, ReadsEncoderOptions readsEncoderOptions, String readsFormat, HtsVersion formatVersion)
Get a `ReadsEncoder` suitable for encoding to `outputBundle`, using the options in `readsEncoderOptions`, and the file format and version specified in readsFormat and formatVersion.

Parameters:
  `outputBundle` - target output bundle
  `readsEncoderOptions` - encode options to be used by the encoder
  `readsFormat` - target file format
  `formatVersion` - target file format version
Returns:
  `ReadsEncoder` suitable for encoding to `outputBundle`
Throws:
  `HtsjdkException` - if no registered codecs can handle the resource
  `HtsjdkPluginException` - if more than one codec claims to handle the resource. this usually indicates that the registry contains an incorrectly written codec.

### filterByVersion

protected List<ReadsCodec> filterByVersion(List<ReadsCodec> candidateCodecs, HtsVersion htsVersion)
Temporarily override to remove the CRAM 3.1 codec from the list of candidate codecs when the request is for the newest version, since it has no write implementation yet.

Overrides:
  `filterByVersion` in class `HtsCodecResolver<ReadsCodec>`