Class AbstractSAMHeaderRecord

java.lang.Object
htsjdk.samtools.AbstractSAMHeaderRecord
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
SAMFileHeader, SAMProgramRecord, SAMReadGroupRecord, SAMSequenceRecord

public abstract class AbstractSAMHeaderRecord extends Object implements Serializable
Base class for the various concrete records in a SAM header, providing uniform access to the attributes.
See Also:
  • Field Details

  • Constructor Details

    • AbstractSAMHeaderRecord

      public AbstractSAMHeaderRecord()
  • Method Details

    • getAttribute

      public String getAttribute(String key)
    • setAttribute

      @Deprecated public void setAttribute(String key, Object value)
      Deprecated.
      Set the given value for the attribute named 'key'. Replaces an existing value, if any. If value is null, the attribute is removed. Otherwise, the value will be converted to a String with toString.
      Parameters:
      key - attribute name
      value - attribute value
    • setAttribute

      public void setAttribute(SAMTag tag, String value)
      Set the given value for the SAMTag 'tag'. Replaces an existing value, if any. If value is null, the attribute is removed.
      Parameters:
      tag - attribute name
      value - attribute value
    • setAttribute

      public void setAttribute(String key, String value)
      Set the given value for the attribute named 'key'. Replaces an existing value, if any. If value is null, the attribute is removed.
      Parameters:
      key - attribute name
      value - attribute value
    • getAttributes

      public Set<Map.Entry<String,String>> getAttributes()
      Returns the Set of attributes.
    • getId

      public String getId()
      Returns the ID tag (or equivalent) for this header record. The default implementation throws a SAMException to indicate "not implemented".
    • attributesEqual

      protected boolean attributesEqual(AbstractSAMHeaderRecord that)
      For use in the equals() method of the concrete class.
    • attributesHashCode

      protected int attributesHashCode()
      For use in the hashCode() method of the concrete class.
    • toString

      public String toString()
      Simple to String that outputs the concrete class name and the set of attributes stored.
      Overrides:
      toString in class Object
    • getSAMString

      public abstract String getSAMString()
      Returns the record in the SAM line-based text format. Fields are separated by '\t' characters. The String is NOT terminated by '\n'.