Package htsjdk.samtools.cram.structure
Class AlignmentContext
- java.lang.Object
-
- htsjdk.samtools.cram.structure.AlignmentContext
-
public class AlignmentContext extends Object
An AlignmentContext represents mapping information related to a collection of reads, or a singleCRAMCompressionRecord
,Slice
, orContainer
. It contains aReferenceContext
, and if that context is of type SINGLE_REFERENCE_TYPE then it also contains Alignment Start and Alignment Span values.
-
-
Field Summary
Fields Modifier and Type Field Description static AlignmentContext
EOF_CONTAINER_CONTEXT
static AlignmentContext
MULTIPLE_REFERENCE_CONTEXT
static int
NO_ALIGNMENT_END
static int
NO_ALIGNMENT_SPAN
static int
NO_ALIGNMENT_START
static AlignmentContext
UNMAPPED_UNPLACED_CONTEXT
-
Constructor Summary
Constructors Constructor Description AlignmentContext(ReferenceContext referenceContext, int alignmentStart, int alignmentSpan)
Create an AlignmentContext from a refernce context, start, and span.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
int
getAlignmentSpan()
int
getAlignmentStart()
ReferenceContext
getReferenceContext()
int
hashCode()
String
toString()
static void
validateAlignmentContext(boolean isStrict, ReferenceContext referenceContext, int alignmentStart, int alignmentSpan)
Determine if the provided values would result in a valid alignment context.
-
-
-
Field Detail
-
NO_ALIGNMENT_START
public static final int NO_ALIGNMENT_START
- See Also:
- Constant Field Values
-
NO_ALIGNMENT_SPAN
public static final int NO_ALIGNMENT_SPAN
- See Also:
- Constant Field Values
-
NO_ALIGNMENT_END
public static final int NO_ALIGNMENT_END
- See Also:
- Constant Field Values
-
MULTIPLE_REFERENCE_CONTEXT
public static final AlignmentContext MULTIPLE_REFERENCE_CONTEXT
-
UNMAPPED_UNPLACED_CONTEXT
public static final AlignmentContext UNMAPPED_UNPLACED_CONTEXT
-
EOF_CONTAINER_CONTEXT
public static final AlignmentContext EOF_CONTAINER_CONTEXT
-
-
Constructor Detail
-
AlignmentContext
public AlignmentContext(ReferenceContext referenceContext, int alignmentStart, int alignmentSpan)
Create an AlignmentContext from a refernce context, start, and span. Unfortunately, this can't enforce that the values are valid alignment values, or even warn about such values here, because there are too many cases where the spec doesn't or didn't originally prescribe valid values for cases like MULTIPLE_REF containers/slices, or unmapped slices, or SAMFileHeader containers. As a result, there are many files floating around that use various out-of-spec values that were created with old htsjdk or other implementations that were based based on older spec versions.- Parameters:
referenceContext
- the reference context for this alignment contextalignmentStart
- the 1-based alignment startalignmentSpan
- the alignment span
-
-
Method Detail
-
getReferenceContext
public ReferenceContext getReferenceContext()
-
getAlignmentStart
public int getAlignmentStart()
-
getAlignmentSpan
public int getAlignmentSpan()
-
validateAlignmentContext
public static void validateAlignmentContext(boolean isStrict, ReferenceContext referenceContext, int alignmentStart, int alignmentSpan)
Determine if the provided values would result in a valid alignment context. Note: The spec does not prescribe what the alignment start/span for a SAMFileHeader container should be, and only recently prescribed what they should be for multi-ref slices, so there are many files out their with various out-of-band values in those cases, so we can't validate or throw in the general case.- Parameters:
isStrict
- throw if the values do not represent a valid alignmentContextreferenceContext
- reference context to validatealignmentStart
- alignment start to validatealignmentSpan
- alignment span to validate
-
-