Interval
Mojo struct 🡭
Interval
Section titled “Interval”@register_passable_trivialstruct Interval1-based closed genomic interval [start, end] (modeled on noodles_core::region::Interval).
Both start and end are 1-based and inclusive. Supports contains(), intersects(), length().
Implemented traits
Section titled “Implemented traits”AnyType, Copyable, Equatable, ImplicitlyCopyable, ImplicitlyDestructible, Movable, RegisterPassable, TrivialRegisterPassable
Methods
Section titled “Methods”__init__
Section titled “__init__”def __init__(out self, start: Position, end: Position)Args:
- start (
Position) - end (
Position) - self (
Self)
Returns:
Self
Raises:
def __init__(start: Position, end: Position, _unsafe: Bool) -> SelfInternal: use when start <= end is already guaranteed.
Args:
- start (
Position) - end (
Position) - _unsafe (
Bool)
Returns:
Self
def start(self) -> PositionArgs:
- self (
Self)
Returns:
Position
def end(self) -> PositionArgs:
- self (
Self)
Returns:
Position
length
Section titled “length”def length(self) -> UInt64Number of bases in the interval (end - start + 1 for closed [start, end]).
Args:
- self (
Self)
Returns:
UInt64
is_empty
Section titled “is_empty”def is_empty(self) -> BoolArgs:
- self (
Self)
Returns:
Bool
contains
Section titled “contains”def contains(self, position: Position) -> BoolTrue if position is in [start, end] (1-based closed).
Args:
- self (
Self) - position (
Position)
Returns:
Bool
intersects
Section titled “intersects”def intersects(self, other: Self) -> BoolTrue if this interval overlaps other (both 1-based closed).
Args:
- self (
Self) - other (
Self)
Returns:
Bool