Guide · Agent skill
How to use the polars-bio genomic intervals agent skill
Updated · written with AI from the project's own documentation and checked against our catalogue data
The polars-bio skill teaches an AI agent to work with genomic coordinate data, such as gene regions or sequencing reads, using the polars-bio Python library on Polars DataFrames. This guide explains what an agent skill is, how to install this one, how to phrase requests so the agent uses it, and what to check before trusting the output. It is written for readers who have not used agent skills before.
Quick start
- 1Download and unzip the skill. Download the ZIP from this page and unzip it to get the skill folder containing SKILL.md.
- 2Place it where your agent looks. Move the folder to ~/.claude/skills/ for all projects, or to a project's .claude/skills/ folder for one project. Alternatively, upload it under Settings, then Capabilities, then Skills in the Claude apps.
- 3Install the Python library. Run the pinned uv pip install command from the guide in an environment dedicated to this work.
- 4Describe your genomic task. Ask the agent for an interval operation in plain language, naming your files and the question you want answered.
- 5State your coordinate convention. Tell the agent which assembly and convention your files use, or let it record them before running the analysis.
- 6Check a small result. Ask the agent to run on a small fixture or a subset and compare counts and boundaries with a hand-computed answer.
What an agent skill is and what this one makes the agent do
An agent skill is a folder with a SKILL.md file and supporting reference files. When the skill is installed, the agent can read these instructions and follow them for matching tasks. This skill covers genomic interval arithmetic and bioinformatics file input and output through Polars and DataFusion.
Once installed, the agent can find overlapping or nearest genomic intervals, merge or subtract regions, compute coverage and complement regions, and read or write common files such as BED, VCF, BCF, BAM, CRAM, GFF, GTF, FASTA and FASTQ. The skill also tells the agent to record the assembly and coordinate convention, and to check results against small hand-computable examples.
Install the polars-bio skill from the ZIP
Download the skill ZIP from this page and unzip it. To make it available to Claude Code for all your projects, place the unzipped skill folder in ~/.claude/skills/. To limit it to one project, place it in that project's .claude/skills/ folder.
In the Claude apps, you can instead upload the skill under Settings, then Capabilities, then Skills.
The skill also needs the Python library. The skill's own install instructions use the command below. Pin the versions exactly as shown, because the skill was tested against them.
- Confirm the Requires section above matches your Python version before installing.
- Keep this environment separate from other packages that need different Arrow or DataFusion releases.
uv pip install "polars-bio==0.36.0" "polars==1.44.2"Ask for genomic interval work in plain language
You do not need to name the skill. Describe the task in terms of genomic regions, files or formats, and mention Polars if that is your stack. The skill description covers overlap, nearest, merge, coverage, complement and subtraction, plus lazy file I/O, SQL queries and migration from bioframe.
Good requests name the files and the question. Include the assembly if you know it, and say whether you need hit counts, covered bases or read depth, because these are different results.
- Find which ChIP-seq peaks in peaks.bed overlap genes in genes.bed, and give one row per peak.
- Count how many VCF variants fall inside each target region, keeping the region IDs.
- Convert my bioframe overlap and closest code to polars-bio and flag boundary differences.
- Compute the uncovered regions of this genome, using the chromosome sizes file as bounds.
- Read this BAM file lazily and summarise read depth on chr1.
Understand the coordinate convention before you run anything
The default convention is 1-based closed, including BED reads that the library converts. Setting use_zero_based=True on a genomic reader gives 0-based half-open output. This argument converts positions, so it is not just a label. For example, a BED interval [0,10) becomes [1,10] by default and stays [0,10) with the override.
For DataFrames you build yourself, metadata only labels existing numbers and does not convert them. Convert closed [s,e] to half-open by using s-1 and e, set the metadata after conversion, and never convert twice. The skill's example also turns on the coordinate check option so mismatches raise errors.
- Inspect pb.get_metadata(frame) after transformations and SQL steps.
- Expect CoordinateSystemMismatchError when inputs disagree about their convention.
- Expect MissingCoordinateSystemError if strict mode is on and metadata is missing.
pb.set_option("datafusion.bio.coordinate_system_zero_based", True)
pb.set_option("datafusion.bio.coordinate_system_check", True)Read files lazily and inspect a small result first
Use scan_* functions for lazy plans and read_* functions for eager reads. Lazy plans do not guarantee bounded memory at every stage, so check schemas and inspect a small result before scaling up. Use the file-specific reader for each format, and check the schema of your real input, because the examples are templates.
BED readers expose BED4 fields. BED3 gives a null name, and extra BED6 or BED12 fields are not kept by the default reader. Use the schema route described in the skill when you need strand or block fields.
- Use the same assembly for every input file in a join.
- Filter and select columns early, then collect.
peaks = pb.scan_bed("peaks.bed", use_zero_based=True)
variants = pb.scan_vcf("cohort.vcf.gz", use_zero_based=True, info_fields=[], format_fields=[])
hits = pb.overlap(peaks, variants).collect(engine="streaming")Choose the right operation for the question
The most common mistake is choosing an operation that answers a different question. overlap returns intersecting pairs, so a query can appear several times. count_overlaps counts target records per query, including zero. coverage returns the number of covered bases, which is not read depth. nearest returns up to k neighbours, and a distance of zero can mean overlap or simple adjacency.
merge and cluster combine overlapping regions, and boundary behaviour depends on min_dist. complement needs explicit finite genome bounds, because without a view it uses an effectively unbounded extent. The skill also notes that on_cols is exposed in some signatures but is not implemented in this release, so split inputs by that key yourself if you need per-group analysis.
- For one result per original query row, ask for left output with distinct output.
- Test boundary fixtures with bookended intervals before trusting merge results.
- Do not treat an arbitrary equidistant nearest candidate as the unique annotation.
Safety notes: scripts, network and credentials
This skill runs scripts and its allowed tools include Read, Write, Edit and Bash. It uses the network only when you read remote data, and that is when provider credentials may be needed. Reading local files does not require network access. For external-reference CRAM files you need a local FASTA and its .fai index.
Read the skill's files and any scripts before you let the agent run them, especially in a project that holds sensitive data. Keep credentials out of prompts and project files where possible.
- Do not use the output for clinical or diagnostic decisions without independent validation.
- Validate maximum coordinates before running, especially for concatenated genomes or custom coordinate spaces above the default overlap index bound.
- Keep provenance: preserve IDs, coordinate metadata and the assembly name when you save results.
What people use it for
- Finding which regulatory peaks overlap annotated genes, with one row per peak.
- Counting variants in target regions while keeping the region IDs for downstream joins.
- Computing uncovered stretches of a genome by supplying chromosome sizes as bounds.
- Porting bioframe overlap, closest or coverage code to a Polars-based workflow and listing boundary differences.
- Reading BED, VCF or BAM files lazily and writing filtered VCF output.
Frequently asked questions
How do I install the polars-bio agent skill?
Download the skill ZIP from this page and unzip it. Put the folder in ~/.claude/skills/ for all projects, or in a project's .claude/skills/ folder for one project. In the Claude apps you can also upload it under Settings, then Capabilities, then Skills.
What do I need to run polars-bio?
You need a supported Python version listed in the skill's Requires section, plus the pinned polars-bio and Polars packages from the install command. Optional pandas support needs pandas 3 or newer. Remote data needs network access and provider credentials, and external-reference CRAM needs a local FASTA and .fai index.
Is the polars-bio skill free, and what is its licence?
The listing says MIT. However, the SKILL.md frontmatter declares Apache-2.0, so check the licence file in the downloaded folder before you reuse it. The skill is a set of instructions and reference files, and polars-bio itself is a separate Python package.
How is polars-bio different from bioframe?
Both do genomic interval operations, but similar function names do not make them drop-in replacements. polars-bio's overlap returns inner pairs, while bioframe's defaults to a left join, and merge and cluster treat bookended intervals differently. The skill's migration reference lists these differences for each operation.
Why are my overlap counts different from my bioframe results?
The most likely cause is a coordinate convention or boundary difference. Check whether your inputs are 1-based closed or 0-based half-open, and whether merge uses min_dist 0 or 1. Testing a small hand-computed fixture usually shows which rule differs.
Can the skill handle very large genomes?
Be careful. The default overlap indexing casts coordinates to a signed 32-bit integer, so coordinates above 2,147,483,647 can give wrong results. Validate maximum coordinates before running, especially for concatenated genomes.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
Use this skill if you already work with genomic intervals in Polars or are moving bioframe code to a faster Polars-based workflow, and you are willing to check boundary conventions on small fixtures. Pick a different tool if you do not work with genomic data, or if you need clinical or diagnostic results without independent validation.
Download the skill