Package htsjdk.samtools
Class SAMFileHeader
java.lang.Object
htsjdk.samtools.AbstractSAMHeaderRecord
htsjdk.samtools.SAMFileHeader
- All Implemented Interfaces:
HtsHeader
,Serializable
Header information from a SAM or BAM file.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
static class
Little class to generate program group IDsstatic enum
Ways in which a SAM or BAM may be sorted. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
static final String
These tags are of known type, so don't need a type field in the text representation.static final String
Fields inherited from class htsjdk.samtools.AbstractSAMHeaderRecord
serialVersionUID
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor that initializes the sequence dictionary with the provided one. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addComment
(String comment) void
addProgramRecord
(SAMProgramRecord programRecord) void
addReadGroup
(SAMReadGroupRecord readGroup) void
addSequence
(SAMSequenceRecord sequenceRecord) void
final SAMFileHeader
clone()
boolean
getProgramRecord
(String pgId) getReadGroup
(String name) Look up read group record by name.Returns the record in the SAM line-based text format.getSequence
(int sequenceIndex) Look up a sequence record by index.getSequence
(String name) Look up sequence record by name.int
getSequenceIndex
(String sequenceName) Deprecated.since May 1st 2019 - text version of header is no longer stored.int
hashCode()
void
setAttribute
(String key, Object value) Deprecated.void
setAttribute
(String key, String value) Set the given value for the attribute named 'key'.void
setComments
(Collection<String> comments) Replace existing comments with the contents of the given collection.void
void
setProgramRecords
(List<SAMProgramRecord> programRecords) Replace entire list of program recordsvoid
setReadGroups
(List<SAMReadGroupRecord> readGroups) Replace entire list of read groups.void
setSequenceDictionary
(SAMSequenceDictionary sequenceDictionary) Replace entire sequence dictionary.void
void
setTextHeader
(String textHeader) Deprecated.since May 1st 2019 - text version of header is no longer stored.void
Replace list of validation errors with the elements of the given list.Methods inherited from class htsjdk.samtools.AbstractSAMHeaderRecord
attributesEqual, attributesHashCode, getAttribute, getAttributes, getId, setAttribute, toString
-
Field Details
-
VERSION_TAG
- See Also:
-
SORT_ORDER_TAG
- See Also:
-
GROUP_ORDER_TAG
- See Also:
-
CURRENT_VERSION
- See Also:
-
ACCEPTABLE_VERSIONS
-
STANDARD_TAGS
These tags are of known type, so don't need a type field in the text representation.
-
-
Constructor Details
-
SAMFileHeader
public SAMFileHeader() -
SAMFileHeader
Constructor that initializes the sequence dictionary with the provided one.
-
-
Method Details
-
getVersion
-
getCreator
-
getSequenceDictionary
-
getReadGroups
-
getSequence
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.
-
getReadGroup
Look up read group record by name. -
setSequenceDictionary
Replace entire sequence dictionary. The given sequence dictionary is stored, not copied. -
addSequence
-
getSequence
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
- Returns:
- Sequence index for the given sequence name, or -1 if the name is not found.
-
setReadGroups
Replace entire list of read groups. The given list is stored, not copied. -
addReadGroup
-
getProgramRecords
-
addProgramRecord
-
getProgramRecord
-
setProgramRecords
Replace entire list of program records- Parameters:
programRecords
- This list is used directly, not copied.
-
createProgramRecord
- Returns:
- a new SAMProgramRecord with an ID guaranteed to not exist in this SAMFileHeader
-
getSortOrder
-
setSortOrder
-
getGroupOrder
-
setGroupOrder
-
setAttribute
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 classAbstractSAMHeaderRecord
- Parameters:
key
- attribute namevalue
- attribute value
-
setAttribute
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 classAbstractSAMHeaderRecord
- Parameters:
key
- attribute namevalue
- attribute value
-
getTextHeader
Deprecated.since May 1st 2019 - text version of header is no longer stored. -
setTextHeader
Deprecated.since May 1st 2019 - text version of header is no longer stored. -
getComments
-
addComment
-
setComments
Replace existing comments with the contents of the given collection. -
getValidationErrors
-
addValidationError
-
setValidationErrors
Replace list of validation errors with the elements of the given list. -
equals
-
hashCode
public int hashCode() -
clone
-
getSAMString
Description copied from class:AbstractSAMHeaderRecord
Returns the record in the SAM line-based text format. Fields are separated by '\t' characters. The String is NOT terminated by '\n'.- Specified by:
getSAMString
in classAbstractSAMHeaderRecord
-