Skip to content
Back to skills

Pysam Sam Bam Summary Starter

ASecurity

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.

  • 38 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 8, 2026
ai-agentspythonbashdebugging

Security analysis

A100/100

Pro scans all 8 files and shows the line behind each finding

Scanned September 8, 2026

npx -y skills add ma-compbio-lab/SkillFoundry --skill pysam-sam-bam-summary-starter --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Pysam Sam Bam Summary Starter?

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

Security grade badge for Pysam Sam Bam Summary Starter
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ma-compbio-lab-pysam-sam-bam-summary-starter/badge)](https://www.skillsdirectory.com/skills/ma-compbio-lab-pysam-sam-bam-summary-starter)

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
# pysam SAM BAM Summary Starter

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

```bash
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`

Files in this skill

  • SKILL.md1.2 KB
  • assets/README.md150 B
  • examples/README.md255 B
  • examples/toy_reads.sam248 B
  • metadata.yaml1.2 KB
  • refs.md362 B
  • scripts/run_pysam_sam_bam_summary.py4.1 KB
  • tests/test_run_pysam_sam_bam_summary.py2.3 KB

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.

View all in ai-agents →

Comments

Loading comments…

Newsletter

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