Package htsjdk.samtools.cram.ref

# Class ReferenceContext

java.lang.Object
htsjdk.samtools.cram.ref.ReferenceContext

All Implemented Interfaces:
  `Comparable<ReferenceContext>`

public class ReferenceContext extends Object implements Comparable<ReferenceContext>
ReferenceContext defines how a given Slice or Container relates to a reference sequence. There are 3 types of reference context: single-reference context, which is backed by an accompanying reference sequence ID, `UNMAPPED_UNPLACED_ID`/`ReferenceContextType.UNMAPPED_UNPLACED_TYPE` which indicates an unmapped/unplaced context, and `MULTIPLE_REFERENCE_ID`/`ReferenceContextType.MULTIPLE_REFERENCE_TYPE`) which indicates a multiple reference context.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final ReferenceContext`
`MULTIPLE_REFERENCE_CONTEXT`
`static final int`
`MULTIPLE_REFERENCE_ID`
`static final int`
`UNINITIALIZED_REFERENCE_ID`
`static final ReferenceContext`
`UNMAPPED_UNPLACED_CONTEXT`
`static final int`
`UNMAPPED_UNPLACED_ID`

## Constructor Summary

Constructors
Constructor
Description
`ReferenceContext(int referenceContextID)`
Create a ReferenceContext from a value that is either a valid sequence ID, or a reference context sentinel value: 0 or greater for single reference -1 for unmapped-unplaced -2 for multiple reference

## Method Summary

Modifier and Type
Method
Description
`int`
`compareTo(ReferenceContext o)`
`boolean`
`equals(Object o)`
`int`
`getReferenceContextID()`
Get the ReferenceContext sequence ID, or, for unmapped or multiple context, a sentinel value suitable for serialization: 0 or greater for single reference -1 for unmapped -2 for multiple reference
`int`
`getReferenceSequenceID()`
Get the valid reference sequence ID.
`ReferenceContextType`
`getType()`
Get the ReferenceContext type: SINGLE_REFERENCE_TYPE, UNMAPPED_UNPLACED_TYPE, or MULTIPLE_REFERENCE_TYPE
`int`
`hashCode()`
`boolean`
`isMappedSingleRef()`
Determine if this ReferenceContext represents a single reference.
`boolean`
`isMultiRef()`
Determine if this ReferenceContext represents: - reads placed on multiple references - or a combination of placed and unplaced reads?
`boolean`
`isUnmappedUnplaced()`
Determine if this ReferenceContext represents unmapped-unplaced ?
`String`
`toString()`

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

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

## Field Details

### UNMAPPED_UNPLACED_ID

public static final int UNMAPPED_UNPLACED_ID

See Also:
  - Constant Field Values

### MULTIPLE_REFERENCE_ID

public static final int MULTIPLE_REFERENCE_ID

See Also:
  - Constant Field Values

### UNINITIALIZED_REFERENCE_ID

public static final int UNINITIALIZED_REFERENCE_ID

See Also:
  - Constant Field Values

### MULTIPLE_REFERENCE_CONTEXT

public static final ReferenceContext MULTIPLE_REFERENCE_CONTEXT

### UNMAPPED_UNPLACED_CONTEXT

public static final ReferenceContext UNMAPPED_UNPLACED_CONTEXT

## Constructor Details

### ReferenceContext

public ReferenceContext(int referenceContextID)
Create a ReferenceContext from a value that is either a valid sequence ID, or a reference context sentinel value: 0 or greater for single reference -1 for unmapped-unplaced -2 for multiple reference

Parameters:
  `referenceContextID` - the sequence ID or sentinel value for constructing this ReferenceContext

## Method Details

### getType

public ReferenceContextType getType()
Get the ReferenceContext type: SINGLE_REFERENCE_TYPE, UNMAPPED_UNPLACED_TYPE, or MULTIPLE_REFERENCE_TYPE

Returns:
  the `ReferenceContextType` enum

### getReferenceContextID

public int getReferenceContextID()
Get the ReferenceContext sequence ID, or, for unmapped or multiple context, a sentinel value suitable for serialization: 0 or greater for single reference -1 for unmapped -2 for multiple reference

Returns:
  the sequence ID

### getReferenceSequenceID

public int getReferenceSequenceID()
Get the valid reference sequence ID. May only be called if this is reference context of type single-reference (other reference context types don't have a valid sequence ID), otherwise see `getReferenceContextID()`.

Returns:
  the sequence ID for this reference context
Throws:
  `CRAMException` - if this is not a single-ref reference context

### isUnmappedUnplaced

public boolean isUnmappedUnplaced()
Determine if this ReferenceContext represents unmapped-unplaced ?

Returns:
  true if the ReferenceContext is ReferenceContextTypeUNMAPPED_UNPLACED_TYPE.

### isMultiRef

public boolean isMultiRef()
Determine if this ReferenceContext represents: - reads placed on multiple references - or a combination of placed and unplaced reads?

Returns:
  true if the ReferenceContext is

### isMappedSingleRef

public boolean isMappedSingleRef()
Determine if this ReferenceContext represents a single reference.

Returns:
  true if this ReferenceContext represents

### equals

public boolean equals(Object o)

Overrides:
  `equals` in class `Object`

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Object`

### compareTo

public int compareTo(ReferenceContext o)

Specified by:
  `compareTo` in interface `Comparable<ReferenceContext>`

### toString

public String toString()

Overrides:
  `toString` in class `Object`