Class CRAMCodecV3_0

java.lang.Object
htsjdk.beta.codecs.reads.cram.CRAMCodec
htsjdk.beta.codecs.reads.cram.cramV3_0.CRAMCodecV3_0
All Implemented Interfaces:
HtsCodec<ReadsDecoderOptions,ReadsEncoderOptions>, ReadsCodec, Upgradeable

public class CRAMCodecV3_0 extends CRAMCodec
CRAM v3.0 codec
  • Field Details

    • VERSION_3_0

      public static final HtsVersion VERSION_3_0
  • Constructor Details

    • CRAMCodecV3_0

      public CRAMCodecV3_0()
  • Method Details

    • getVersion

      public HtsVersion getVersion()
      Description copied from interface: HtsCodec
      Get the version of the file format returned by HtsCodec.getFileFormat() that is supported by this codec.
      Returns:
      the file format version (HtsVersion) supported by this codec
    • getSignatureLength

      public int getSignatureLength()
      Description copied from interface: HtsCodec
      Get the number of bytes in the format and version signature used by the file format supported by this codec.
      Returns:
      if the file format supported by this codecs is not remote, and is accessible via a local file or stream, the size of the unique signature/version for this file format. otherwise 0.

      Note: Codecs that are custom URI handlers (those that return true for HtsCodec.ownsURI(htsjdk.io.IOPath)), should always return 0 from this method. Since this method is used during codec resolution, implementations should avoid calling methods that may throw exceptions.
    • canDecodeSignature

      public boolean canDecodeSignature(SignatureStream signatureStream, String sourceName)
      Description copied from interface: HtsCodec
      Determine if the codec can decode an input stream by inspecting a signature embedded within the stream.

      The probingInputStream stream will contain only a fragment of the actual input stream, taken from the start of the stream, the size of which will be the lesser of:

      1. the number of bytes returned by HtsCodec.getSignatureProbeLength()
      2. the entire input stream, for streams that are smaller than HtsCodec.getSignatureProbeLength()

      Codecs that handle custom URIs that reference remote resources (those that return true for HtsCodec.ownsURI(htsjdk.io.IOPath)) should generally not inspect the stream, and should return false from this method, since the method will never be called with any resource for which HtsCodec.ownsURI(htsjdk.io.IOPath) returned true. Since this method is used during codec resolution, implementations should avoid calling methods that may throw exceptions.

      Specified by:
      canDecodeSignature in interface HtsCodec<ReadsDecoderOptions,ReadsEncoderOptions>
      Overrides:
      canDecodeSignature in class CRAMCodec
      Parameters:
      signatureStream - the stream to be inspect for the resource's embedded signature and version
      sourceName - a display name describing the source of the input stream, for use in error messages
      Returns:
      true if this codec recognizes the stream by it's signature, and can provide a decoder to decode the stream, otherwise false
    • getDecoder

      public CRAMDecoder getDecoder(Bundle inputBundle, ReadsDecoderOptions readsDecoderOptions)
      Description copied from interface: HtsCodec
      Get an HtsDecoder to decode the provided inputs. The input bundle must contain resources of the type required by this codec. To find a codec appropriate for decoding a given resource, use an HtsCodecResolver obtained from an HtsCodecRegistry.

      The framework will never call thi* method unless either HtsCodec.ownsURI(IOPath), or HtsCodec.canDecodeURI(IOPath) and HtsCodec.canDecodeSignature(SignatureStream, String) (IOPath)} return true for inputBundle.

      Parameters:
      inputBundle - input to be decoded. To get a decoder for use with index queries that use HtsQuery methods, the bundle must contain an index resource.
      readsDecoderOptions - options for the decoder to use
      Returns:
      an HtsDecoder that can decode the provided inputs
    • getEncoder

      public CRAMEncoder getEncoder(Bundle outputBundle, ReadsEncoderOptions readsEncoderOptions)
      Description copied from interface: HtsCodec
      Get an HtsEncoder to encode to the provided outputs. The output bundle must contain resources of the type required by this codec. To find a codec appropriate for encoding a given resource, use an HtsCodecResolver obtained from an HtsCodecRegistry.

      The framework will never call this method unless either HtsCodec.ownsURI(IOPath), or HtsCodec.canDecodeURI(IOPath) returned true for outputBundle.
      Parameters:
      outputBundle - target output for the encoder
      readsEncoderOptions - encoder options to use
      Returns:
      an HtsEncoder suitable for writing to the provided outputs
    • getSignatureString

      protected String getSignatureString()
      Description copied from class: CRAMCodec
      Get the signature string for this codec.
      Specified by:
      getSignatureString in class CRAMCodec
      Returns:
      the signature string for this codec