vampire.anno.pp.read_bedgraph#
- vampire.anno.pp.read_bedgraph(bedgraph_file, columns={'chrom': String, 'end': Int64, 'start': Int64, 'value': Float64})[source]#
Lazily read a BEDGraph file using Polars.
This function returns a
polars.LazyFrameand does not read or parse the file immediately. The file will only be read when the lazy query is executed (e.g. viacollect()).The input file is assumed to be in BEDGraph format with at least four columns:
chrom(chromosome name)start(0-based start position)end(end position, exclusive)value(value)
Any additional columns present in the file are preserved and automatically assigned standard BEDGraph column names when possible.
- Parameters:
bedgraph_file (
str) – Path to the input BEDGraph file. Both uncompressed.bedgraphand gzip-compressed.bedgraph.gzfiles are supported.columns (
dict[str,DataType]) – Column names and data types to read.
- Returns:
A lazily-evaluated Polars LazyFrame representing the BEDGraph file contents.
- Return type:
LazyFrame- Raises:
FileNotFoundError – If the specified BEDGraph file does not exist.