pysam

Process genomic alignment, variant, and sequence files for NGS analysis.

3|Updated Apr 17, 2026
One-click install
npx skills add https://github.com/RamanEbrahimi/raman-marketplace --skill pysam-ramanebrahimi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pysam
Source: https://github.com/RamanEbrahimi/raman-marketplace/tree/main/plugins/agentic-research/skills/scientific-skills/pysam
Command: npx skills add https://github.com/RamanEbrahimi/raman-marketplace --skill pysam-ramanebrahimi

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 streamlines bioinformatics workflows by providing Pythonic access to genomic file formats, enabling users to read, manipulate, and analyze NGS data more effectively.

Core Features & Use Cases

  • Alignment File Operations: Work with SAM/BAM/CRAM alignments for mapping, coverage, and quality control.
  • Variant File Operations: Analyze genetic variants from VCF/BCF files for annotation, filtering, and population genetics.
  • Sequence File Operations: Extract reference sequences or gene regions from FASTA/FASTQ files.
  • Use Case: Imagine you have a large set of sequencing reads and variant calls. Use this Skill to calculate coverage statistics, annotate variants with coverage information, and extract sequences around variant positions.

Quick Start

Extract coverage information from a BAM file using pysam with the following command:

uv pysam pileup -f reference.fasta -o coverage.txt aligned.bam

Frequently Asked Questions about pysam

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

FAQPage Schema
How do I extract coverage statistics from a BAM file for NGS analysis?

You can calculate coverage statistics from a SAM/BAM alignment file by running a pileup command against a reference FASTA, outputting the results to a text file for quality control.

Can I read and write VCF/BCF variant files in Python?

You can read and manipulate VCF/BCF variant files in Python by utilizing the htslib dependency, enabling you to perform annotation, filtering, and population genetics analysis.

What is the best way to process SAM/BAM/CRAM alignments without leaving Python?

The best way to process SAM/BAM/CRAM alignments in Python is using a Skill that wraps htslib, providing Pythonic access to mapping, coverage analysis, and quality control.

Do I need htslib to extract reference sequences from FASTA/FASTQ files?

Yes, htslib is required. It provides the underlying C library to read and write SAM/BAM/CRAM alignments and access VCF/BCF files, which is essential for sequence processing and extraction.

How do I annotate genetic variants with sequence coverage information?

You can annotate genetic variants with coverage information by simultaneously processing alignment files for coverage statistics and variant files for genetic data, linking the two datasets together.