Package htsjdk.samtools.reference

# Class ReferenceSequence

java.lang.Object
htsjdk.samtools.reference.ReferenceSequence

All Implemented Interfaces:
  `HtsRecord`

public class ReferenceSequence extends Object implements HtsRecord
Wrapper around a reference sequence that has been read from a reference file.

## Constructor Summary

Constructors
Constructor
Description
`ReferenceSequence(String name, int index, byte[] bases)`
creates a fully formed ReferenceSequence

## Method Summary

Modifier and Type
Method
Description
`byte[]`
`getBases()`
Gets the array of bases that define this sequence.
`String`
`getBaseString()`
Returns the bases represented by this ReferenceSequence as a String.
`int`
`getContigIndex()`
Gets the 0-based index of this contig in the source file from which it came.
`String`
`getName()`
Gets the set of names given to this sequence in the source file.
`int`
`length()`
Gets the length of this reference sequence in bases.
`String`
`toString()`

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

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### ReferenceSequence

public ReferenceSequence(String name, int index, byte[] bases)
creates a fully formed ReferenceSequence

Parameters:
  `name` - the name of the sequence from the source file
  `index` - the zero based index of this contig in the source file
  `bases` - the bases themselves stored as one-byte characters

## Method Details

### getName

public String getName()
Gets the set of names given to this sequence in the source file.

### getBases

public byte[] getBases()
Gets the array of bases that define this sequence. The bases can include any letter and possibly include masking information in the form of lower case letters. This array is mutable (obviously!) and it NOT a clone of the array held interally. Do not modify it!!!

### getBaseString

public String getBaseString()
Returns the bases represented by this ReferenceSequence as a String. Since this will copy the bases and convert them to two-byte characters, this should not be used on very long reference sequences, but as a convenience when manipulating short sequences returned by `ReferenceSequenceFile.getSubsequenceAt(String, long, long)`

Returns:
  The set of bases represented by this ReferenceSequence, as a String

### getContigIndex

public int getContigIndex()
Gets the 0-based index of this contig in the source file from which it came.

### length

public int length()
Gets the length of this reference sequence in bases.

### toString

public String toString()

Overrides:
  `toString` in class `Object`