pysam

Read, manipulate, and analyze genomic datasets in SAM/BAM/CRAM and VCF/BCF formats.

Updated May 8, 2026
One-click install
npx skills add https://github.com/Zeyuyang-0420/bio-ai-research-skills --skill pysam-zeyuyang-0420
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pysam
Source: https://github.com/Zeyuyang-0420/bio-ai-research-skills/tree/main/categories/bioinformatics-genomics/pysam
Command: npx skills add https://github.com/Zeyuyang-0420/bio-ai-research-skills --skill pysam-zeyuyang-0420

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pysam, htslib, and includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

This Skill provides a Pythonic interface to manipulate and analyze genomic datasets, simplifying complex bioinformatics workflows.

Core Features & Use Cases

  • Alignment File Operations: Read, manipulate, and write SAM/BAM/CRAM alignments and VCF/BCF variant files.
  • Sequence File Operations: Extract reference sequences or gene regions, and process raw sequencing data.
  • Variant File Operations: Query, filter, annotate, and subset variant data.
  • Integrated Workflows: Combine alignment, variant, and sequence files for comprehensive genomic analysis.
  • Use Case: For a variant calling and annotation workflow, you can use pysam to align reads, extract variant information, annotate variants with additional data, and generate coverage tracks for visualization.

Quick Start

Use the pysam skill to count the read depth at a specific genomic position 'chr1:1234567'.

Frequently Asked Questions about pysam

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

FAQPage Schema
How do I read and manipulate SAM/BAM alignment files in Python?

To read and manipulate SAM/BAM alignment files in Python, you can use this Skill to provide a Pythonic interface for genomic data operations. It supports reading, writing, and analyzing SAM/BAM/CRAM formats within bioinformatics workflows.

What is the best way to query and filter VCF variant data using Python?

Querying and filtering VCF variant data is achieved through a Pythonic interface that supports VCF/BCF file formats. You can query, filter, annotate, and subset variant data to streamline genomic analysis and variant calling workflows.

Can I extract reference sequences or specific gene regions from genomic data?

Yes, you can extract reference sequences or specific gene regions from genomic data. The Skill provides sequence file operations to process raw sequencing data and extract targeted genomic regions for downstream analysis.

Do I need htslib installed to process CRAM files with Python?

Yes, you need htslib installed alongside pysam to process CRAM files with Python. The Skill requires both pysam and htslib libraries to perform genomic file operations and manipulate alignment formats.

How do I calculate read depth at a specific genomic position?

Calculating read depth at a specific genomic position involves querying alignment files using Python. You can use this Skill to count the read depth at specific coordinates like 'chr1:1234567' by processing SAM/BAM alignment data.