vampire.anno.pp.read_bed

Contents

vampire.anno.pp.read_bed#

vampire.anno.pp.read_bed(bed_file, columns={'blockCount': Int64, 'blockSizes': String, 'blockStarts': String, 'chrom': String, 'end': Int64, 'itemRgb': String, 'name': String, 'score': Float64, 'start': Int64, 'strand': String, 'thickEnd': Int64, 'thickStart': Int64})[source]#

Read a BED or BED.GZ file using pysam and polars.

This function returns a polars.LazyFrame.

The input file is assumed to be in BED format with at least three columns:

  • chrom (chromosome name)

  • start (0-based start position)

  • end (end position, exclusive)

Any additional columns present in the file are preserved and automatically assigned standard BED column names when possible.

Parameters:
  • bed_file (str) – Path to the input BED file. Both uncompressed .bed and gzip-compressed .bed.gz files are supported.

  • columns (dict[str, DataType]) – Column names and data types to read.

Returns:

A lazily-evaluated Polars LazyFrame representing the BED file contents.

Return type:

LazyFrame

Raises:

FileNotFoundError – If the specified BED file does not exist.