oxbow.read_bed

Contents

oxbow.read_bed#

oxbow.read_bed(src, bed_schema, region=None, index=None, fields=None, compressed=False)#

Return Arrow IPC format from a BED file.

Parameters:
  • src (str or file-like) – The path to the source file or a file-like object.

  • bed_schema (str) – The BED schema specifier, e.g., “bed6+3”.

  • fields (list[str], optional) – Names of the fixed fields to project.

  • compressed (bool, optional [default: False]) – Whether the source is BGZF-compressed.

Returns:

Arrow IPC

Return type:

bytes

Notes

The BED schema specifier can be one of the following (case-insensitive):

  • bed: Equivalent to BED6.

  • bed{n}: n standard fields and 0 custom fields.

  • bed{n}+{m}: n standard fields followed by m custom fields.

  • bed{n}+: n standard fields followed by an undefined number of custom fields.

While the 12 standard fields have defined types, custom fields are interpreted as text. bed{n}+ custom fields are collapsed into a single field named rest.