pysam

Manipulate and analyze genomic data files using Python and htslib.

557|98|Updated Nov 7, 2025
One-click install
npx skills add https://github.com/jimmc414/Kosmos --skill pysam-jimmc414
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pysam
Source: https://github.com/jimmc414/Kosmos/tree/main/kosmos-claude-scientific-skills/scientific-skills/pysam
Command: npx skills add https://github.com/jimmc414/Kosmos --skill pysam-jimmc414

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides a powerful Python interface for reading, writing, and manipulating complex genomic file formats, streamlining bioinformatics analysis pipelines.

Core Features & Use Cases

  • Alignment File Handling: Read and write SAM, BAM, and CRAM alignment files for next-generation sequencing data.
  • Variant Analysis: Process VCF and BCF variant files for genetic variation studies.
  • Sequence Data: Work with FASTA and FASTQ files for reference sequences and raw reads.
  • Use Case: Analyze sequencing alignment data to identify genetic variants, calculate coverage, and extract specific genomic regions for further study.

Quick Start

Use the pysam skill to read the first 1000 bases from the reference genome file 'hg19.fasta' on chromosome 1.

Frequently Asked Questions about pysam

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

FAQPage Schema
How do I read and manipulate SAM, BAM, and CRAM alignment files in Python?

You can process VCF and BCF variant files for genetic variation studies using pysam. It enables efficient extraction and analysis of variant data to identify genetic variations within bioinformatics research pipelines.

How do I extract a specific genomic region from a FASTA reference sequence?

To extract a specific genomic region from a FASTA reference sequence, pysam enables efficient sequence retrieval directly from the file. You can specify the chromosome and coordinates to fetch the targeted bases.

What is the best way to calculate sequencing coverage depth from BAM files?

Calculating sequencing coverage depth from BAM files is a core feature of pysam. It facilitates coverage calculation by efficiently parsing alignment data to determine read depth across specific genomic regions.

Does pysam work with FASTQ files for processing raw sequencing reads?

Yes, pysam works with FASTQ files for processing raw sequencing reads. It supports reading and writing FASTQ formats alongside SAM, BAM, CRAM, VCF, BCF, and FASTA files within bioinformatics analysis pipelines.

Do I need htslib installed to perform high-performance genomic data I/O operations?

Yes, you need htslib to perform high-performance genomic data I/O operations with pysam. The skill requires direct interaction with htslib to enable efficient manipulation and analysis of complex genomic file formats.