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 Details

  • 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