pysam

Read, write, and manipulate genomic data files in SAM, BAM, CRAM, VCF, BCF, FASTA, and FASTQ formats.

1|Updated Jan 14, 2026
One-click install
npx skills add https://github.com/Sologa/codex-pipeline --skill pysam-sologa
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pysam
Source: https://github.com/Sologa/codex-pipeline/tree/main/.codex/skills/pysam
Command: npx skills add https://github.com/Sologa/codex-pipeline --skill pysam-sologa

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

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

Core Features & Use Cases

  • Genomic File Handling: Seamlessly work with SAM/BAM/CRAM alignments, VCF/BCF variants, and FASTA/FASTQ sequences.
  • Data Extraction & Analysis: Extract specific genomic regions, calculate read coverage, and perform pileup analysis.
  • Use Case: Analyze sequencing alignment data (BAM files) to identify regions of low coverage or validate genetic variants against a reference genome.

Quick Start

Use the pysam skill to read the first 1000 bases from the reference sequence in 'reference.fasta' for chromosome 'chr1'.

Frequently Asked Questions about pysam

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

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

To read BAM files and extract specific regions in Python, you can use a Pythonic interface to perform efficient region-based querying directly on alignment data. This enables targeted extraction of genomic intervals from SAM, BAM, and CRAM formats for next-generation sequencing pipelines.

What is the best way to calculate read coverage and perform pileup analysis for sequencing data?

The best way to calculate read coverage and perform pileup analysis is by applying a Pythonic genomic data interface to process SAM/BAM alignments. This approach simplifies extracting coverage metrics across specific genomic coordinates for next-generation sequencing data.

Can I use Python to parse and manipulate VCF and BCF variant files?

Yes, you can parse and manipulate VCF and BCF variant files using a Pythonic genomic toolkit. It allows you to read, write, and validate genetic variants directly within next-generation sequencing data processing pipelines.

How do I extract specific sequences from a FASTA file for a target chromosome?

To extract sequences from a FASTA file for a target chromosome, use a Pythonic genomic interface to fetch specific genomic regions. This enables rapid sequence extraction from reference genomes for variant validation and alignment tasks.

Does this genomic file handling approach support CRAM files for next-generation sequencing pipelines?

Yes, this genomic file handling approach fully supports CRAM files alongside SAM and BAM formats within next-generation sequencing pipelines. It provides a Pythonic interface to seamlessly read, write, and manipulate compressed alignment data for bioinformatics analysis.