Package org.snpeff.interval

# Class Interval

java.lang.Object
org.snpeff.interval.Interval

All Implemented Interfaces:
  `Serializable`, `Cloneable`, `Comparable<Interval>`

Direct Known Subclasses:
  `Marker`

public class Interval extends Object implements Comparable<Interval>, Serializable, Cloneable
A genomic interval.

Note: Intervals are assumed to be zero-based and "closed" i.e. an interval includes the first and the last base. e.g.: an interval including the first base, up to base (and including) X would be [0,X]

Author:
  pcingola
See Also:
  - Serialized Form

## Field Summary

Fields
Modifier and Type
Field
Description
`protected String`
`chromosomeNameOri`
`protected int`
`end`
`protected String`
`id`
`protected Interval`
`parent`
`protected int`
`start`
`protected boolean`
`strandMinus`

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`Interval()`
``
`Interval(Interval parent, int start, int end, boolean strandMinus, String id)`

## Method Summary

Modifier and Type
Method
Description
`Interval`
`clone()`
`int`
`compareTo(Interval i2)`
Compare by start and end
`boolean`
`equals(Interval interval)`
`Interval`
`findParent(Class clazz)`
Go up (parent) until we find an instance of 'clazz'
`Chromosome`
`getChromosome()`
`String`
`getChromosomeName()`
Find chromosome name
`String`
`getChromosomeNameOri()`
`double`
`getChromosomeNum()`
Find chromosome and return it's number
`int`
`getEnd()`
`Genome`
`getGenome()`
Find genome
`String`
`getGenomeName()`
Find genome name
`String`
`getId()`
`Interval`
`getParent()`
`int`
`getStart()`
`String`
`getStrand()`
`int`
`hashCode()`
`boolean`
`intersects(int iStart, int iEnd)`
Return true if this intersects '[iStart, iEnd]'
`boolean`
`intersects(long point)`
`boolean`
`intersects(Interval interval)`
Return true if this intersects 'interval'
`boolean`
`intersects(Marker interval)`
Do the intervals intersect?
`int`
`intersectSize(Marker interval)`
How much do intervals intersect?
`boolean`
`isCircular()`
Is this interval part of a circular chromosome and it spans the 'chromosome zero / chromosome end' line?
`boolean`
`isSameChromo(Marker interval)`
`boolean`
`isStrandMinus()`
`boolean`
`isStrandPlus()`
`boolean`
`isValid()`
`void`
`setChromosomeNameOri(String chromosomeNameOri)`
`void`
`setEnd(int end)`
`void`
`setId(String id)`
`void`
`setParent(Interval parent)`
`void`
`setStart(int start)`
`void`
`setStrandMinus(boolean strand)`
`void`
`shiftCoordinates(int shift)`
`int`
`size()`
`String`
`toStr()`
To string as a simple "chr:start-end" format
`String`
`toString()`
`String`
`toStringAsciiArt(int maxLen)`
Show it as an ASCII art
`String`
`toStrPos()`
To string as a simple "chr:start-end" format

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

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

## Field Details

### start

protected int start

### end

protected int end

### strandMinus

protected boolean strandMinus

### id

protected String id

### chromosomeNameOri

protected String chromosomeNameOri

### parent

protected Interval parent

## Constructor Details

### Interval

protected Interval()

### Interval

public Interval(Interval parent, int start, int end, boolean strandMinus, String id)

## Method Details

### clone

public Interval clone()

Overrides:
  `clone` in class `Object`

### compareTo

public int compareTo(Interval i2)
Compare by start and end

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

### equals

public boolean equals(Interval interval)

### findParent

public Interval findParent(Class clazz)
Go up (parent) until we find an instance of 'clazz'

### getChromosome

public Chromosome getChromosome()

### getChromosomeName

public String getChromosomeName()
Find chromosome name

### getChromosomeNameOri

public String getChromosomeNameOri()

### setChromosomeNameOri

public void setChromosomeNameOri(String chromosomeNameOri)

### getChromosomeNum

public double getChromosomeNum()
Find chromosome and return it's number

Returns:
  Chromosome number if found, -1 otherwise

### getEnd

public int getEnd()

### setEnd

public void setEnd(int end)

### getGenome

public Genome getGenome()
Find genome

### getGenomeName

public String getGenomeName()
Find genome name

### getId

public String getId()

### setId

public void setId(String id)

### getParent

public Interval getParent()

### setParent

public void setParent(Interval parent)

### getStart

public int getStart()

### setStart

public void setStart(int start)

### getStrand

public String getStrand()

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Object`

### intersects

public boolean intersects(int iStart, int iEnd)
Return true if this intersects '[iStart, iEnd]'

### intersects

public boolean intersects(Interval interval)
Return true if this intersects 'interval'

### intersects

public boolean intersects(long point)

Returns:
  true if this interval contains point (inclusive)

### intersects

public boolean intersects(Marker interval)
Do the intervals intersect?

Returns:
  return true if this intersects 'interval'

### intersectSize

public int intersectSize(Marker interval)
How much do intervals intersect?

Returns:
  number of bases these intervals intersect

### isCircular

public boolean isCircular()
Is this interval part of a circular chromosome and it spans the 'chromosome zero / chromosome end' line?

### isSameChromo

public boolean isSameChromo(Marker interval)

### isStrandMinus

public boolean isStrandMinus()

### setStrandMinus

public void setStrandMinus(boolean strand)

### isStrandPlus

public boolean isStrandPlus()

### isValid

public boolean isValid()

### shiftCoordinates

public void shiftCoordinates(int shift)

### size

public int size()

### toStr

public String toStr()
To string as a simple "chr:start-end" format

### toString

public String toString()

Overrides:
  `toString` in class `Object`

### toStringAsciiArt

public String toStringAsciiArt(int maxLen)
Show it as an ASCII art

### toStrPos

public String toStrPos()
To string as a simple "chr:start-end" format