Package htsjdk.samtools.cram.ref
Class CRAMLazyReferenceSource
java.lang.Object
htsjdk.samtools.cram.ref.CRAMLazyReferenceSource
- All Implemented Interfaces:
CRAMReferenceSource
A lazy CRAMReferenceSource implementation, for use when no explicit reference source has been provided
by the user. This allows client code to have a CRAMReferenceSource to thread through the CRAM code and to
access containers, slices, and un-normalized CRAM records and otherwise perform operations such as indexing
that do not require a reference to be resolved. If a reference sequence is actually requested, throws an
exception.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]
getReferenceBases
(SAMSequenceRecord sequenceRecord, boolean tryNameVariants) Get the reference bases for an entire reference contig.byte[]
getReferenceBasesByRegion
(SAMSequenceRecord sequenceRecord, int zeroBasedStart, int requestedRegionLength) Get the reference bases for a region of a reference contig.
-
Constructor Details
-
CRAMLazyReferenceSource
public CRAMLazyReferenceSource()
-
-
Method Details
-
getReferenceBases
Description copied from interface:CRAMReferenceSource
Get the reference bases for an entire reference contig.- Specified by:
getReferenceBases
in interfaceCRAMReferenceSource
- Parameters:
sequenceRecord
- the SAMSequenceRecord identifying the reference being requestedtryNameVariants
- if true, attempt to match the requested sequence name against the reference by using common name variations, such as adding or removing a leading "chr" prefix from the requested name. if false, use exact match- Returns:
- the upper-cased, normalized (see
Utils.normalizeBase(byte)
) bases representing the requested sequence, or null if the sequence cannot be found
-
getReferenceBasesByRegion
public byte[] getReferenceBasesByRegion(SAMSequenceRecord sequenceRecord, int zeroBasedStart, int requestedRegionLength) Description copied from interface:CRAMReferenceSource
Get the reference bases for a region of a reference contig. If the sequence can be retrieved, but is not long enough to satisfy the requested length, it is permissible to return fewer bases than therequestedRegionLength
. It is the caller's responsibility to detect and handle this case.- Specified by:
getReferenceBasesByRegion
in interfaceCRAMReferenceSource
- Parameters:
sequenceRecord
- the SAMSequenceRecord for the reference contig being requestedzeroBasedStart
- the zero based offset of the starting reference base, must be >= 0requestedRegionLength
- the length of the requested reference region- Returns:
- the bases for the reference region, or null if the sequence cannot be found.
-