# Class HtsIntervalUtils

java.lang.Object
htsjdk.beta.plugin.interval.HtsIntervalUtils

public class HtsIntervalUtils extends Object
Methods for interconverting between HtsQueryInterval and existing htsjdk types such as Locatable/QueryInterval

## Constructor Summary

Constructors
Constructor
Description
`HtsIntervalUtils()`

## Method Summary

Modifier and Type
Method
Description
`static List<HtsInterval>`
`fromQueryIntervalArray(QueryInterval[] queryIntervals, SAMSequenceDictionary dictionary)`
`static int`
`toIntegerSafe(long coord)`
Convert a long coordinate to an integer, for use with interconverting between old style integer coordinates and new style long coordinates.
`static Locatable`
`toLocatable(HtsInterval interval)`
Convert an HtsInterval to a `Locatable`
`static List<Locatable>`
`toLocatableList(List<HtsInterval> intervals)`
Convert a List of `HtsInterval` to a list of `Locatable`.
`static QueryInterval`
`toQueryInterval(HtsInterval interval, SAMSequenceDictionary dictionary)`
Convert an HtsInterval to a QueryInterval
`static QueryInterval[]`
`toQueryIntervalArray(List<HtsInterval> intervals, SAMSequenceDictionary dictionary)`
Convert a list of `HtsInterval` to an array of `QueryInterval`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### HtsIntervalUtils

public HtsIntervalUtils()

## Method Details

### toQueryInterval

@InternalAPI public static QueryInterval toQueryInterval(HtsInterval interval, SAMSequenceDictionary dictionary)
Convert an HtsInterval to a QueryInterval

Parameters:
  `interval` - `HtsInterval` to convert
  `dictionary` - sequence dictionary to use to convert string query names to contig index
Returns:
  a QueryInterval equivalent to `interval`

### toLocatable

@InternalAPI public static Locatable toLocatable(HtsInterval interval)
Convert an HtsInterval to a `Locatable`

Parameters:
  `interval` - `HtsInterval` to convert
Returns:
  a Locatable equivalent to `interval`

### toLocatableList

@InternalAPI public static List<Locatable> toLocatableList(List<HtsInterval> intervals)
Convert a List of `HtsInterval` to a list of `Locatable`.

Parameters:
  `intervals` - list of `HtsInterval`s to convert
Returns:
  a list of `Locatable`

### toQueryIntervalArray

@InternalAPI public static QueryInterval[] toQueryIntervalArray(List<HtsInterval> intervals, SAMSequenceDictionary dictionary)
Convert a list of `HtsInterval` to an array of `QueryInterval`

Parameters:
  `intervals` - list of `HtsInterval`s to convert
  `dictionary` - sequence dictionary to use
Returns:
  array of `QueryInterval`

### fromQueryIntervalArray

@InternalAPI public static List<HtsInterval> fromQueryIntervalArray(QueryInterval[] queryIntervals, SAMSequenceDictionary dictionary)

Parameters:
  `queryIntervals` - list of `QueryInterval` to convert
  `dictionary` - sequence dictionary to use for the conversion
Returns:
  list of `HtsInterval`

### toIntegerSafe

@InternalAPI public static int toIntegerSafe(long coord)
Convert a long coordinate to an integer, for use with interconverting between old style integer coordinates and new style long coordinates. Throws on overflow.

Parameters:
  `coord` - long coordinate to convert
Returns:
  an integer representation of `coord` if the conversion is safe
Throws:
  `IllegalArgumentException` - if converting results in overflow