πŸƒπŸΌβ€β™‚οΈ Quick start

polars-bio is available on PyPI and can be installed with pip:

pip install polars-bio
There are binary versions for Linux (x86_64), MacOS (x86_64 and arm64) and Windows (x86_64). In case of other platforms (or errors indicating incompatibilites between Python's ABI), it is fairly easy to build polars-bio from source with poetry and maturin:
git clone https://github.com/biodatageeks/polars-bio.git
cd polars-bio
poetry env use 3.12
poetry update
RUSTFLAGS="-Ctarget-cpu=native" maturin build --release -m Cargo.toml
and you should see the following output:
Compiling polars_bio v0.10.3 (/Users/mwiewior/research/git/polars-bio)
Finished `release` profile [optimized] target(s) in 1m 25s
πŸ“¦ Built wheel for abi3 Python β‰₯ 3.8 to /Users/mwiewior/research/git/polars-bio/target/wheels/polars_bio-0.10.3-cp38-abi3-macosx_11_0_arm64.whl
and finally install the package with pip:
pip install /Users/mwiewior/research/git/polars-bio/target/wheels/polars_bio-0.10.3-cp38-abi3-macosx_11_0_arm64.whl

Tip

Required dependencies:

  • Python>=3.9<3.13 (3.12 is recommended),
  • poetry
  • cmake,
  • Rust compiler
  • Cargo are required to build the package from source. rustup is the recommended way to install Rust.
import polars_bio as pb
pb.read_vcf("gs://gcp-public-data--gnomad/release/4.1/genome_sv/gnomad.v4.1.sv.sites.vcf.gz", compression_type="bgz").limit(3).collect()
shape: (3, 8)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ chrom ┆ start ┆ end    ┆ id                             ┆ ref ┆ alt   ┆ qual  ┆ filter              β”‚
β”‚ ---   ┆ ---   ┆ ---    ┆ ---                            ┆ --- ┆ ---   ┆ ---   ┆ ---                 β”‚
β”‚ str   ┆ u32   ┆ u32    ┆ str                            ┆ str ┆ str   ┆ f64   ┆ str                 β”‚
β•žβ•β•β•β•β•β•β•β•ͺ═══════β•ͺ════════β•ͺ════════════════════════════════β•ͺ═════β•ͺ═══════β•ͺ═══════β•ͺ═════════════════════║
β”‚ chr1  ┆ 10000 ┆ 295666 ┆ gnomAD-SV_v3_DUP_chr1_01c2781c ┆ N   ┆ <DUP> ┆ 134.0 ┆ HIGH_NCR            β”‚
β”‚ chr1  ┆ 10434 ┆ 10434  ┆ gnomAD-SV_v3_BND_chr1_1a45f73a ┆ N   ┆ <BND> ┆ 260.0 ┆ HIGH_NCR;UNRESOLVED β”‚
β”‚ chr1  ┆ 10440 ┆ 10440  ┆ gnomAD-SV_v3_BND_chr1_3fa36917 ┆ N   ┆ <BND> ┆ 198.0 ┆ HIGH_NCR;UNRESOLVED β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

If you see the above output, you have successfully installed polars-bio and can start using it. Please refer to the Tutorial and API documentation for more details on how to use the library.