pysam

Read, write, and query indexed genomic alignment, variant, and sequence files.

74|5|Updated Dec 10, 2025
One-click install
npx skills add https://github.com/dralkh/seerai --skill pysam-dralkh
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pysam
Source: https://github.com/dralkh/seerai/tree/main/skills/pysam
Command: npx skills add https://github.com/dralkh/seerai --skill pysam-dralkh

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Pysam removes the friction of working directly with genomic file formats by giving you a Pythonic way to read, write, filter, and query alignment, variant, and sequence data.

Core Features & Use Cases

  • Alignment workflows: Inspect SAM, BAM, and CRAM files, fetch reads from genomic regions, calculate coverage, and perform pileup analysis.
  • Variant workflows: Read and write VCF and BCF files, inspect genotypes and INFO fields, filter variants, and merge or subset samples.
  • Sequence workflows: Extract reference intervals from FASTA, process FASTQ reads, and work with tabix-indexed BED, GTF, and GFF annotations.
  • Use case: A bioinformatics researcher can validate a variant by checking read support in BAM, comparing against the reference FASTA, and summarizing the result in a filtered VCF.

Quick Start

Use the pysam skill to open your indexed genomic file, fetch a target region, and summarize the reads, variants, or sequences it contains.

Frequently Asked Questions about pysam

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

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

To fetch reads from a genomic region in a BAM file using Python, you can open the indexed file and query the target coordinates. This approach enables region extraction, read inspection, and coverage calculation for specific genomic intervals.

Can I extract reference sequences from a FASTA file for specific intervals?

Yes, you can extract reference sequences from a FASTA file for specific intervals. By querying the indexed FASTA file, you retrieve the exact reference bases needed for tasks like variant validation or sequence comparison.

What is the best way to inspect genotypes and INFO fields in a VCF file?

The best way to inspect genotypes and INFO fields in a VCF file is to parse it programmatically with a Python genomic library. You can read records, filter variants based on specific criteria, and extract sample genotype data directly for summarization.

Does pileup analysis work with CRAM files or only BAM files?

Pileup analysis works with both CRAM and BAM files. The processing logic supports reading and querying alignment files in both formats, allowing you to perform pileup analysis and calculate coverage across indexed CRAM or BAM inputs.

How do I query tabix-indexed BED, GTF, or GFF annotation files?

You can query tabix-indexed BED, GTF, and GFF annotation files by opening them with a Pythonic genomic interface. This exposes tabix workflows, allowing you to fetch overlapping features and integrate annotations with variant or alignment data.