Claude Skill MartBrowse skillsQuick linesLearn by videoTerminal guideWhat is a Skill?
Back to list

pysam Genomic File Toolkit

Correct, idiomatic pysam workflows for reading, querying, filtering, and writing SAM/BAM/CRAM, VCF/BCF, FASTA/FASTQ, and tabix data.

Data & AnalyticsAdvanced33,0303,248AI score 9/10Last updated: Aug 9, 2026

What it does

  • Guides Claude to write correct pysam (HTSlib) code for alignment files, variant files, indexed FASTA/FASTQ, and BGZF+tabix tables.
  • Enforces the coordinate contract: numeric APIs are 0-based half-open, region strings are 1-based inclusive — the single most common source of off-by-one bugs.
  • Ships non-destructive helper scripts: inspect_hts.py (metadata-only inspection), alignment_qc.py, variant_summary.py, and filter_alignments.py, all of which refuse to overwrite outputs.
  • Documents real-world pitfalls: CRAM reference resolution, pileup() defaults (base quality, max_depth=8000, truncate=True), header preservation on write, CSI vs BAI indexes, and safe use of the wrapped samtools/bcftools dispatchers.

Who it's for

  • Bioinformaticians and data engineers parsing NGS data in Python.
  • Teams building or maintaining BAM/VCF processing pipelines.
  • samtools CLI users who need the pysam API conventions right the first time.

Examples

  1. "Count primary reads with MAPQ ≥ 30 over chr1:1,000-2,000" → generates fetch code with correct coordinates and flag filters.
  2. "Summarize FILTER values and genotypes in cohort.vcf.gz" → runs python scripts/variant_summary.py cohort.vcf.gz --region chr1:1-1000000.
  3. "My CRAM won't decode" → diagnoses the missing reference and shows reference_filename= versus REF_PATH/REF_CACHE usage.

· · · Install guide · · ·

Try it now, no install

Paste this into Claude to use the skill without installing anything.

Read the instructions in this file and follow them to help me:
https://raw.githubusercontent.com/K-Dense-AI/scientific-agent-skills/HEAD/skills/pysam/SKILL.md

What I want: (describe your task here)

If Claude can't open the link, open it yourself and paste the contents instead.

If it works for you, download the ZIP below and install it. Then it runs on its own — no pasting each time.

Install in the Claude app (no terminal)
  1. Download the ZIP with the button below.
  2. In Claude, open Settings → Capabilities and turn on 'Code execution and file creation'. (one time)
  3. Go to Customize → Skills → + → 'Upload a skill' and upload the ZIP.
Download ZIP
Install in Claude Code

Let Claude do it — paste this into Claude Code

Install the skill I found on Claude Skill Mart.
Copy the skills/pysam folder from the GitHub repo K-Dense-AI/scientific-agent-skills into my ~/.claude/skills/pysam/.
When it's done, tell me in one line what this skill can do.

Install with a command instead

git clone https://github.com/K-Dense-AI/scientific-agent-skills.git /tmp/sas && mkdir -p ~/.claude/skills && cp -r /tmp/sas/skills/pysam ~/.claude/skills/

This is a third-party skill. Check the source repository before installing.

  1. Open a terminal and create the skills directory: mkdir -p ~/.claude/skills
  2. Clone the repository: git clone https://github.com/K-Dense-AI/scientific-agent-skills.git /tmp/sas
  3. Copy the whole skill folder (the references/ and scripts/ subfolders are required): cp -r /tmp/sas/skills/pysam ~/.claude/skills/
  4. Install the pinned library: uv pip install "pysam==0.24.0" (or pip install pysam==0.24.0). Python 3.8–3.14 is required.
  5. Verify: in Python run import pysam; print(pysam.__version__) and confirm it prints 0.24.0.
  6. Restart Claude Code and try a prompt like "inspect sample.bam and report its sort order and index status".