Package htsjdk.samtools.util
Interface Locatable
-
- All Known Subinterfaces:
BEDFeature
,Feature
- All Known Implementing Classes:
AbstractLocusInfo
,BAMRecord
,FullBEDFeature
,Interval
,SamLocusIterator.LocusInfo
,SAMRecord
,SimpleBEDFeature
,SimpleFeature
,SRALazyRecord
,VariantContext
public interface Locatable
Any class that has a single logical mapping onto the genome should implement Locatable positions should be reported as 1-based and closed at both ends
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default boolean
contains(Locatable other)
Determines whether this interval contains the entire region represented by other (in other words, whether it covers it).default boolean
contigsMatch(Locatable other)
Determine if this is on the same contig as other this must be equivalent to this.getContig().equals(other.getContig()) but may be implemented more efficientlyString
getContig()
Gets the contig name for the contig this is mapped to.int
getEnd()
default int
getLengthOnReference()
int
getStart()
default boolean
overlaps(Locatable other)
Determines whether this interval overlaps the provided locatable.default boolean
withinDistanceOf(Locatable other, int distance)
Determines whether this interval comes withindistance
of overlapping the provided locatable.
-
-
-
Method Detail
-
getContig
String getContig()
Gets the contig name for the contig this is mapped to. May return null if there is no unique mapping.- Returns:
- name of the contig this is mapped to, potentially null
-
getStart
int getStart()
- Returns:
- 1-based start position, undefined if getContig() == null
-
getEnd
int getEnd()
- Returns:
- 1-based closed-ended position, undefined if getContig() == null
-
getLengthOnReference
default int getLengthOnReference()
- Returns:
- number of bases of reference covered by this interval
-
overlaps
default boolean overlaps(Locatable other)
Determines whether this interval overlaps the provided locatable.- Parameters:
other
- interval to check- Returns:
- true if this interval overlaps other, otherwise false
-
withinDistanceOf
default boolean withinDistanceOf(Locatable other, int distance)
Determines whether this interval comes withindistance
of overlapping the provided locatable. When distance = 0 this is equal tooverlaps(Locatable)
- Parameters:
other
- interval to checkdistance
- how many bases may be between the two intervals for us to still consider them overlapping.- Returns:
- true if this interval overlaps other, otherwise false
-
contains
default boolean contains(Locatable other)
Determines whether this interval contains the entire region represented by other (in other words, whether it covers it).- Parameters:
other
- interval to check- Returns:
- true if this interval contains all of the base positions spanned by other, otherwise false
-
contigsMatch
default boolean contigsMatch(Locatable other)
Determine if this is on the same contig as other this must be equivalent to this.getContig().equals(other.getContig()) but may be implemented more efficiently- Returns:
- true iff this.getContig().equals(other.getContig())
-
-