pysam

Read, write, and manipulate genomic data files via htslib.

8|Updated Jan 13, 2026
One-click install
npx skills add https://github.com/hxk622/TokenDance --skill pysam-hxk622
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pysam
Source: https://github.com/hxk622/TokenDance/tree/main/backend/app/skills/builtin/scientific/bioinformatics/pysam
Command: npx skills add https://github.com/hxk622/TokenDance --skill pysam-hxk622

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill simplifies the complex task of reading, manipulating, and writing genomic data files, making bioinformatics analysis more accessible.

Core Features & Use Cases

  • Genomic File Handling: Seamlessly work with SAM/BAM/CRAM alignments, VCF/BCF variants, and FASTA/FASTQ sequences.
  • Data Analysis: Extract specific regions, calculate read coverage, and process NGS data pipelines efficiently.
  • Use Case: Analyze variant calls from a VCF file, extract sequences around specific genomic regions from a FASTA file, and calculate coverage depth from a BAM file for a research project.

Quick Start

Use the pysam skill to read the first 1000 bases of chromosome 1 from the file 'reference.fasta'.

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 and VCF files for NGS data analysis?

You can read and manipulate SAM/BAM and VCF files for NGS data analysis using a Pythonic interface to the htslib library. It enables efficient querying of genomic regions, calculation of read coverage, and integration into NGS data processing pipelines.

What is the best way to extract specific genomic regions from a FASTA sequence?

Extracting specific genomic regions from a FASTA sequence is best handled through a Pythonic interface to htslib. This approach enables efficient querying and extraction of target sequence regions directly within NGS data processing pipelines.

Can I calculate read coverage depth from a BAM file using Python?

Yes, you can calculate read coverage depth from a BAM file using Python. A Pythonic interface to the htslib library provides the necessary functions to process alignments and compute coverage depth efficiently for NGS analysis.

Does pysam support reading and writing CRAM alignments and BCF variants?

Yes, pysam supports reading and writing CRAM alignments and BCF variants. It provides a Pythonic interface to the htslib library for seamlessly handling SAM, BAM, CRAM, VCF, and BCF genomic data files.

How do I analyze variant calls from a VCF file in a bioinformatics pipeline?

Analyzing variant calls from a VCF file in a bioinformatics pipeline is achieved through a Pythonic interface to htslib. It enables efficient reading, filtering, and manipulation of VCF/BCF variants alongside other genomic data formats.