Skip to content

Python toolkit that reads and writes SAM/BAM/CRAM, VCF/BCF, and FASTA/FASTQ files for NGS pipelines.

CCM score
65 of 100
skills.sh installs
233
GitHub stars
34.3K
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers alignment, variant, and sequence file operations, plus integrated workflows that combine BAM, VCF, and reference data
  • Includes reference guides for alignment files, variant files, sequence files, and common workflows, along with a quick start for each file type
  • Enforces 0-based, half-open coordinates, with fetch() region strings following the 1-based samtools convention
  • Designed for bioinformatics pipelines that need random access to indexed genomic files, coverage calculation, and pileup analysis

Install

$ npx -y skills add davila7/claude-code-templates --skill pysam -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Pysam

Overview

Pysam is a Python module for reading, manipulating, and writing genomic datasets. Read/write SAM/BAM/CRAM alignment files, VCF/BCF variant files, and FASTA/FASTQ sequences with a Pythonic interface to htslib. Query tabix-indexed files, perform pileup analysis for coverage, and execute samtools/bcftools commands.

When to Use This Skill

This skill should be used when:

  • Working with sequencing alignment files (BAM/CRAM)
  • Analyzing genetic variants (VCF/BCF)
  • Extracting reference sequences or gene regions
  • Processing raw sequencing data (FASTQ)
  • Calculating coverage or read depth
  • Implementing bioinformatics analysis pipelines
  • Quality control of sequencing data
  • Variant calling and annotation workflows

Quick Start

Installation

uv pip install pysam

Basic Examples

Read alignment file:

import pysam

# Open BAM file and fetch reads in region
samfile = pysam.AlignmentFile("example.bam", "rb")
for read in samfile.fetch("chr1", 1000, 2000):
    print(f"{read.query_name}: {read.reference_start}")
samfile.close()

Details

Repository
github.com/davila7/claude-code-templates
Categories
Data Science & Analytics, Research & Academic, Python
First seen
Jun 3, 2026

Questions

What does the pysam skill do?

The pysam skill is a genomic file toolkit for reading and writing SAM, BAM and CRAM alignments, VCF and BCF variant files, and FASTA and FASTQ sequences. It can extract regions, calculate coverage and run samtools or bcftools commands for NGS data processing pipelines.

How do I install the pysam skill?

Run npx -y skills add davila7/claude-code-templates --skill pysam -y in your project. After installing, the agent can work with BAM, VCF and FASTA files directly from Python using the pysam module.

Where does pysam stand in its category?

Pysam is listed under Data Science & Analytics on Claude Marketplaces, alongside skills such as azure-kusto and analyze-project. Its focus is genomic sequencing files rather than general analytics.

What does pysam need before I use it?

The skill's SKILL.md installs the pysam Python module with uv pip install pysam. Random access to regions needs index files such as .bai for BAM, .fai for FASTA and .tbi for VCF.gz.

More from davila7/claude-code-templates

All 398