pysam

Process BAM, VCF, and FASTA genomics data with Python via htslib.

321|26|Updated Mar 10, 2026
One-click install
npx skills add https://github.com/mkurman/tamux --skill pysam-mkurman
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pysam
Source: https://github.com/mkurman/tamux/tree/main/skills/scientific-skills/pysam
Command: npx skills add https://github.com/mkurman/tamux --skill pysam-mkurman

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Pysam provides a Pythonic interface to the htslib library, enabling researchers to read, write, and manipulate genomic alignment, variant, and sequence data without diving into low-level tooling.

Core Features & Use Cases

  • Support for BAM/SAM/CRAM, VCF/BCF, and FASTA/FASTQ workflows.
  • Querying, filtering, and computing statistics on sequencing data (coverage, depth, variants).
  • Use cases: building end-to-end genomic analysis pipelines, QC checks, and data extraction from reference genomes.

Quick Start

Install pysam and load a BAM to fetch reads, iterate variants, and access reference sequences.

Frequently Asked Questions about pysam

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I read and filter BAM files in Python for genomic data analysis?

You can read and filter BAM files in Python by using a Pythonic interface to htslib, which enables region queries and statistical analyses on sequencing alignment data without low-level tooling.

What is the best way to process VCF variant data in a Python bioinformatics pipeline?

Processing VCF variant data in a Python bioinformatics pipeline is best handled by wrapping htslib, allowing you to iterate variants, apply filters, and compute statistics directly within Python workflows.

Can I query specific genomic regions from FASTA reference sequences using Python?

Yes, you can query specific genomic regions from FASTA reference sequences using Python by leveraging htslib wrappers that provide efficient access to reference sequence data for extraction and analysis.

Does pysam support CRAM files for sequencing alignment workflows?

Yes, pysam supports CRAM files alongside BAM and SAM formats for sequencing alignment workflows, providing a Pythonic interface to read, write, and manipulate genomic alignment data efficiently.

How do I calculate sequencing depth and coverage statistics from BAM files in Python?

Calculating sequencing depth and coverage statistics from BAM files in Python is done through htslib wrappers that enable querying and computing statistical analyses directly on alignment data.

What do I need to set up before running genomic data queries with pysam?

Before running genomic data queries with pysam, you need Python installed along with pysam and related index files for your BAM, VCF, or FASTA data to ensure reliable region queries and filtering operations.