Skip to content

API reference

The polars-bio API reference is organized like the Features guide:

  • Reading files: eager (read_*), lazy (scan_*), and describe (describe_*) access to bioinformatic formats from local and cloud storage.
  • Genomic operations: interval (range) operations — overlap, nearest, coverage, merge, cluster, complement, subtract — and pileup per-base depth.
  • Writing files: eager (write_*) and streaming (sink_*) output to bioinformatic formats.
  • SQL interface: register datasets as tables and query them with the SQL interface powered by Apache DataFusion.
  • Auxiliary: DataFrame metadata, session options, and error types.

There are 2 ways of using polars-bio API:

  • using polars_bio module

Example

import polars_bio as pb
pb.read_fastq("gs://genomics-public-data/platinum-genomes/fastq/ERR194146.fastq.gz").limit(1).collect()
  • directly on a Polars LazyFrame under a registered pb namespace

Example

 >>> type(df)
 <class 'polars.lazyframe.frame.LazyFrame'>
   import polars_bio as pb
   df.pb.sort().limit(5).collect()

Tip

  1. Not all are available in both ways.
  2. You can of course use both ways in the same script.