pysam

Read and write genomic data files via a Pythonic htslib interface.

Updated Mar 10, 2026
One-click install
npx skills add https://github.com/Yezez9/Research-Agent --skill pysam-yezez9
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pysam
Source: https://github.com/Yezez9/Research-Agent/tree/main/scientific-skills/pysam
Command: npx skills add https://github.com/Yezez9/Research-Agent --skill pysam-yezez9

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides a powerful Python interface for reading, manipulating, and writing common genomic file formats, streamlining bioinformatics workflows.

Core Features & Use Cases

  • Alignment File Handling: Read and write SAM, BAM, and CRAM files for sequencing alignment data.
  • Variant File Processing: Work with VCF and BCF files for genetic variant analysis.
  • Sequence File Access: Read FASTA and FASTQ files for reference sequences and raw reads.
  • Use Case: Analyze coverage depth across a specific genomic region from a BAM file, extract variants overlapping a gene from a VCF, or fetch a reference sequence for a particular locus.

Quick Start

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

Frequently Asked Questions about pysam

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

FAQPage Schema
How do I read specific genomic regions from a BAM file in Python?

To read specific genomic regions from a BAM file, this Skill provides a Pythonic interface to htslib, enabling indexed access for random retrieval of alignment data within targeted loci. It supports efficient querying of large sequencing files.

Can I extract variants overlapping a gene from a VCF file?

Yes, you can extract variants from a VCF file. This Skill processes variant call formats, allowing you to query specific genomic coordinates and manipulate genetic variant data efficiently using a Pythonic interface.

What is the best way to process large FASTQ files for sequence analysis?

The best way to process large FASTQ files is using sequential processing capabilities. This Skill interfaces with htslib to read and write sequence files, enabling efficient manipulation of raw reads for next-generation sequencing analysis.

Does pysam support reading and writing CRAM alignment files?

Yes, this Skill supports reading and writing CRAM files. It provides a comprehensive interface to htslib for handling sequencing alignment data across SAM, BAM, and CRAM formats, streamlining bioinformatics workflows.

How do I fetch a reference sequence for a particular locus from a FASTA file?

You can fetch a reference sequence for a particular locus from a FASTA file using indexed access. This Skill enables random retrieval of genomic regions, allowing you to extract specific sequences from reference genomes efficiently.

How do I analyze coverage depth across a specific genomic region from a BAM file?

You can analyze coverage depth by reading the BAM file and querying the specific genomic region. This Skill enables indexed access for random retrieval, allowing you to calculate sequencing coverage across targeted loci efficiently.