Class 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:
  • Field Details

    • serialVersionUID

      public static final long serialVersionUID
      See Also:
    • UNAVAILABLE_SEQUENCE_INDEX

      public static final int UNAVAILABLE_SEQUENCE_INDEX
      See Also:
    • SEQUENCE_NAME_TAG

      public static final String SEQUENCE_NAME_TAG
      See Also:
    • ALTERNATIVE_SEQUENCE_NAME_TAG

      public static final String ALTERNATIVE_SEQUENCE_NAME_TAG
      See Also:
    • SEQUENCE_LENGTH_TAG

      public static final String SEQUENCE_LENGTH_TAG
      See Also:
    • MD5_TAG

      public static final String MD5_TAG
      See Also:
    • ASSEMBLY_TAG

      public static final String ASSEMBLY_TAG
      See Also:
    • URI_TAG

      public static final String URI_TAG
      See Also:
    • SPECIES_TAG

      public static final String SPECIES_TAG
      See Also:
    • DESCRIPTION_TAG

      public static final String DESCRIPTION_TAG
      See Also:
    • 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:
    • 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:
    • RESERVED_MRNM_SEQUENCE_NAME

      @Deprecated public static final String RESERVED_MRNM_SEQUENCE_NAME
      Deprecated.
      See Also:
    • 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:
    • 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: