
pysam Genomic File Toolkit
Lets an agent read, query, filter and write SAM/BAM/CRAM, VCF/BCF and FASTA/FASTQ files correctly using pysam.
- Repository
- K-Dense-AI/scientific-agent-skills
- Stars
- 55,780
- Licence
- MIT
- Files
- 14 files
What it does
Once installed, the agent knows how to work with common genomics file formats (alignments, variant calls, reference sequences, indexed tables) using the pysam Python library. It applies rules such as 0-based versus 1-based coordinates, requiring indexes for region queries, preserving headers, and writing to new files instead of overwriting. It also ships small helper scripts that summarise a file as JSON without exposing sample names or read names by default.
Great for
- Bioinformatics programmers writing pysam code for BAM, CRAM or VCF processing
- Analysts who need a quick, read-only summary of an unfamiliar sequencing or variant file
- Teams that want consistent coordinate and filtering conventions across scripts
Skip it if
- Users who need clinical-grade or regulated variant interpretation, since outputs are generic counts and the skill makes no validation claims beyond its synthetic test suite
- Workflows on remote or cloud-hosted genomic data, because the skill's validation excludes remote storage and it is not designed around network access
- Non-Python environments, since the guidance is built around the pysam Python package
Try asking
- “Summarise the read QC counts for sample.bam using the alignment_qc script”
- “Write Python code that pulls mapping-quality-filtered reads from chr1:1000-2000 in a BAM file”
- “Filter out secondary and supplementary alignments from input.bam into a new output.bam”
- “Check the contigs, index and header of an unknown cohort.vcf.gz before analysis”
Install in 3 steps
- 1
Download the skill
The ZIP contains the 14 original files, the MIT licence and an attribution note.
pysam.zip - 2
Add it to your agent
Claude Code (all projects)
mkdir -p ~/.claude/skills && unzip pysam.zip -d ~/.claude/skills/Claude Code / Agent SDK (this project only)
mkdir -p .claude/skills && unzip pysam.zip -d .claude/skills/Claude apps (web/desktop): Settings → Capabilities → Skills → Upload skill, and choose the ZIP.
- 3
Ask for the task
No special command needed — the agent reads the skill's description and loads it when your request matches. Try one of the prompts above.
Get better results
- Give the agent the exact reference FASTA for any CRAM file, otherwise decoding will fail or need a hidden lookup.
- Run scripts/inspect_hts.py first on unfamiliar files to confirm format, index and contig names before writing analysis code.
- Pin pysam to 0.24.1 as recommended so the agent's API guidance matches the installed version.
What's inside
- references/alignment_files.md
- references/api_reference.md
- references/common_workflows.md
- references/coordinates_and_indexing.md
- references/cram_and_performance.md
- references/migration_to_0_24.md
- references/sequence_files.md
- references/sources.md
- references/variant_files.md
- scripts/alignment_qc.py
- scripts/filter_alignments.py
- scripts/inspect_hts.py
- scripts/variant_summary.py
- SKILL.md
Redistributed unmodified from K-Dense-AI/scientific-agent-skills under the MIT licence. The assessment was drafted with AI from the skill's files on 2026-10-29. Skills can instruct your agent to run code — read SKILL.md and any scripts before installing.