public class CRAMReferenceRegion
extends java.lang.Object
fetchReferenceBases(int)
or fetchReferenceBasesByRegion(int, int, int)
. It caches the bases
from the previous request, along with metadata about the (0-based) start offset, and length of the
cached bases.Modifier and Type | Field and Description |
---|---|
static int |
UNINITIALIZED_LENGTH |
static int |
UNINITIALIZED_START |
Constructor and Description |
---|
CRAMReferenceRegion(CRAMReferenceSource cramReferenceSource,
SAMSequenceDictionary sequenceDictionary) |
Modifier and Type | Method and Description |
---|---|
void |
fetchReferenceBases(int referenceIndex)
Return the reference bases for an entire contig given a reference contig index.
|
void |
fetchReferenceBasesByRegion(AlignmentContext alignmentContext)
Fetch the bases to span an
AlignmentContext . |
void |
fetchReferenceBasesByRegion(int referenceIndex,
int zeroBasedStart,
int requestedFragmentLength)
Get the reference bases for a region of a reference contig.
|
byte[] |
getCurrentReferenceBases() |
int |
getFullContigLength() |
int |
getReferenceIndex() |
int |
getRegionLength() |
int |
getRegionStart() |
void |
setEmbeddedReferenceBases(byte[] embeddedReferenceBases,
int embeddedReferenceIndex,
int zeroBasedStart)
Set this
CRAMReferenceRegion to use an embedded reference. |
public static final int UNINITIALIZED_START
public static final int UNINITIALIZED_LENGTH
public CRAMReferenceRegion(CRAMReferenceSource cramReferenceSource, SAMSequenceDictionary sequenceDictionary)
cramReferenceSource
- CRAMReferenceSource
to use to obtain reference basessequenceDictionary
- SAMSequenceDictionary
to use to resolve reference contig names to reference indexpublic byte[] getCurrentReferenceBases()
public int getReferenceIndex()
ReferenceContext.UNINITIALIZED_REFERENCE_ID
if no index has
been establishedpublic int getRegionStart()
UNINITIALIZED_START
if no region has been establishedpublic int getRegionLength()
UNINITIALIZED_LENGTH
if no region has been establishedpublic void fetchReferenceBases(int referenceIndex)
referenceIndex
- the reference index for which bases should be retrieved.java.lang.IllegalArgumentException
- if the requested index is not present in the sequence dictionary or if
the sequence's bases cannot be retrieved from the CRAMReferenceSourcepublic void fetchReferenceBasesByRegion(int referenceIndex, int zeroBasedStart, int requestedFragmentLength)
referenceSource
will be called to retrieve the bases.
The caller cannot assume that the entire region requested is always fetched (if the requested range matches
the alignment span for CRAM record or slice contains a CRAM records that is mapped beyond the end of the
reference contig, fewer bases than were requested may be fetched.referenceIndex
- reference index for which to retrieve baseszeroBasedStart
- zero based start of the first base to be retrievedrequestedFragmentLength
- length of the fragment to be retrievedjava.lang.IllegalArgumentException
- if the requested sequence cannot be located in the sequence dictionary, or
if the requested sequence cannot be provided by the underlying referenceSourcepublic void fetchReferenceBasesByRegion(AlignmentContext alignmentContext)
AlignmentContext
.alignmentContext
- the alignment context for which to fetch bases. must be an AlignmentContext
for a single reference ReferenceContextType.SINGLE_REFERENCE_TYPE
slice (see
ReferenceContext.isMappedSingleRef()
)public void setEmbeddedReferenceBases(byte[] embeddedReferenceBases, int embeddedReferenceIndex, int zeroBasedStart)
CRAMReferenceRegion
to use an embedded reference.embeddedReferenceBases
- the embedded reference bases to be usedembeddedReferenceIndex
- the reference ID used in the slice containing the embedded referencezeroBasedStart
- the zero based reference start of the first base in the embedded reference basespublic int getFullContigLength()