Class CramHeader


  • public final class CramHeader
    extends Object
    A starting object when dealing with CRAM files. A CramHeader holds 2 things: 1. File format definition, including content id and version information 2. SAM file header
    • Field Detail

      • MAGIC

        public static final byte[] MAGIC
    • Constructor Detail

      • CramHeader

        public CramHeader​(Version version,
                          String id,
                          SAMFileHeader samFileHeader)
        Create a new CramHeader object with the specified version, id and SAM file header. The id field by default is guaranteed to be byte[20].
        Parameters:
        version - the CRAM version to assume
        id - an identifier of the content associated with this header
        samFileHeader - the SAM file header
    • Method Detail

      • setID

        public void setID​(String stringID)
        Set the id of the header. A typical use is for example file name to be used when streaming or a checksum of the data contained in the file.
        Parameters:
        stringID - a new id; only first 20 bytes from byte representation of java String will be used.
      • clone

        public CramHeader clone()
        Copy the CRAM header into a new CramHeader object.
        Overrides:
        clone in class Object
        Returns:
        a complete copy of the header
      • equals

        public boolean equals​(Object obj)
        Checks if content of a header is the same as this one.
        Overrides:
        equals in class Object
        Parameters:
        obj - another header to compare to
        Returns:
        true if versions, ids and SAM file header are exactly the same, false otherwise
      • getSamFileHeader

        public SAMFileHeader getSamFileHeader()
        Get the SAMFileHeader object associated with this CRAM file header.
        Returns:
        the SAM file header
      • getId

        public byte[] getId()
      • getVersion

        public Version getVersion()
      • setVersion

        public void setVersion​(Version version)