Package org.snpeff.interval.tree

# Class IntervalForest

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

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

public class IntervalForest extends Object implements Serializable, Iterable<Itree>
A set of interval trees (e.g. one per chromosome, one per transcript ID, etc)

Author:
  pcingola
See Also:
  - Serialized Form

## Constructor Summary

Constructors
Constructor
Description
`IntervalForest()`
`IntervalForest(Markers markers)`

## Method Summary

Modifier and Type
Method
Description
`void`
`add(Collection<? extends Marker> intervals)`
Add all intervals
`void`
`add(Marker interval)`
Add an interval
`void`
`add(Markers intervals)`
Add all intervals
`void`
`build()`
Build all trees
`String`
`getName()`
`Itree`
`getOrCreateTree(String id)`
Get (or create) an interval tree for ID
`Itree`
`getOrCreateTreeChromo(String chromo)`
Get (or create) an interval tree based for "chromo" (chromosome name)
`Itree`
`getTree(String key)`
Get an interval tree using an ID
`Itree`
`getTreeChromo(String chromo)`
Get an interval tree using a chromosome name
`boolean`
`hasTree(String chromo)`
Is the tree 'chromo' available?
`Markers`
`intersect(Markers markers)`
Return the intersection of 'markers' and this IntervalForest For each marker 'm' in 'markers' - query the tree to get all markers intersecting 'm' - create a new interval which is the intersection of 'm' with all the resutls from the previous query.
`Iterator<Itree>`
`iterator()`
`Collection<String>`
`keySet()`
`protected Itree`
`newItree()`
Create new tree.
`Markers`
`query(Marker marker)`
Query all intervals that intersect with 'interval'
`Markers`
`query(Markers marker)`
Query all intervals that intersect with any interval in 'intervals'
`Markers`
`queryUnique(Markers markers)`
Query unique intervals that intersect with any interval in 'markers' I.e.: Return a set of intervals that intersects (at least once) with any interval in 'markers'
`void`
`setDebug(boolean debug)`
`void`
`setName(String name)`
`int`
`size()`
`Markers`
`stab(String chromo, int point)`
Obtain all intervals that intersect with 'point'
`Markers`
`stab(Marker marker)`
Obtain all intervals that intersect with 'marker.start'
`String`
`toString()`

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

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

### Methods inherited from interface java.lang.Iterable

`forEach, spliterator`

## Constructor Details

### IntervalForest

public IntervalForest()

### IntervalForest

public IntervalForest(Markers markers)

## Method Details

### add

public void add(Collection<? extends Marker> intervals)
Add all intervals

### add

public void add(Marker interval)
Add an interval

### add

public void add(Markers intervals)
Add all intervals

### build

public void build()
Build all trees

### getName

public String getName()

### getOrCreateTree

public Itree getOrCreateTree(String id)
Get (or create) an interval tree for ID

### getOrCreateTreeChromo

public Itree getOrCreateTreeChromo(String chromo)
Get (or create) an interval tree based for "chromo" (chromosome name)

### getTree

public Itree getTree(String key)
Get an interval tree using an ID

### getTreeChromo

public Itree getTreeChromo(String chromo)
Get an interval tree using a chromosome name

### hasTree

public boolean hasTree(String chromo)
Is the tree 'chromo' available?

### intersect

public Markers intersect(Markers markers)
Return the intersection of 'markers' and this IntervalForest For each marker 'm' in 'markers' - query the tree to get all markers intersecting 'm' - create a new interval which is the intersection of 'm' with all the resutls from the previous query.

### iterator

public Iterator<Itree> iterator()

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

### keySet

public Collection<String> keySet()

### newItree

protected Itree newItree()
Create new tree. In oder to change the implementation, only this method should be changed.

### query

public Markers query(Marker marker)
Query all intervals that intersect with 'interval'

### query

public Markers query(Markers marker)
Query all intervals that intersect with any interval in 'intervals'

### queryUnique

public Markers queryUnique(Markers markers)
Query unique intervals that intersect with any interval in 'markers' I.e.: Return a set of intervals that intersects (at least once) with any interval in 'markers'

### setDebug

public void setDebug(boolean debug)

### setName

public void setName(String name)

### size

public int size()

### stab

public Markers stab(Marker marker)
Obtain all intervals that intersect with 'marker.start'

### stab

public Markers stab(String chromo, int point)
Obtain all intervals that intersect with 'point'

### toString

public String toString()

Overrides:
  `toString` in class `Object`