pysam SAM BAM Summary Starter

SkillAI & models

Use this skill to read a small SAM, BAM, or CRAM file with pysam, summarize core alignment statistics, and optionally emit an indexed BAM artifact for downstream debugging or demos.

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use the pysam SAM BAM Summary Starter skill

About this capability

A framework for discovering, compiling, and validating reusable skills for scientific agents.

What this skill tells your AI

The instructions your AI receives, as published by ma-compbio-lab/skillfoundry in skills/genomics/pysam-sam-bam-summary-starter/SKILL.md and read by ahel’s review.

Use this skill to read a small SAM, BAM, or CRAM file with pysam, summarize core alignment statistics, and optionally emit an indexed BAM artifact for downstream debugging or demos.

What it does

  • Opens a local alignment file with pysam.AlignmentFile.
  • Reports header references, mapped and unmapped counts, pairing flags, and per-reference mapped counts.
  • Optionally writes a BAM copy and builds a .bai index.

When to use it

  • You need a deterministic starter for SAM/BAM/CRAM handling in Python.
  • You want a tiny verified example of format conversion plus indexing.
  • You need a compact JSON summary before building larger alignment-processing skills.

Example

slurm/envs/genomics/bin/python skills/genomics/pysam-sam-bam-summary-starter/scripts/run_pysam_sam_bam_summary.py \
  --input skills/genomics/pysam-sam-bam-summary-starter/examples/toy_reads.sam \
  --out scratch/genomics/pysam_summary.json \
  --bam-out scratch/genomics/toy_reads.bam

Verification

  • Skill-local tests: python3 -m unittest discover -s skills/genomics/pysam-sam-bam-summary-starter/tests -p 'test_*.py'
  • Expected summary: record_count == 4, mapped_count == 3, and reference_mapped_counts.chr1 == 2

Signals

GitHub stars
39
Forks
5
Last commit
Sep 2026
Advanced
Catalog kind
skill
Gateway key
pysam-sam-bam-summary-starter
Source
github.com/ma-compbio-lab/skillfoundry