Package htsjdk.samtools

# Class SAMSequenceRecord

java.lang.Object
htsjdk.samtools.AbstractSAMHeaderRecord
htsjdk.samtools.SAMSequenceRecord

All Implemented Interfaces:
  `Locatable`, `Serializable`, `Cloneable`

public class SAMSequenceRecord extends AbstractSAMHeaderRecord implements Cloneable, Locatable
Header information about a reference sequence. Corresponds to @SQ header record in SAM text header.

See Also:
  - Serialized Form

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`ALTERNATIVE_SEQUENCE_NAME_TAG`
`static final String`
`ASSEMBLY_TAG`
`static final String`
`DESCRIPTION_TAG`
`static final String`
`MD5_TAG`
`static final String`
`RESERVED_MRNM_SEQUENCE_NAME`
Deprecated.
`static final String`
`RESERVED_RNEXT_SEQUENCE_NAME`
This is not a valid sequence name, because it is reserved in the RNEXT field of SAM text format to mean "same reference as RNAME field."
`static final String`
`SEQUENCE_LENGTH_TAG`
`static final String`
`SEQUENCE_NAME_TAG`
`static final long`
`serialVersionUID`
`static final String`
`SPECIES_TAG`
`static final Set<String>`
`STANDARD_TAGS`
The standard tags are stored in text header without type information, because the type of these tags is known.
`static final int`
`UNAVAILABLE_SEQUENCE_INDEX`
`static final int`
`UNKNOWN_SEQUENCE_LENGTH`
If one sequence has this length, and another sequence had a different length, isSameSequence will not complain that they are different sequences.
`static final String`
`URI_TAG`

## Constructor Summary

Constructors
Constructor
Description
`SAMSequenceRecord(String name)`
Deprecated.
Use `SAMSequenceRecord(String, int)` instead.
`SAMSequenceRecord(String name, int sequenceLength)`

## Method Summary

Modifier and Type
Method
Description
`void`
`addAlternativeSequenceName(String name)`
Adds an alternative sequence name if it is not the same as the sequence name or it is not present already.
`final SAMSequenceRecord`
`clone()`
`boolean`
`equals(Object o)`
`Set<String>`
`getAlternativeSequenceNames()`
Returns unmodifiable set with alternative sequence names.
`String`
`getAssembly()`
`final String`
`getContig()`
always returns `getSequenceName()`
`String`
`getDescription()`
`final int`
`getEnd()`
always returns `getSequenceLength()`
`String`
`getMd5()`
`String`
`getSAMString()`
Returns the record in the SAM line-based text format.
`int`
`getSequenceIndex()`
`int`
`getSequenceLength()`
`String`
`getSequenceName()`
`String`
`getSpecies()`
`final int`
`getStart()`
always returns 1
`boolean`
`hasAlternativeSequenceNames()`
Returns `true` if there are alternative sequence names; `false` otherwise.
`int`
`hashCode()`
`boolean`
`isSameSequence(SAMSequenceRecord that)`
Looser comparison than equals().
`SAMSequenceRecord`
`setAlternativeSequenceName(Collection<String> alternativeSequences)`
Sets the alternative sequence names in the order provided by iteration, removing the previous values.
`SAMSequenceRecord`
`setAssembly(String value)`
`SAMSequenceRecord`
`setDescription(String value)`
`SAMSequenceRecord`
`setMd5(String value)`
`SAMSequenceRecord`
`setSequenceIndex(int value)`
`SAMSequenceRecord`
`setSequenceLength(int value)`
`SAMSequenceRecord`
`setSpecies(String value)`
`String`
`toString()`
Simple to String that outputs the concrete class name and the set of attributes stored.
`static String`
`truncateSequenceName(String sequenceName)`
Truncate sequence name at first whitespace.
`static void`
`validateSequenceName(String name)`
Throw an exception if the sequence name is not valid.

### Methods inherited from class htsjdk.samtools.AbstractSAMHeaderRecord

`attributesEqual, attributesHashCode, getAttribute, getAttributes, getId, setAttribute, setAttribute, setAttribute`

### Methods inherited from class java.lang.Object

`finalize, getClass, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface htsjdk.samtools.util.Locatable

`contains, contigsMatch, getLengthOnReference, overlaps, withinDistanceOf`

## Field Details

### serialVersionUID

public static final long serialVersionUID

See Also:
  - Constant Field Values

### UNAVAILABLE_SEQUENCE_INDEX

public static final int UNAVAILABLE_SEQUENCE_INDEX

See Also:
  - Constant Field Values

### SEQUENCE_NAME_TAG

public static final String SEQUENCE_NAME_TAG

See Also:
  - Constant Field Values

### ALTERNATIVE_SEQUENCE_NAME_TAG

public static final String ALTERNATIVE_SEQUENCE_NAME_TAG

See Also:
  - Constant Field Values

### SEQUENCE_LENGTH_TAG

public static final String SEQUENCE_LENGTH_TAG

See Also:
  - Constant Field Values

### MD5_TAG

public static final String MD5_TAG

See Also:
  - Constant Field Values

### ASSEMBLY_TAG

public static final String ASSEMBLY_TAG

See Also:
  - Constant Field Values

### URI_TAG

public static final String URI_TAG

See Also:
  - Constant Field Values

### SPECIES_TAG

public static final String SPECIES_TAG

See Also:
  - Constant Field Values

### DESCRIPTION_TAG

public static final String DESCRIPTION_TAG

See Also:
  - Constant Field Values

### UNKNOWN_SEQUENCE_LENGTH

public static final int UNKNOWN_SEQUENCE_LENGTH
If one sequence has this length, and another sequence had a different length, isSameSequence will not complain that they are different sequences.

See Also:
  - Constant Field Values

### RESERVED_RNEXT_SEQUENCE_NAME

public static final String RESERVED_RNEXT_SEQUENCE_NAME
This is not a valid sequence name, because it is reserved in the RNEXT field of SAM text format to mean "same reference as RNAME field."

See Also:
  - Constant Field Values

### RESERVED_MRNM_SEQUENCE_NAME

@Deprecated public static final String RESERVED_MRNM_SEQUENCE_NAME
Deprecated.

See Also:
  - Constant Field Values

### STANDARD_TAGS

public static final Set<String> STANDARD_TAGS
The standard tags are stored in text header without type information, because the type of these tags is known.

## Constructor Details

### SAMSequenceRecord

@Deprecated public SAMSequenceRecord(String name)
Deprecated.
Use `SAMSequenceRecord(String, int)` instead. sequenceLength is required for the object to be considered valid.

### SAMSequenceRecord

public SAMSequenceRecord(String name, int sequenceLength)

## Method Details

### getSequenceName

public String getSequenceName()

### getSequenceLength

public int getSequenceLength()

### setSequenceLength

public SAMSequenceRecord setSequenceLength(int value)

### getAssembly

public String getAssembly()

### setAssembly

public SAMSequenceRecord setAssembly(String value)

### getSpecies

public String getSpecies()

### setSpecies

public SAMSequenceRecord setSpecies(String value)

### getMd5

public String getMd5()

### setMd5

public SAMSequenceRecord setMd5(String value)

### getDescription

public String getDescription()

### setDescription

public SAMSequenceRecord setDescription(String value)

### getSequenceIndex

public int getSequenceIndex()

Returns:
  Index of this record in the sequence dictionary it lives in.

### setSequenceIndex

public SAMSequenceRecord setSequenceIndex(int value)

### getAlternativeSequenceNames

public Set<String> getAlternativeSequenceNames()
Returns unmodifiable set with alternative sequence names.

### addAlternativeSequenceName

public void addAlternativeSequenceName(String name)
Adds an alternative sequence name if it is not the same as the sequence name or it is not present already.

### setAlternativeSequenceName

public SAMSequenceRecord setAlternativeSequenceName(Collection<String> alternativeSequences)
Sets the alternative sequence names in the order provided by iteration, removing the previous values.

### hasAlternativeSequenceNames

public boolean hasAlternativeSequenceNames()
Returns `true` if there are alternative sequence names; `false` otherwise.

### isSameSequence

public boolean isSameSequence(SAMSequenceRecord that)
Looser comparison than equals(). We look only at sequence index, sequence length, and MD5 tag value (or sequence names, if there is no MD5 tag in either record.

### equals

public boolean equals(Object o)

Overrides:
  `equals` in class `Object`

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Object`

### clone

public final SAMSequenceRecord clone()

Overrides:
  `clone` in class `Object`

### truncateSequenceName

public static String truncateSequenceName(String sequenceName)
Truncate sequence name at first whitespace.

### validateSequenceName

public static void validateSequenceName(String name)
Throw an exception if the sequence name is not valid.

### toString

public String toString()
Description copied from class: `AbstractSAMHeaderRecord`
Simple to String that outputs the concrete class name and the set of attributes stored.

Overrides:
  `toString` in class `AbstractSAMHeaderRecord`

### getSAMString

public String 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 class `AbstractSAMHeaderRecord`

### getContig

public final String getContig()
always returns `getSequenceName()`

Specified by:
  `getContig` in interface `Locatable`
Returns:
  name of the contig this is mapped to, potentially null
See Also:
  - `getSequenceName()`

### getStart

public final int getStart()
always returns 1

Specified by:
  `getStart` in interface `Locatable`
Returns:
  1-based start position, undefined if getContig() == null

### getEnd

public final int getEnd()
always returns `getSequenceLength()`

Specified by:
  `getEnd` in interface `Locatable`
Returns:
  1-based closed-ended position, undefined if getContig() == null
See Also:
  - `getSequenceLength()`