pysam

Manage and analyze BAM, CRAM, VCF, BCF, FASTA, and FASTQ genomic files.

Updated May 10, 2026
One-click install
npx skills add https://github.com/Imad-Oute/ResearchForge --skill pysam-imad-oute
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pysam
Source: https://github.com/Imad-Oute/ResearchForge/tree/main/OpenSource-Projects/claude-scientific-skills/scientific-skills/pysam
Command: npx skills add https://github.com/Imad-Oute/ResearchForge --skill pysam-imad-oute

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill facilitates efficient reading, manipulation, and writing of large-scale genomic datasets, simplifying complex bioinformatics workflows.

Core Features & Use Cases

  • Alignment File Operations: Load, fetch, and analyze sequencing alignment files (BAM/CRAM), supporting coverage calculation and region-specific data extraction. For example, fetching reads overlapping a gene to assess expression levels.
  • Variant File Handling: Read and process VCF/BCF files for variant analysis, filtering, and annotation. For instance, extracting high-confidence SNPs within genomic regions.
  • Sequence Data Manipulation: Access reference sequences and raw read data from FASTA/FASTQ files, used in tasks like validating variants or extracting gene sequences. For example, retrieving the nucleotide context around a mutation site.
  • Bioinformatics Workflow Integration: Combine multiple data formats for comprehensive analysis, such as calculating coverage metrics, validating called variants, and extracting sequences around interest points.

Quick Start

Use the pysam library in Python to efficiently process alignment files by opening a BAM file, fetching reads from a specific region, and calculating coverage, all through straightforward API calls.

Frequently Asked Questions about pysam

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

FAQPage Schema
How do I calculate sequencing coverage for a specific genomic region from a BAM file?

To calculate sequencing coverage from a BAM file, you can fetch reads overlapping a specific genomic region and compute coverage metrics directly through straightforward API calls. This allows region-specific data extraction to assess expression levels or depth.

What is the best way to filter high-confidence SNPs from VCF files in Python?

Filtering high-confidence SNPs from VCF files in Python involves reading and processing VCF/BCF files to extract variants within specific genomic regions. You can apply filtering criteria to isolate high-confidence variants for downstream analysis.

Can I extract nucleotide sequences around a mutation site from a FASTA reference?

Yes, you can extract nucleotide sequences around a mutation site by accessing reference sequences from FASTA files. This retrieves the specific nucleotide context required for validating called variants or analyzing sequence-level changes.

Does pysam support working with CRAM alignment files and samtools features?

Yes, the pysam library supports loading and analyzing CRAM alignment files. It interfaces with standard bioinformatics formats and integrates command-line samtools features seamlessly within Python scripts.

How do I integrate multiple genomic data formats for variant validation workflows?

Integrating multiple genomic data formats for variant validation involves combining alignment files, variant files, and reference sequences. This comprehensive analysis allows calculating coverage metrics, validating called variants, and extracting sequences around interest points.