pysam

Automate reading, writing, and analyzing genomic data formats with pysam.

94|11|Updated Mar 26, 2026
One-click install
npx skills add https://github.com/swaruplab/operon --skill pysam-swaruplab
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pysam
Source: https://github.com/swaruplab/operon/tree/main/src-tauri/protocols/pysam
Command: npx skills add https://github.com/swaruplab/operon --skill pysam-swaruplab

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Pysam provides a Pythonic interface to read, manipulate, and write genomic data formats (SAM/BAM/CRAM, VCF/BCF, FASTA/FASTQ) enabling researchers to build reproducible pipelines and perform variant, alignment, and sequence analyses without low-level HTS tooling.

Core Features & Use Cases

  • Read and write alignment files (SAM/BAM/CRAM) and perform region-based queries for variant and read analysis.
  • Work with variant data (VCF/BCF), query and filter variants, and annotate or aggregate across samples.
  • Extract reference sequences from indexed FASTA files and process raw reads from FASTQ files for QC and downstream analyses.
  • Use cases include quality control (BAM stats, depth calculation), variant annotation, and sequence extraction in genomics pipelines.

Quick Start

Install pysam and run basic read, write, and query operations on BAM/VCF data.

Frequently Asked Questions about pysam

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

FAQPage Schema
How do I read and query SAM/BAM alignment files in Python for NGS pipelines?

To read and query SAM/BAM alignment files in Python, use pysam to automate reading, writing, and region-based queries for variant and read analysis in NGS pipelines.

What is the best way to filter and annotate VCF/BCF variant data in Python?

The best way to filter and annotate VCF/BCF variant data in Python is using pysam to query, filter, annotate, and aggregate variants across samples without low-level HTS tooling.

Can I extract reference sequences from indexed FASTA files and process raw reads from FASTQ files?

Yes, you can extract reference sequences from indexed FASTA files and process raw reads from FASTQ files using pysam for quality control and downstream sequence analyses.

Do I need low-level HTS tooling to build reproducible genomics pipelines for SAM/BAM and VCF formats?

No, you do not need low-level HTS tooling to build reproducible genomics pipelines; pysam provides a Pythonic interface to read, manipulate, and write SAM/BAM/CRAM and VCF/BCF formats directly.

Does pysam support CRAM files and region-based queries for alignment analysis?

Yes, pysam supports CRAM files and region-based queries, enabling researchers to read, write, and analyze alignment data for variant and read analysis in genomics pipelines.

What are the limitations of using Python for processing genomic data compared to dedicated bioinformatics tools?

While processing genomic data in Python using pysam requires Python and dependent modules for indexing and variant processing, it focuses on providing a Pythonic interface rather than replacing dedicated low-level HTS tools for high-performance computing tasks.