Tested demoQuality 93/100

K-Dense-AI/scientific-agent-skills/skills/polars-bio/SKILL.md

polars-bio

High-performance genomic interval operations and bioinformatics file I/O on Polars DataFrames. Overlap, nearest, merge, coverage, complement, subtract for BED/VCF/BAM/GFF intervals. Streaming, cloud-native, faster bioframe alternative.

Source repository stars
34,478
Declared platforms
0
Static risk flags
1
Last source update
2026-08-24
Source checked
2026-08-26

Decision brief

What it does: where it fits

High-performance genomic interval operations and bioinformatics file I/O on Polars DataFrames. Overlap, nearest, merge, coverage, complement, subtract for BED/VCF/BAM/GFF intervals.

Best for

  • Performing genomic interval operations (overlap, nearest, merge, coverage, complement, subtract)
  • Reading/writing bioinformatics file formats (BED, VCF, BAM, CRAM, GFF/GTF, FASTA, FASTQ)
  • Processing large genomic datasets that don't fit in memory (streaming mode)

Not for

  • .pb accessor on DataFrame vs LazyFrame: Interval operations (overlap, merge, etc.) are only on LazyFrame.pb. DataFrame.pb only has write methods. Use .lazy() to convert before chaining interval ops.
  • LazyFrame returns: All interval operations and pb.sql() return LazyFrame by default. Don't forget .collect() or use outputtype="polars.DataFrame".
Controlled single-run demoChecked 2026-08-20

What changed when the Skill was used

In this controlled same-task single run, enabling polars-bio changed the output from 3345 non-whitespace characters and 17 headings to 4259 characters and 11 headings. Matches among 8 signals extracted from the pinned source changed from 2 to 2. Both actual outputs are shown; this is a structural observation, not a quality score or a universal performance claim.

Same test task

Design and implement a representative production change for a TypeScript webhook retry service. Include the key code or pseudocode, tradeoffs, and verification steps. The deliverable must specifically reflect this user intent: High-performance genomic interval operations and bioinformatics file I/O on Polars DataFrames. Overlap, nearest, merge, coverage, complement, subtract for BED/VCF/BAM/GFF intervals. Streaming, cloud-native, faster bioframe alternative.

Without the Skill
Screenshot of the actual model output for polars-bio without the Skill

Baseline: 3345 non-whitespace characters, 17 headings, and 39 list items.

With the Skill
Screenshot of the actual model output for polars-bio with the Skill

With Skill: 4259 non-whitespace characters, 11 headings, and 43 list items.

ObservationWithout SkillWith Skill
Source-signal coverage2/8: start, overlap2/8: polars-bio, overlap
Output structure3345 chars · 17 headings · 39 list items · 4 code blocks4259 chars · 11 headings · 43 list items · 3 code blocks
Verification and caution signals9 verification signals · 7 risk/limitation signals12 verification signals · 3 risk/limitation signals

A prompt you can use

Use the polars-bio Skill pinned at 390f5146bf3c for my task. Follow its source-specific constraints around `polars-bio`, `quick`, `start`, `installation`, then return the finished deliverable with explicit assumptions, verification, failure conditions, and limits. Do not treat the Skill text as a factual source or claim that a single demonstration proves universal performance.

Method and limitationsExpand

Test method

  • Baseline and treatment used the same task, model (gpt-5.3-codex-low), and runner; the only planned difference was whether the complete target Skill text was injected.
  • The treatment used snapshot d767725c6e93b1d02a220e6be75b261a9833ede5; the current source commit 390f5146bf3c1877cf15636a3dd7b775e4f0f185 was verified against content hash 1e9884dfe714. The baseline explicitly prohibited loading any Skill or external rule file.
  • The same deterministic script counted characters, headings, lists, code blocks, verification terms, caution terms, and source signals in both artifacts. Source signals: `polars-bio`, `quick`, `start`, `installation`, `basic`, `overlap`, `example`, `create`.
  • The visuals are local screenshots of the actual Markdown artifacts in a fixed 1200 × 800 evidence canvas, not recreated product mockups. Raw JSON artifacts and request records are retained in the research directory.

Do not over-read this demo

  • This is one controlled demonstration per condition, not a multi-run statistical benchmark; the model is stochastic.
  • Character, structure, and keyword counts show observable differences but cannot by themselves prove correctness, originality, or business impact.
  • The task is a representative test designed for repeatability, not every real-world use of the Skill; rerun after a material source change.
Editorial review
SkillSignal editorial
Runner
Cursor Agent 2026.07.09-a3815c0
Model
gpt-5.3-codex-low
Refresh due
2026-11-18
Reviewed commit
390f5146bf3c1877cf15636a3dd7b775e4f0f185
Test snapshot
d767725c6e93b1d02a220e6be75b261a9833ede5

Compatibility matrix

Platform support, with evidence labels

PlatformStatusEvidenceWhat to check
CodexNot declaredNo explicit evidencePortability before use
Claude CodeNot declaredNo explicit evidencePortability before use
CursorNot declaredNo explicit evidencePortability before use
Gemini CLINot declaredNo explicit evidencePortability before use
Open the compatibility checker

Installation

Inspect first. Install second.

The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.

Source-detected install commandSource
npx skills add https://github.com/K-Dense-AI/scientific-agent-skills --skill "skills/polars-bio"
Safe inspection promptEditorial

Inspect the Agent Skill "polars-bio" from https://github.com/K-Dense-AI/scientific-agent-skills/blob/36d8f13a1e754618794bf42f417884940077b4ae/skills/polars-bio/SKILL.md at commit 36d8f13a1e754618794bf42f417884940077b4ae. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.

Workflow

What the source asks the agent to do

  1. 01

    Quick Start

    Requires Python 3.11–3.14 (see PyPI).

    Requires Python 3.11–3.14 (see PyPI).For pandas compatibility (pandas ≥3.0):python import polars as pl import polarsbio as pb
  2. 02

    Process with Polars streaming (requires polars ≥1.37, bundled with polars-bio)

    result = lf.collect(engine="streaming") python pb.setoption("datafusion.execution.targetpartitions", 8) python import os pb.setoption("datafusion.execution.targetpartitions", os.cpucount()) python df = pb.readvcf("large.vcf.gz").select("chrom", "start", "end", "ref", "alt") pyth…

    Prefer functional API for single operations, method-chaining for pipelines: Use pb.overlap() for one-off operations and .lazy().pb.overlap() when building multi-step pipelines.intervaloperations.md - All 8 interval operations with parameters, examples, output schemas, and performance tips. Core reference for genomic range arithmetic.fileio.md - Supported formats table, per-format column schemas, cloud storage configuration, compression support, and common parameters.
  3. 03

    When to Use This Skill

    Use this skill when: - Performing genomic interval operations (overlap, nearest, merge, coverage, complement, subtract) - Reading/writing bioinformatics file formats (BED, VCF, BAM, CRAM, GFF/GTF, FASTA, FASTQ) - Processing large genomic datasets that don't fit in memory (stream…

    Performing genomic interval operations (overlap, nearest, merge, coverage, complement, subtract)Reading/writing bioinformatics file formats (BED, VCF, BAM, CRAM, GFF/GTF, FASTA, FASTQ)Processing large genomic datasets that don't fit in memory (streaming mode)
  4. 04

    Installation

    Requires Python 3.11–3.14 (see PyPI).

    Requires Python 3.11–3.14 (see PyPI).For pandas compatibility (pandas ≥3.0):
  5. 05

    Basic Overlap Example

    python import polars as pl import polarsbio as pb

    python import polars as pl import polarsbio as pb

Permission review

Static risk signals and limitations

Reads files

low · line 77

The documentation asks the agent to read local files, directories, or repositories.

# Eager read (loads entire file)

Reads files

low · line 143

The documentation asks the agent to read local files, directories, or repositories.

# Read VCF file

Evidence record

Why each signal appears

EvidenceSourceComputedTestedEditorial
SignalValueEvidence typeMeaning
Quality score93/100ComputedDocumentation, specificity, maintenance, and trust rules
Repository stars34,478SourceRepository attention, not individual Skill quality
Compatibility0 platformsSourceDeclared in the catalog source record
Usage guidetested outcome pageTestedGenerated or reviewed according to the visible evidence level

Pinned source

Provenance and original SKILL.md

Repository
K-Dense-AI/scientific-agent-skills
Skill path
skills/polars-bio/SKILL.md
Commit
36d8f13a1e754618794bf42f417884940077b4ae
License
MIT
Collected
2026-08-26
Default branch
main
View the original SKILL.md

polars-bio

Overview

polars-bio is a high-performance Python library for genomic interval operations and bioinformatics file I/O, built on Polars, Apache Arrow, and Apache DataFusion. It provides a familiar DataFrame-centric API for interval arithmetic (overlap, nearest, merge, coverage, complement, subtract) and reading/writing common bioinformatics formats (BED, VCF, BAM, CRAM, GFF/GTF, FASTA, FASTQ).

Key value propositions:

  • 6-38x faster than bioframe on real-world genomic benchmarks
  • Streaming/out-of-core support for large genomes via DataFusion
  • Cloud-native file I/O (S3, GCS, Azure) with predicate pushdown
  • Two API styles: functional (pb.overlap(df1, df2)) and method-chaining (df1.lazy().pb.overlap(df2))
  • SQL interface for genomic data via DataFusion SQL engine

When to Use This Skill

Use this skill when:

  • Performing genomic interval operations (overlap, nearest, merge, coverage, complement, subtract)
  • Reading/writing bioinformatics file formats (BED, VCF, BAM, CRAM, GFF/GTF, FASTA, FASTQ)
  • Processing large genomic datasets that don't fit in memory (streaming mode)
  • Running SQL queries on genomic data files
  • Migrating from bioframe to a faster alternative
  • Computing read depth/pileup from BAM/CRAM files
  • Working with Polars DataFrames containing genomic intervals

Quick Start

Installation

Requires Python 3.11–3.14 (see PyPI).

uv pip install "polars-bio==0.31.0"

For pandas compatibility (pandas ≥3.0):

uv pip install "polars-bio[pandas]==0.31.0"

Basic Overlap Example

import polars as pl
import polars_bio as pb

# Create two interval DataFrames
df1 = pl.DataFrame({
    "chrom": ["chr1", "chr1", "chr1"],
    "start": [1, 5, 22],
    "end":   [6, 9, 30],
})

df2 = pl.DataFrame({
    "chrom": ["chr1", "chr1"],
    "start": [3, 25],
    "end":   [8, 28],
})

# Functional API (returns LazyFrame by default)
result = pb.overlap(df1, df2)
result_df = result.collect()

# Get a DataFrame directly
result_df = pb.overlap(df1, df2, output_type="polars.DataFrame")

# Method-chaining API (via .pb accessor on LazyFrame)
result = df1.lazy().pb.overlap(df2)
result_df = result.collect()

Reading a BED File

import polars_bio as pb

# Eager read (loads entire file)
df = pb.read_bed("regions.bed")

# Lazy scan (streaming, for large files)
lf = pb.scan_bed("regions.bed")
result = lf.collect()

Core Capabilities

1. Genomic Interval Operations

polars-bio provides 8 core interval operations for genomic range arithmetic. All operations accept Polars DataFrames with chrom, start, end columns (configurable). All operations return a LazyFrame by default (use output_type="polars.DataFrame" for eager results).

Operations:

  • overlap / count_overlaps - Find or count overlapping intervals between two sets (overlap_output="left" returns df1-only hits since 0.30.0)
  • nearest - Find nearest intervals (with configurable k, overlap, distance params)
  • merge - Merge overlapping/bookended intervals within a set
  • cluster - Assign cluster IDs to overlapping intervals
  • coverage - Compute per-interval coverage counts (two-input operation)
  • complement - Find gaps between intervals within a genome
  • subtract - Remove portions of intervals that overlap another set

Example:

import polars_bio as pb

# Find overlapping intervals (returns LazyFrame)
result = pb.overlap(df1, df2, suffixes=("_1", "_2"))

# Count overlaps per interval
counts = pb.count_overlaps(df1, df2)

# Merge overlapping intervals
merged = pb.merge(df1)

# Find nearest intervals
nearest = pb.nearest(df1, df2)

# Collect any LazyFrame result to DataFrame
result_df = result.collect()

Reference: See references/interval_operations.md for detailed documentation on all operations, parameters, output schemas, and performance considerations.

2. Bioinformatics File I/O

Read and write common bioinformatics formats with read_*, scan_*, write_*, and sink_* functions. Supports cloud storage (S3, GCS, Azure) and compression (GZIP, BGZF).

Supported formats:

  • BED - Genomic intervals (read_bed, scan_bed, write_* via generic)
  • VCF - Genetic variants (read_vcf, scan_vcf, write_vcf, sink_vcf)
  • VCF Zarr - Analysis-ready Zarr stores (read_vcf_zarr, scan_vcf_zarr; local directory paths)
  • BAM - Aligned reads (read_bam, scan_bam, write_bam, sink_bam)
  • CRAM - Compressed alignments (read_cram, scan_cram, write_cram, sink_cram)
  • GFF - Gene annotations (read_gff, scan_gff)
  • GTF - Gene annotations (read_gtf, scan_gtf)
  • FASTA - Reference sequences (read_fasta, scan_fasta, write_fasta, sink_fasta)
  • FASTQ - Sequencing reads (read_fastq, scan_fastq, write_fastq, sink_fastq)
  • SAM - Text alignments (read_sam, scan_sam, write_sam, sink_sam)
  • Hi-C pairs - Chromatin contacts (read_pairs, scan_pairs)

Example:

import polars_bio as pb

# Read VCF file
variants = pb.read_vcf("samples.vcf.gz")

# Lazy scan BAM file (streaming)
alignments = pb.scan_bam("aligned.bam")

# Read GFF annotations
genes = pb.read_gff("annotations.gff3")

# Cloud storage (individual params, not a dict)
df = pb.read_bed("s3://bucket/regions.bed",
                 allow_anonymous=True)

Reference: See references/file_io.md for per-format column schemas, parameters, cloud storage options, and compression support.

3. SQL Data Processing

Register bioinformatics files as tables and query them using DataFusion SQL. Combines the power of SQL with polars-bio's genomic-aware readers.

import polars as pl
import polars_bio as pb

# Register files as SQL tables (path first, name= keyword)
pb.register_vcf("samples.vcf.gz", name="variants")
pb.register_bed("target_regions.bed", name="regions")

# Query with SQL (returns LazyFrame)
result = pb.sql("SELECT chrom, start, end, ref, alt FROM variants WHERE qual > 30")
result_df = result.collect()

# Register a Polars DataFrame as a SQL table
pb.from_polars("my_intervals", df)
result = pb.sql("SELECT * FROM my_intervals WHERE chrom = 'chr1'").collect()

Reference: See references/sql_processing.md for register functions, SQL syntax, and examples.

4. Pileup Operations

Compute per-base read depth from BAM/CRAM files with CIGAR-aware depth calculation.

import polars_bio as pb

# Compute depth across a BAM file
depth_lf = pb.depth("aligned.bam")
depth_df = depth_lf.collect()

# With quality filter
depth_lf = pb.depth("aligned.bam", min_mapping_quality=20)

Reference: See references/pileup_operations.md for parameters and integration patterns.

Key Concepts

Coordinate Systems

polars-bio defaults to 1-based coordinates (genomic convention). This can be changed globally:

import polars_bio as pb

# Switch to 0-based half-open coordinates (default is 1-based / False)
pb.set_option("datafusion.bio.coordinate_system_zero_based", True)

# Switch back to 1-based (default)
pb.set_option("datafusion.bio.coordinate_system_zero_based", False)

I/O functions also accept use_zero_based to set coordinate metadata on the resulting DataFrame:

# Read BED with explicit 0-based metadata
df = pb.read_bed("regions.bed", use_zero_based=True)

Important: BED files are always 0-based half-open in the file format. polars-bio handles the conversion automatically when reading BED files. Coordinate metadata is attached to DataFrames by I/O functions and propagated through operations.

Two API Styles

Functional API - standalone functions, explicit inputs:

result = pb.overlap(df1, df2, suffixes=("_1", "_2"))
merged = pb.merge(df)

Method-chaining API - via .pb accessor on LazyFrames (not DataFrames):

result = df1.lazy().pb.overlap(df2)
merged = df.lazy().pb.merge()

Important: The .pb accessor for interval operations is only available on LazyFrame. On DataFrame, .pb provides write operations only (write_bam, write_vcf, etc.).

Method-chaining enables fluent pipelines:

# Chain interval operations (note: overlap outputs suffixed columns,
# so rename before merge which expects chrom/start/end)
result = (
    df1.lazy()
    .pb.overlap(df2)
    .filter(pl.col("start_2") > 1000)
    .select(
        pl.col("chrom_1").alias("chrom"),
        pl.col("start_1").alias("start"),
        pl.col("end_1").alias("end"),
    )
    .pb.merge()
    .collect()
)

Probe-Build Architecture

For two-input operations (overlap, nearest, count_overlaps, coverage), polars-bio uses a probe-build join strategy:

  • The first DataFrame is the probe (iterated over)
  • The second DataFrame is the build (indexed for lookup)

For best performance, pass the larger DataFrame as the first argument (probe) and the smaller one as the second (build).

Column Conventions

By default, polars-bio expects columns named chrom, start, end. Custom column names can be specified via lists:

result = pb.overlap(
    df1, df2,
    cols1=["chromosome", "begin", "finish"],
    cols2=["chr", "pos_start", "pos_end"],
)

Return Types and Collecting Results

All interval operations and pb.sql() return a LazyFrame by default. Use .collect() to materialize results, or pass output_type="polars.DataFrame" for eager evaluation:

# Lazy (default) - collect when needed
result_lf = pb.overlap(df1, df2)
result_df = result_lf.collect()

# Eager - get DataFrame directly
result_df = pb.overlap(df1, df2, output_type="polars.DataFrame")

Streaming and Out-of-Core Processing

For datasets larger than available RAM, use scan_* functions and streaming execution:

# Scan files lazily
lf = pb.scan_bed("large_intervals.bed")

# Process with Polars streaming (requires polars ≥1.37, bundled with polars-bio)
result = lf.collect(engine="streaming")

DataFusion streaming is enabled by default for interval operations, processing data in batches without loading the full dataset into memory.

Common Pitfalls

  1. .pb accessor on DataFrame vs LazyFrame: Interval operations (overlap, merge, etc.) are only on LazyFrame.pb. DataFrame.pb only has write methods. Use .lazy() to convert before chaining interval ops.

  2. LazyFrame returns: All interval operations and pb.sql() return LazyFrame by default. Don't forget .collect() or use output_type="polars.DataFrame".

  3. Column name mismatches: polars-bio expects chrom, start, end by default. Use cols1/cols2 parameters (as lists) if your columns have different names.

  4. Coordinate system metadata: Interval operations read coordinate metadata from I/O functions or DataFrame config_meta. For manually built DataFrames, set df.config_meta.set(coordinate_system_zero_based=True) (0-based) or False (1-based). If metadata is missing, polars-bio falls back to the global datafusion.bio.coordinate_system_zero_based setting (with a warning). Set pb.set_option("datafusion.bio.coordinate_system_check", True) to raise MissingCoordinateSystemError instead. Mismatched systems between inputs raise CoordinateSystemMismatchError.

  5. Probe-build order matters: For overlap, nearest, and coverage, the first DataFrame is probed against the second. Swapping arguments changes which intervals appear in the left vs right output columns, and can affect performance.

  6. INT32 position limit: Genomic positions are stored as 32-bit integers, limiting coordinates to ~2.1 billion. This is sufficient for all known genomes but may be an issue with custom coordinate spaces.

  7. BAM index requirements: read_bam and scan_bam require a .bai index file alongside the BAM. Create one with samtools index if missing.

  8. Parallel execution disabled by default: DataFusion parallelism defaults to 1 partition. Enable for large datasets:

    pb.set_option("datafusion.execution.target_partitions", 8)
    
  9. CRAM has separate functions: Use read_cram/scan_cram/register_cram for CRAM files (not read_bam). CRAM functions require a reference_path parameter.

Best Practices

  1. Use scan_* for large files: Prefer scan_bed, scan_vcf, etc. over read_* for files larger than available RAM. Scan functions enable streaming and predicate pushdown.

  2. Configure parallelism for large datasets:

    import os
    pb.set_option("datafusion.execution.target_partitions", os.cpu_count())
    
  3. Use BGZF compression: BGZF-compressed files (.bed.gz, .vcf.gz) support parallel block decompression, significantly faster than plain GZIP.

  4. Select columns early: When only specific columns are needed, select them early to reduce memory usage:

    df = pb.read_vcf("large.vcf.gz").select("chrom", "start", "end", "ref", "alt")
    
  5. Use cloud paths directly: Pass S3/GCS/Azure URIs directly to read/scan/register functions instead of downloading files first. Authenticated access uses your cloud SDK credentials (AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY, GOOGLE_APPLICATION_CREDENTIALS, Azure defaults) only when those cloud paths are accessed:

    df = pb.read_bed("s3://my-bucket/regions.bed", allow_anonymous=True)
    
  6. Prefer functional API for single operations, method-chaining for pipelines: Use pb.overlap() for one-off operations and .lazy().pb.overlap() when building multi-step pipelines.

Resources

references/

Detailed documentation for each major capability:

  • interval_operations.md - All 8 interval operations with parameters, examples, output schemas, and performance tips. Core reference for genomic range arithmetic.

  • file_io.md - Supported formats table, per-format column schemas, cloud storage configuration, compression support, and common parameters.

  • sql_processing.md - Register functions, DataFusion SQL syntax, combining SQL with interval operations, and example queries.

  • pileup_operations.md - Per-base read depth computation from BAM/CRAM files, parameters, and integration with interval operations.

  • configuration.md - Global settings (parallelism, coordinate systems, streaming modes), logging, and metadata management.

  • bioframe_migration.md - Operation mapping table, API differences, performance comparison, migration code examples, and pandas compatibility mode.

Frequently asked questions

What to verify before installation and use

What does the polars-bio source document cover?

High-performance genomic interval operations and bioinformatics file I/O on Polars DataFrames. Overlap, nearest, merge, coverage, complement, subtract for BED/VCF/BAM/GFF intervals.

How do I install polars-bio?

The source record exposes this install command: npx skills add https://github.com/K-Dense-AI/scientific-agent-skills --skill "skills/polars-bio". Inspect the command and pinned source before running it.

Which permission-related actions were detected?

Static rules flagged read-files in the source; the page lists the matching lines and excerpts.

Alternatives

Compare before choosing

Computed 9834,478

K-Dense-AI/scientific-agent-skills

dask

Distributed computing for larger-than-RAM pandas/NumPy workflows. Use when you need to scale existing pandas/NumPy code beyond memory or across clusters. Best for parallel file processing, distributed ML, integration with existing pandas code. For out-of-core analytics on single machine use vaex; for in-memory speed use polars.

Computed 97149

UiPath/skills

uipath-coded-apps

UiPath Coded Apps — scaffold, build, run, and deploy Coded Web Apps and Coded Action Apps: React/TypeScript apps that call UiPath Cloud APIs via the `@uipath/uipath-typescript` SDK and ship to Automation Cloud (push/pull to Studio Web, pack, publish, deploy, OAuth-PKCE). Also generates live analytics & governance dashboards from a plain-language request, wired to tenant data via the Insights real-time API, with edit and deploy flows. For RPA→uipath-rpa, Python agents→uipath-agents, Maestro flows

Computed 96870

awslabs/agent-plugins

dsql

Build with Aurora DSQL — manage schemas, execute queries, handle migrations, diagnose query plans, diagnose cluster performance, load data, and develop applications with a serverless, distributed SQL database. Covers IAM auth, multi-tenant patterns, MySQL-to-DSQL and PostgreSQL-to-DSQL schema conversion, FK replacement code generation, OCC retry patterns, ORM migration (Django/EF Core/Hibernate/Rails), DDL operations, query plan explainability, system diagnostics via CloudWatch AAS, SQL compatib

Computed 953,780

elementalsouls/Claude-BugHunter

bb-local-toolkit

Local-tooling companion to the bug-bounty orchestrator — carries the SAME complete bug-bounty workflow, but reach for THIS variant when you also need to resolve where tools, wordlists, and clones are installed on the local machine (jhaddix, SecLists, trufflehog, ffuf, dalfox, ghauri); for pure orchestration/routing use the bug-bounty skill. Workflow it covers — recon (subdomain enumeration, asset discovery, fingerprinting, HackerOne scope, source code audit), pre-hunt learning (disclosed reports