Skip to content

BedView

Mojo struct 🡭

@memory_only
struct BedView[O: Origin[mut=O.mut]]

Zero-copy view over one BED data line in the parser’s buffer.

Lifetime: Valid only until the next parser read. Do not store; call .to_record() when the record must outlive the current iteration.

Coordinates are 0-based, half-open [chrom_start, chrom_end).

  • O (Origin)
  • chrom_start (UInt64)
  • chrom_end (UInt64)
  • score (Optional[Int])
  • strand (Optional[Strand])
  • thick_start (Optional[UInt64])
  • thick_end (Optional[UInt64])
  • block_count (Optional[Int])
  • num_fields (Int)

AnyType, ImplicitlyDestructible, Movable

def __init__(out self, _chrom: Span[UInt8, O], chrom_start: UInt64, chrom_end: UInt64, _name: Optional[Span[UInt8, O]], score: Optional[Int], strand: Optional[Strand], thick_start: Optional[UInt64], thick_end: Optional[UInt64], _item_rgb: Optional[ItemRgb], block_count: Optional[Int], _block_sizes_span: Optional[Span[UInt8, O]], _block_starts_span: Optional[Span[UInt8, O]], num_fields: Int)

Args:

  • _chrom (Span)
  • chrom_start (UInt64)
  • chrom_end (UInt64)
  • _name (Optional)
  • score (Optional)
  • strand (Optional)
  • thick_start (Optional)
  • thick_end (Optional)
  • _item_rgb (Optional)
  • block_count (Optional)
  • _block_sizes_span (Optional)
  • _block_starts_span (Optional)
  • num_fields (Int)
  • self (Self)

Returns:

Self

def chrom(self) -> StringSlice[O]

Args:

  • self (Self)

Returns:

StringSlice

def start_position(self) -> Position

1-based start of the feature (aligned with noodles_core; BED chromStart → start+1).

Args:

  • self (Self)

Returns:

Position

def end_position(self) -> Optional[Position]

1-based end position (chromEnd). None for zero-length BED records (chromEnd == 0).

Args:

  • self (Self)

Returns:

Optional

def interval(self) -> Optional[Interval]

Feature extent as 1-based closed [chromStart+1, chromEnd]. Returns None for zero-length BED records (chromEnd == 0). BED 0-based half-open [s, e) → 1-based closed [s+1, e].

Args:

  • self (Self)

Returns:

Optional

def thick_interval(self) -> Optional[Interval]

Thick (coding) extent if fields 7–8 present; else None (1-based closed).

Args:

  • self (Self)

Returns:

Optional

def name(self) -> Optional[StringSlice[O]]

Args:

  • self (Self)

Returns:

Optional

def item_rgb(self) -> Optional[ItemRgb]

Args:

  • self (Self)

Returns:

Optional

def to_record(self) -> BedRecord

Materialize an owned BedRecord. Call when the record must outlive the view.

Args:

  • self (Self)

Returns:

BedRecord

Raises: