pysam

Provide Pythonic interfaces for SAM/BAM/CRAM and VCF/BCF genomic file operations.

Updated May 17, 2026
One-click install
npx skills add https://github.com/galeep/plugin-place --skill pysam-galeep
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pysam
Source: https://github.com/galeep/plugin-place/tree/main/plugins/sci-bioinformatics-genomics/skills/pysam
Command: npx skills add https://github.com/galeep/plugin-place --skill pysam-galeep

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill provides Pythonic interfaces for genomic file operations, solving the problem of working with complex genomic data formats like SAM/BAM/CRAM and VCF/BCF.

Core Features & Use Cases

  • Genomic File Operations: Read, manipulate, and write genomic datasets with Pythonic syntax.
  • Alignment File Operations: Work with SAM/BAM/CRAM alignment files for mapping, coverage, and quality control.
  • Variant File Operations: Handle VCF/BCF variant files for variant analysis, filtering, and annotation.
  • Sequence File Operations: Process FASTA/FASTQ sequences for extraction, validation, and statistics.
  • Use Case: For a researcher analyzing NGS data, this Skill can be used to efficiently map reads, call variants, and extract reference sequences.

Quick Start

Install the pysam skill and run the following command to fetch reads from a specified region:

uv pip install pysam
pysam fetch "chr1" 1000 2000 -o output.bam

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?

You can read and manipulate SAM/BAM alignment files using Pythonic genomic interfaces that wrap htslib, enabling efficient mapping, coverage analysis, and quality control operations directly within Python scripts.

What is the best way to filter and analyze VCF variant files for NGS data?

Filtering and analyzing VCF variant files for NGS data is best handled by Pythonic genomic interfaces supporting VCF/BCF formats, which enable direct variant analysis, filtering, and annotation within Python workflows.

Can I extract specific regions from CRAM files without loading the entire dataset?

Yes, you can extract specific regions from CRAM files without loading the entire dataset by utilizing targeted fetch operations provided by Pythonic genomic interfaces built upon htslib.

Do I need htslib installed to process FASTA sequences in Python?

Yes, htslib is required to process FASTA sequences in Python, as the underlying genomic data interfaces rely on it to perform efficient sequence extraction, validation, and statistical calculations.

How does Python handle large genomic datasets compared to command-line bioinformatics tools?

Python handles large genomic datasets by providing Pythonic wrappers around optimized C libraries like htslib, combining scripting ease with the high performance required for efficient SAM/BAM and VCF/BCF file operations.