pysam

Read, write, and analyze SAM/BAM/CRAM, VCF/BCF, and FASTA/FASTQ genomic files with pysam.

22|4|Updated May 25, 2026
One-click install
npx skills add https://github.com/crazymsn/academic-skills --skill pysam-crazymsn
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pysam
Source: https://github.com/crazymsn/academic-skills/tree/main/academic-skills/pysam
Command: npx skills add https://github.com/crazymsn/academic-skills --skill pysam-crazymsn

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 datasets, including SAM/BAM/CRAM alignments, VCF/BCF variants, and FASTA/FASTQ sequences.

Core Features & Use Cases

  • Read and write alignment and variant files with a Pythonic API.
  • Query regions, compute coverage, and integrate with indexed reference and tabix data.
  • Use cases include pipeline validation, sequence extraction, and cross-format data interoperability.

Quick Start

Install pysam in your environment and begin reading BAM and VCF data programmatically.

Frequently Asked Questions about pysam

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

FAQPage Schema
How do I read and analyze BAM or VCF files in Python?

Read and analyze BAM or VCF files in Python using a Pythonic API to iterate alignments and variants, query regions, and extract data. It supports SAM, BAM, CRAM, VCF, and BCF formats for sequencing pipelines.

Can I query specific genomic regions and calculate coverage from CRAM files?

Yes, you can query specific genomic regions and calculate coverage from CRAM files. The toolkit integrates with CRAI and BAI index formats to enable efficient region queries and coverage calculation directly within sequencing analysis pipelines.

Does this genomics toolkit support reading and writing FASTA and FASTQ sequences?

This genomics toolkit supports reading and writing FASTA and FASTQ sequences alongside alignment and variant files. It integrates with FAI index formats to enable sequence extraction and cross-format data interoperability in bioinformatics workflows.

What is the best way to validate variants and check sequencing pipeline data interoperability?

The best way to validate variants and check pipeline interoperability is to use a Pythonic interface that opens VCF and BCF files programmatically. This allows you to iterate through variants, filter data, and validate variant calls against indexed reference data.

How do I work with Tabix and indexed genomic data in Python?

You work with Tabix and indexed genomic data in Python by opening tabix-indexed files through a Pythonic API. This enables region queries, efficient data extraction, and integration with indexed reference data for cross-format genomics analysis.

What are the limitations of processing large CRAM and BAM files programmatically?

Processing large CRAM and BAM files programmatically requires proper index integration like BAI or CRAI to perform efficient region queries. Without these indexes, iterating through massive alignment files for coverage calculation and data extraction can become computationally intensive.