Class SAMFileHeader

    • Constructor Detail

      • SAMFileHeader

        public SAMFileHeader()
      • SAMFileHeader

        public SAMFileHeader​(SAMSequenceDictionary dict)
        Constructor that initializes the sequence dictionary with the provided one.
    • Method Detail

      • getVersion

        public String getVersion()
      • getCreator

        public String getCreator()
      • getSequence

        public SAMSequenceRecord getSequence​(String name)
        Look up sequence record by name.
        Returns:
        sequence record if it's found by name, or null if sequence dictionary is empty or if the sequence is not found in the dictionary.
      • setSequenceDictionary

        public void setSequenceDictionary​(SAMSequenceDictionary sequenceDictionary)
        Replace entire sequence dictionary. The given sequence dictionary is stored, not copied.
      • getSequence

        public SAMSequenceRecord getSequence​(int sequenceIndex)
        Look up a sequence record by index. First sequence in the header is the 0th.
        Returns:
        The corresponding sequence record, or null if the index is out of range.
      • getSequenceIndex

        public int getSequenceIndex​(String sequenceName)
        Returns:
        Sequence index for the given sequence name, or -1 if the name is not found.
      • setReadGroups

        public void setReadGroups​(List<SAMReadGroupRecord> readGroups)
        Replace entire list of read groups. The given list is stored, not copied.
      • addProgramRecord

        public void addProgramRecord​(SAMProgramRecord programRecord)
      • setProgramRecords

        public void setProgramRecords​(List<SAMProgramRecord> programRecords)
        Replace entire list of program records
        Parameters:
        programRecords - This list is used directly, not copied.
      • createProgramRecord

        public SAMProgramRecord createProgramRecord()
        Returns:
        a new SAMProgramRecord with an ID guaranteed to not exist in this SAMFileHeader
      • 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.
        Overrides:
        setAttribute in class AbstractSAMHeaderRecord
        Parameters:
        key - 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.
        Overrides:
        setAttribute in class AbstractSAMHeaderRecord
        Parameters:
        key - attribute name
        value - attribute value
      • getTextHeader

        public String getTextHeader()
        If this SAMHeader was read from a file, this property contains the header as it appeared in the file, otherwise it is null. Note that this is not a toString() operation. Changes to the SAMFileHeader object after reading from the file are not reflected in this value. In addition this value is only set if one of the following is true: - The size of the header is < 1,048,576 characters (1MB ascii, 2MB unicode) - There are either validation or parsing errors associated with the header Invalid header lines may appear in value but are not stored in the SAMFileHeader object.
      • setTextHeader

        public void setTextHeader​(String textHeader)
      • addComment

        public void addComment​(String comment)
      • setComments

        public void setComments​(Collection<String> comments)
        Replace existing comments with the contents of the given collection.
      • setValidationErrors

        public void setValidationErrors​(Collection<SAMValidationError> errors)
        Replace list of validation errors with the elements of the given list.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object