BedView
Mojo struct 🡭
BedView
Section titled “BedView”@memory_onlystruct 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).
strand: None means the field is absent (BED5 or fewer). Optional(Strand.Unknown) means the field was ’.’. score: UInt16 in [0, 1000] per BED spec. _other_fields_spans: Extra columns beyond the standard 12 (or beyond 9 for BED10/11), stored as raw byte spans.
Parameters
Section titled “Parameters”- O (
Origin[mut=O.mut])
Fields
Section titled “Fields”- chrom_start (
UInt64) - chrom_end (
UInt64) - score (
Optional[UInt16]) - strand (
Optional[Strand]) - thick_start (
Optional[UInt64]) - thick_end (
Optional[UInt64]) - block_count (
Optional[Int]) - num_fields (
Int)
Implemented traits
Section titled “Implemented traits”AnyType, Deinitable, Movable
Methods
Section titled “Methods”__init__
Section titled “__init__”fn def __init__(out self, _chrom: Span[UInt8, O], chrom_start: UInt64, chrom_end: UInt64, _name: Optional[Span[UInt8, O]], score: Optional[UInt16], 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]], var _other_fields_spans: Optional[List[Span[UInt8, O]]], num_fields: Int)Args:
- _chrom (
Span[UInt8, O]) - chrom_start (
UInt64) - chrom_end (
UInt64) - _name (
Optional[Span[UInt8, O]]) - score (
Optional[UInt16]) - 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]]) - _other_fields_spans (
Optional[List[Span[UInt8, O]]]) - num_fields (
Int) - self (
Self)
Returns:
Self
fn def chrom(self) -> StringSpan[O]Args:
- self (
Self)
Returns:
StringSpan[O]
start_position
Section titled “start_position”fn def start_position(self) -> Position1-based start of the feature (aligned with noodles_core; BED chromStart → start+1).
Args:
- self (
Self)
Returns:
Position
end_position
Section titled “end_position”fn def end_position(self) -> Optional[Position]1-based end position (chromEnd). None for zero-length BED records (chromEnd == 0).
Args:
- self (
Self)
Returns:
Optional[Position]
interval
Section titled “interval”fn 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[Interval]
thick_interval
Section titled “thick_interval”fn def thick_interval(self) -> Optional[Interval]Thick (coding) extent if fields 7–8 present; else None (1-based closed).
Args:
- self (
Self)
Returns:
Optional[Interval]
fn def name(self) -> Optional[StringSpan[O]]Args:
- self (
Self)
Returns:
Optional[StringSpan[O]]
item_rgb
Section titled “item_rgb”fn def item_rgb(self) -> Optional[ItemRgb]Args:
- self (
Self)
Returns:
Optional[ItemRgb]
other_fields
Section titled “other_fields”fn def other_fields(ref self) -> Optional[List[StringSpan[O]]]Return extra columns beyond the standard BED fields, if any.
Args:
- self (
Self)
Returns:
Optional[List[StringSpan[O]]]
to_record
Section titled “to_record”fn def to_record(self) -> BedRecordMaterialize an owned BedRecord. Call when the record must outlive the view.
Args:
- self (
Self)
Returns:
BedRecord
Raises: