# Class IntervalTreeArray

java.lang.Object
org.snpeff.interval.tree.IntervalTreeArray

All Implemented Interfaces:
  `Iterable<Marker>, Itree`

public class IntervalTreeArray extends Object implements Itree
Interval tree structure using arrays This is slightly faster than the new IntervalTree implementation

Author:
  pcingola

## Field Summary

Fields
Modifier and Type
Field
Description
`protected boolean`
`debug`
`protected static final Marker[]`
`EMPTY_MARKER_ARRAY`
`static final int`
`INITIAL_CAPACITY`
`protected boolean`
`inSync`
`protected Marker[][]`
`intersectMarkers`
`protected int`
`lastIdx`
`protected int[]`
`left`
`protected Markers`
`markers`
`protected int[]`
`mid`
`static final int`
`MIN_MARKERS_PER_LEAF`
`protected int[]`
`right`
`protected boolean`
`verbose`

## Constructor Summary

Constructors
Constructor
Description
`IntervalTreeArray()`
`IntervalTreeArray(Markers markers)`
Instantiate an interval tree with a list of intervals

## Method Summary

Modifier and Type
Method
Description
`void`
`add(Marker interval)`
Add an interval object to the interval tree's list
`void`
`add(Markers markers)`
Add all intervals to interval tree's list
`void`
`build()`
Build the interval tree to reflect the list of intervals.
`protected int`
`build(Markers markers)`
Index intervals from 'start' to 'end' (index in 'markers')
`Markers`
`getIntervals()`
`boolean`
`isEmpty()`
`boolean`
`isInSync()`
Is the tree 'in sync'? If false, the tree must be 'build()' before the next query
`Iterator<Marker>`
`iterator()`
`void`
`load(String fileName, Genome genome)`
Load intervals from file
`Markers`
`query(Interval marker)`
Query index to find all VCF entries intersecting 'marker' Store VCF entries in 'results'
`protected void`
`query(Interval marker, int idx, Markers results)`
Query index to find all VCF entries intersecting 'marker', starting from node 'idx' Store VCF entries in 'results'
`protected void`
`queryIntersects(Interval marker, int idx, Markers results)`
Query entries intersecting 'marker' at node 'idx'
`protected void`
`reset()`
`void`
`setDebug(boolean debug)`
`void`
`setVerbose(boolean verbose)`
`int`
`size()`
Size: number of entries in this tree
`Markers`
`stab(int point)`
Perform a stabbing query, returning the interval objects
`protected void`
`stab(int point, int idx, Markers results)`
`protected void`
`stabIntersects(int point, int idx, Markers results)`
Stab entries intersecting 'point' at node 'idx'
`String`
`toString()`
`String`
`toString(int idx)`
`String`
`toStringAll()`

### Methods inherited from class Object

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

### Methods inherited from interface Iterable

`forEach, spliterator`

## Field Details

### MIN_MARKERS_PER_LEAF

public static final int MIN_MARKERS_PER_LEAF

See Also:
  - Constant Field Values

### INITIAL_CAPACITY

public static final int INITIAL_CAPACITY

See Also:
  - Constant Field Values

### EMPTY_MARKER_ARRAY

protected static final Marker[] EMPTY_MARKER_ARRAY

### debug

protected boolean debug

### verbose

protected boolean verbose

### markers

protected Markers markers

### inSync

protected boolean inSync

### left

protected int[] left

### right

protected int[] right

### mid

protected int[] mid

### intersectMarkers

protected Marker[][] intersectMarkers

### lastIdx

protected int lastIdx

## Constructor Details

### IntervalTreeArray

public IntervalTreeArray()

### IntervalTreeArray

public IntervalTreeArray(Markers markers)
Instantiate an interval tree with a list of intervals

## Method Details

### add

public void add(Marker interval)
Description copied from interface: `Itree`
Add an interval object to the interval tree's list

Specified by:
  `add` in interface `Itree`

### add

public void add(Markers markers)
Description copied from interface: `Itree`
Add all intervals to interval tree's list

Specified by:
  `add` in interface `Itree`

### build

public void build()
Description copied from interface: `Itree`
Build the interval tree to reflect the list of intervals. Must not run if this is currently in sync

Specified by:
  `build` in interface `Itree`

### build

protected int build(Markers markers)
Index intervals from 'start' to 'end' (index in 'markers')

Returns:
  Index of added item (-1 if no item was added)

### getIntervals

public Markers getIntervals()

Specified by:
  `getIntervals` in interface `Itree`

### isEmpty

public boolean isEmpty()

Specified by:
  `isEmpty` in interface `Itree`

### isInSync

public boolean isInSync()
Description copied from interface: `Itree`
Is the tree 'in sync'? If false, the tree must be 'build()' before the next query

Specified by:
  `isInSync` in interface `Itree`

### iterator

public Iterator<Marker> iterator()

Specified by:
  `iterator` in interface `Iterable<Marker>`

### load

public void load(String fileName, Genome genome)
Description copied from interface: `Itree`
Load intervals from file

Specified by:
  `load` in interface `Itree`

### query

public Markers query(Interval marker)
Query index to find all VCF entries intersecting 'marker' Store VCF entries in 'results'

Specified by:
  `query` in interface `Itree`
Returns:
  All intervals that intersect 'interval'

### query

protected void query(Interval marker, int idx, Markers results)
Query index to find all VCF entries intersecting 'marker', starting from node 'idx' Store VCF entries in 'results'

### queryIntersects

protected void queryIntersects(Interval marker, int idx, Markers results)
Query entries intersecting 'marker' at node 'idx'

### reset

protected void reset()

### setDebug

public void setDebug(boolean debug)

### setVerbose

public void setVerbose(boolean verbose)

### size

public int size()
Description copied from interface: `Itree`
Size: number of entries in this tree

Specified by:
  `size` in interface `Itree`

### stab

public Markers stab(int point)
Description copied from interface: `Itree`
Perform a stabbing query, returning the interval objects

Specified by:
  `stab` in interface `Itree`
Returns:
  All intervals intersecting 'point'

### stab

protected void stab(int point, int idx, Markers results)

### stabIntersects

protected void stabIntersects(int point, int idx, Markers results)
Stab entries intersecting 'point' at node 'idx'

### toString

public String toString()

Overrides:
  `toString` in class `Object`

### toString

public String toString(int idx)

### toStringAll

public String toStringAll()