public final class SimpleInterval
extends java.lang.Object
implements htsjdk.samtools.util.Locatable, java.io.Serializable
Modifier and Type | Field and Description |
---|---|
static char |
CONTIG_SEPARATOR |
static java.lang.String |
END_OF_CONTIG |
static char |
START_END_SEPARATOR |
Constructor and Description |
---|
SimpleInterval(htsjdk.samtools.util.Locatable locatable)
Create a new SimpleInterval from a
Locatable |
SimpleInterval(java.lang.String str)
Makes an interval by parsing the string.
|
SimpleInterval(java.lang.String contig,
int start,
int end)
Create a new immutable 1-based interval of the form [start, end]
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(htsjdk.samtools.util.Locatable other)
Determines whether this interval contains the entire region represented by other
(in other words, whether it covers it).
|
boolean |
equals(java.lang.Object o) |
SimpleInterval |
expandWithinContig(int padding,
int contigLength)
Returns a new SimpleInterval that represents this interval as expanded by the specified amount in both
directions, bounded by the contig start/stop if necessary.
|
SimpleInterval |
expandWithinContig(int padding,
htsjdk.samtools.SAMSequenceDictionary sequenceDictionary)
Returns a new SimpleInterval that represents this interval as expanded by the specified amount in both
directions, bounded by the contig start/stop if necessary.
|
java.lang.String |
getContig() |
int |
getEnd() |
long |
getGA4GHEnd() |
long |
getGA4GHStart() |
int |
getStart()
Gets the 1-based start position of the interval on the contig.
|
int |
hashCode() |
SimpleInterval |
intersect(htsjdk.samtools.util.Locatable that)
Returns the intersection of the two intervals.
|
static boolean |
isValid(java.lang.String contig,
int start,
int end)
Test that these are valid values for constructing a SimpleInterval:
contig cannot be null
start must be >= 1
end must be >= start
|
SimpleInterval |
mergeWithContiguous(htsjdk.samtools.util.Locatable that)
Returns a new SimpleInterval that represents the entire span of this and that.
|
boolean |
overlaps(htsjdk.samtools.util.Locatable other)
Determines whether this interval overlaps the provided locatable.
|
boolean |
overlapsWithMargin(htsjdk.samtools.util.Locatable other,
int margin)
Determines whether this interval comes within "margin" of overlapping the provided locatable.
|
int |
size() |
SimpleInterval |
spanWith(htsjdk.samtools.util.Locatable other)
Returns a new SimpleInterval that represents the region between the endpoints of this and other.
|
java.lang.String |
toString() |
public static final char CONTIG_SEPARATOR
public static final char START_END_SEPARATOR
public static final java.lang.String END_OF_CONTIG
public SimpleInterval(java.lang.String contig, int start, int end)
contig
- the name of the contig, must not be nullstart
- 1-based inclusive start positionend
- 1-based inclusive end positionpublic SimpleInterval(htsjdk.samtools.util.Locatable locatable)
Locatable
locatable
- any Locatablejava.lang.IllegalArgumentException
- if locatable violates any of the SimpleInterval constraints or is nullpublic SimpleInterval(java.lang.String str)
str
- non-empty string to be parsedpublic static boolean isValid(java.lang.String contig, int start, int end)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getContig()
getContig
in interface htsjdk.samtools.util.Locatable
public int getStart()
getStart
in interface htsjdk.samtools.util.Locatable
public long getGA4GHStart()
public int getEnd()
getEnd
in interface htsjdk.samtools.util.Locatable
public long getGA4GHEnd()
public int size()
public boolean overlaps(htsjdk.samtools.util.Locatable other)
overlaps
in interface htsjdk.samtools.util.Locatable
other
- interval to checkpublic boolean overlapsWithMargin(htsjdk.samtools.util.Locatable other, int margin)
other
- interval to checkmargin
- how many bases may be between the two interval for us to still consider them overlapping; must be non-negativejava.lang.IllegalArgumentException
- if margin is negativepublic boolean contains(htsjdk.samtools.util.Locatable other)
contains
in interface htsjdk.samtools.util.Locatable
other
- interval to checkpublic SimpleInterval intersect(htsjdk.samtools.util.Locatable that)
public SimpleInterval mergeWithContiguous(htsjdk.samtools.util.Locatable that)
public SimpleInterval spanWith(htsjdk.samtools.util.Locatable other)
mergeWithContiguous(htsjdk.samtools.util.Locatable)
, the two intervals do not need to be contiguousother
- the other interval with which to calculate the spanpublic SimpleInterval expandWithinContig(int padding, int contigLength)
padding
- amount to expand this intervalcontigLength
- length of this interval's contigpublic SimpleInterval expandWithinContig(int padding, htsjdk.samtools.SAMSequenceDictionary sequenceDictionary)
padding
- amount to expand this intervalsequenceDictionary
- dictionary to use to determine the length of this interval's contig