polars-bio

Perform genomic interval operations on Polars DataFrames with scalable execution.

46|4|Updated Apr 8, 2023
One-click install
npx skills add https://github.com/CRAG666/dotfiles --skill polars-bio-crag666
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: polars-bio
Source: https://github.com/CRAG666/dotfiles/tree/main/skills/polars-bio
Command: npx skills add https://github.com/CRAG666/dotfiles --skill polars-bio-crag666

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It streamlines high-performance genomic interval operations and bioinformatics file I/O by letting you run overlap, nearest, merge, coverage, complement, and subtract directly on Polars DataFrames with scalable, out-of-core execution.

Core Features & Use Cases

  • Genomic interval arithmetic: Compute overlap, nearest, merge/cluster, coverage, complement, and subtract for BED/VCF-like interval data using a DataFrame-first API.
  • Fast file I/O for bioinformatics formats: Read and stream BED, VCF, BAM, CRAM, GFF/GTF, FASTA/FASTQ, SAM, and Hi-C pairs with cloud-path support and compression handling.
  • SQL + streaming workflows: Register genomic files as DataFusion tables and query them with SQL, then pipe results into interval operations for end-to-end analytics.
  • Ideal use cases: Large cohort interval matching, variant-region filtering and joining, pileup-style depth-driven region selection, and migrating from bioframe to a faster Polars-backed alternative.

Quick Start

Install polars-bio, then run overlap between two interval datasets by executing: pb.overlap(df1, df2).collect()

Frequently Asked Questions about polars-bio

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I perform genomic interval operations like overlap and nearest using Polars DataFrames?

Genomic interval operations like overlap and nearest are performed directly on Polars DataFrames using the functional API or LazyFrame .pb accessor, materializing results via collect. You call pb.overlap(df1, df2).collect() to execute the interval math.

Can I query and stream large bioinformatics files like BED, VCF, and BAM with SQL?

Yes, you can register bioinformatics files such as BED, VCF, and BAM as DataFusion tables to query them with SQL. This supports scalable streaming workflows, allowing you to pipe SQL query results directly into downstream interval operations.

What is the best way to handle large cohort genomic interval matching and variant-region filtering?

Handling large cohort genomic interval matching is best achieved using scalable, out-of-core execution on Polars LazyFrames. This approach streams large datasets via DataFusion, enabling high-throughput overlap, coverage, and subtract operations without memory constraints.

Do I need to use specific column schemas for genomic interval math in Polars?

Yes, genomic interval math requires Polars-backed interval schemas with chrom, start, and end columns by default. Adhering to this specific schema structure ensures that operations like merge, complement, and subtract execute correctly on your interval data.

How does migrating from bioframe to a Polars-backed alternative improve genomic interval operations?

Migrating from bioframe to a Polars-backed alternative accelerates genomic interval operations by leveraging out-of-core execution and DataFusion streaming. This provides faster processing for high-throughput tasks like overlap and coverage on large bioinformatics datasets.

What are the limitations of streaming genomic interval operations via DataFusion?

A key limitation is that streaming genomic interval operations require strict Polars-backed interval schemas with chrom, start, and end columns. You must also use collect or eager output_type for output materialization, which impacts memory usage during large-scale analytics.