Enum Class CRAMCompressionProfile

java.lang.Object
java.lang.Enum<CRAMCompressionProfile>
htsjdk.samtools.cram.structure.CRAMCompressionProfile
All Implemented Interfaces:
Serializable, Comparable<CRAMCompressionProfile>, Constable

public enum CRAMCompressionProfile extends Enum<CRAMCompressionProfile>
Predefined CRAM compression profiles matching those in htslib/samtools. Each profile defines the CRAM version, compression level, reads-per-slice, and a per-DataSeries compressor assignment via CompressorDescriptor.

Usage:

  // Get a strategy for a specific profile:
  CRAMEncodingStrategy strategy = CRAMCompressionProfile.ARCHIVE.toStrategy();

  // Or apply a profile to an existing strategy:
  CRAMCompressionProfile.FAST.applyTo(existingStrategy);
See Also:
  • Enum Constant Details

    • FAST

      public static final CRAMCompressionProfile FAST
      Speed-optimized profile. Uses only GZIP at level 1. Writes CRAM 3.0 since no 3.1-specific codecs are used, avoiding the need for a 3.1-capable reader.
    • NORMAL

      public static final CRAMCompressionProfile NORMAL
      Balanced profile (default). Uses rANS Nx16 for entropy-rich data series, FQZComp for quality scores, and Name Tokeniser for read names. Writes CRAM 3.1.
    • SMALL

      public static final CRAMCompressionProfile SMALL
      Size-optimized profile. Uses GZIP at higher compression level with FQZComp for quality scores. Does not use Name Tokeniser or rANS (matching htslib SMALL behavior). Writes CRAM 3.1.
    • ARCHIVE

      public static final CRAMCompressionProfile ARCHIVE
      Maximum compression profile. Uses rANS Nx16 for entropy-rich data, FQZComp for quality scores, and Name Tokeniser for read names at higher compression settings. Writes CRAM 3.1.

      This profile uses trial compression: multiple codecs are tried per block and the smallest result wins. Additional candidates include BZIP2, the Range (arithmetic) coder, and GZIP.

  • Method Details

    • values

      public static CRAMCompressionProfile[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static CRAMCompressionProfile valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • valueOfCaseInsensitive

      public static CRAMCompressionProfile valueOfCaseInsensitive(String name)
      Look up a profile by name, ignoring case. For example, "archive", "ARCHIVE", and "Archive" all return ARCHIVE.
      Parameters:
      name - the profile name (case-insensitive)
      Returns:
      the matching profile
      Throws:
      IllegalArgumentException - if no profile matches
    • toStrategy

      public CRAMEncodingStrategy toStrategy()
      Create a new CRAMEncodingStrategy configured with this profile's settings.
      Returns:
      a new strategy with this profile applied
    • applyTo

      public void applyTo(CRAMEncodingStrategy strategy)
      Apply this profile's settings to an existing strategy, overwriting the CRAM version, GZIP compression level, reads-per-slice, and compressor map.
      Parameters:
      strategy - the strategy to modify