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 single `CRAMCompressionRecord`, `Slice`, or `Container`. It contains a `ReferenceContext`, 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 final AlignmentContext`
`EOF_CONTAINER_CONTEXT`
`static final AlignmentContext`
`MULTIPLE_REFERENCE_CONTEXT`
`static final int`
`NO_ALIGNMENT_END`
`static final int`
`NO_ALIGNMENT_SPAN`
`static final int`
`NO_ALIGNMENT_START`
`static final AlignmentContext`
`UNMAPPED_UNPLACED_CONTEXT`

## Constructor Summary

Constructors
Constructor
Description
`AlignmentContext(ReferenceContext referenceContext, int alignmentStart, int alignmentSpan)`
Create an AlignmentContext from a reference context, start, and span.

## Method Summary

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.

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

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

## Field Details

### 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 Details

### AlignmentContext

public AlignmentContext(ReferenceContext referenceContext, int alignmentStart, int alignmentSpan)
Create an AlignmentContext from a reference 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 context
  `alignmentStart` - the 1-based alignment start
  `alignmentSpan` - the alignment span

## Method Details

### 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 alignmentContext
  `referenceContext` - reference context to validate
  `alignmentStart` - alignment start to validate
  `alignmentSpan` - alignment span to validate

### toString

public String toString()

Overrides:
  `toString` in class `Object`

### equals

public boolean equals(Object o)

Overrides:
  `equals` in class `Object`

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Object`