Skip to content
Back to skills

Polars Bio

ASecurity

A high-performance skill for processing genomic data (VCF, FASTA, BED) using polars-bio. Features streaming VCF processing, interval joins, FASTA analysis, and variant annotation.

  • 57 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 17, 2026
datapythonexpressdatabaseperformance

Works with

  • cli

Security analysis

A100/100

Scanned October 17, 2026

npx -y skills add diegosouzapw/awesome-omni-skill --skill polars-bio --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Polars Bio?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Polars Bio
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/diegosouzapw-polars-bio/badge)](https://www.skillsdirectory.com/skills/diegosouzapw-polars-bio)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: polars-bio
description: A high-performance skill for processing genomic data (VCF, FASTA, BED) using polars-bio. Features streaming VCF processing, interval joins, FASTA analysis, and variant annotation.
license: Apache-2.0
---

# Polars-Bio Skill

## Overview

This skill leverages `polars-bio` and `polars` to provide a robust toolkit for large-scale genomic data analysis. It is designed to handle datasets larger than memory using Polars' streaming engine and lazy evaluation.

## Capabilities

### 1. VCF Processing
*   **Lazy Loading:** Use `pb.scan_vcf()` to define execution plans without loading data into memory immediately.
*   **Streaming Conversion:** Efficiently convert VCFs to Parquet (`sink_parquet`) for faster downstream queries.
*   **Filtering & Cleaning:** Parse INFO fields and filter variants using Polars expressions.

### 2. Genomic Interval Operations
*   **Overlap Joins:** High-performance interval joins (finding variants within genomic regions like Cytobands or Genes) using `pb.overlap()`.

### 3. Sequence Analysis
*   **FASTA Processing:** Lazy reading of FASTA files (`pb.scan_fasta`) to calculate sequence metrics (e.g., GC content, sequence length).

### 4. Variant Annotation
*   **Database Integration:** Annotate VCF variants with external datasets (e.g., gnomAD, dbSNP) using efficient point-joins on `chrom`, `start`, `ref`, `alt`.

## Quick Start

### Basic VCF Loading & Interval Join

```python
import polars as pl
import polars_bio as pb

# 1. Lazy Load VCF
vcf_lf = pb.scan_vcf("data/clinvar.vcf.gz")

# 2. Load Regions (e.g., BED file)
regions_lf = pl.scan_csv("data/regions.bed", separator="\t", has_header=False, 
                         new_columns=["chrom", "start", "end", "name"])

# 3. Perform Interval Overlap
# Finds variants in VCF that overlap with regions
joined_lf = pb.overlap(vcf_lf, regions_lf)

# 4. Execute (Streaming)
result = joined_lf.collect(streaming=True)
print(result)
```

### Convert VCF to Parquet

```python
# Efficiently convert large VCF to Parquet without high memory usage
pb.scan_vcf("input.vcf").sink_parquet("output.parquet")
```

### FASTA GC Content Analysis

```python
lf = pb.scan_fasta("genome.fa")
lf = lf.with_columns(
    pl.col("sequence").str.count_matches("G|C").alias("gc_count"),
    pl.col("sequence").str.len_chars().alias("len")
)
print(lf.select(pl.col("gc_count").sum() / pl.col("len").sum()).collect())
```

## Benchmarks

The skill includes a benchmark comparing **Eager** vs. **Streaming** execution. Streaming mode has been shown to reduce memory usage by **~33%** on standard workloads. See `ANALYSIS_REPORT.md` for details.

## Dependencies

- `polars`
- `polars-bio`
- `pyarrow` (for Parquet)

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.