pysam

Read, manipulate, and write genomic data files via a Python interface.

1|Updated Mar 12, 2026
One-click install
npx skills add https://github.com/yf8578/clawomics --skill pysam-yf8578
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pysam
Source: https://github.com/yf8578/clawomics/tree/main/skills/pysam
Command: npx skills add https://github.com/yf8578/clawomics --skill pysam-yf8578

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides a Pythonic interface to work with common genomic file formats like SAM/BAM/CRAM, VCF/BCF, and FASTA/FASTQ, enabling efficient bioinformatics data processing and analysis.

Core Features & Use Cases

  • Alignment File Operations: Read, write, and manipulate SAM/BAM/CRAM files for alignment data.
  • Variant File Operations: Process VCF/BCF files for genetic variant analysis.
  • Sequence File Operations: Access FASTA/FASTQ for reference sequences and raw reads.
  • Use Case: Analyze sequencing alignment data to calculate coverage, filter variants based on quality, and extract specific genomic regions for further investigation.

Quick Start

Use the pysam skill to read the alignment file 'example.bam' and fetch reads from region 'chr1:1000-2000'.

Frequently Asked Questions about pysam

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

FAQPage Schema
How do I extract reads from a specific genomic region in a BAM file using Python?

To extract reads from a BAM file, you use a Pythonic interface that requires htslib for efficient indexed access. This allows random retrieval of alignment data from specific genomic regions like 'chr1:1000-2000'.

Can I process VCF variant files and calculate sequencing coverage in the same pipeline?

Yes, you can process VCF variant files and calculate sequencing coverage in the same pipeline. The interface supports reading, manipulating, and writing both SAM/BAM alignments and VCF/BCF variants.

How do I read and manipulate FASTA and FASTQ sequences for NGS data processing?

You can read and manipulate FASTA and FASTQ sequences by using a Python interface designed for NGS data processing. This provides access to reference sequences and raw reads for bioinformatics analysis.

Does pysam require htslib to handle CRAM and BCF genomic file formats?

Yes, pysam requires htslib to handle CRAM and BCF genomic file formats efficiently. Htslib provides the underlying file handling capabilities necessary for reading and writing these compressed genomic data formats.

What is the best way to query genetic variants from a BCF file in Python?

The best way to query genetic variants from a BCF file in Python is using a dedicated genomic file toolkit. It provides variant querying operations and supports indexed access for efficient random retrieval of variant data.

Are there limitations when using pysam for large-scale bioinformatics data processing?

While pysam facilitates bioinformatics data processing pipelines, its performance depends on htslib and proper file indexing. Without indexed access for random retrieval, processing large-scale genomic files may become inefficient.