Skip to content

BedRecord

Mojo struct 🡭

@memory_only
struct BedRecord

Single BED feature (owned). Coordinates are 0-based, half-open.

score: UInt16 in [0, 1000] per BED spec. OtherFields: extra columns beyond the standard BED12 fields (or beyond field 9 for BED10/11), stored as owned strings.

  • Chrom (BString)
  • ChromStart (UInt64)
  • ChromEnd (UInt64)
  • Name (Optional[BString])
  • Score (Optional[UInt16])
  • Strand (Optional[Strand])
  • ThickStart (Optional[UInt64])
  • ThickEnd (Optional[UInt64])
  • ItemRgb (Optional[ItemRgb])
  • BlockSizes (Optional[List[UInt64]])
  • BlockStarts (Optional[List[UInt64]])
  • OtherFields (Optional[List[BString]])
  • NumFields (Int)

AnyType, Copyable, Deinitable, Movable, Writable

fn def chrom(ref self) -> String

Args:

  • self (Self)

Returns:

String

fn def start_position(self) -> Position

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

Args:

  • self (Self)

Returns:

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]

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]

fn def thick_interval(ref 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(ref self) -> Optional[String]

Args:

  • self (Self)

Returns:

Optional[String]

fn def item_rgb(ref self) -> Optional[ItemRgb]

Args:

  • self (Self)

Returns:

Optional[ItemRgb]

fn def block_sizes(ref self) -> Optional[List[UInt64]]

Args:

  • self (Self)

Returns:

Optional[List[UInt64]]

fn def block_starts(ref self) -> Optional[List[UInt64]]

Args:

  • self (Self)

Returns:

Optional[List[UInt64]]

fn def other_fields(ref self) -> Optional[List[String]]

Return extra columns beyond the standard BED fields, if any.

Args:

  • self (Self)

Returns:

Optional[List[String]]

fn def write_to[w: Writer](ref self, mut writer: w)

Write this record as one TAB-delimited line (same column count as parsed).

Parameters:

  • w (Writer)

Args:

  • self (Self)
  • writer (w)