bam-toolkit

Analyze BAM/SAM/CRAM files for reads, indels, and coverage with JSON output.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/dakesan/cc-dnawork-plugin --skill bam-toolkit
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: bam-toolkit
Source: https://github.com/dakesan/cc-dnawork-plugin/tree/main/scientific-skills/bam-toolkit
Command: npx skills add https://github.com/dakesan/cc-dnawork-plugin --skill bam-toolkit

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill helps you analyze BAM/SAM/CRAM alignment files from WGS/WES, including region-based read extraction, indel detection, and coverage statistics, with structured JSON outputs for downstream analysis.

Core Features & Use Cases

  • Read Extraction: Pull reads from specific genomic regions.
  • Indel Detection: Identify insertions and deletions from reads.
  • Coverage Calculation: Compute coverage statistics for regions.
  • JSON Export: Output results in JSON for easy integration.

Quick Start

Extract reads in chr1:1000-2000 as JSON, or compute coverage for the same region.

Frequently Asked Questions about bam-toolkit

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

FAQPage Schema
How do I extract reads from specific genomic regions in BAM files?

Extract reads from BAM files by specifying a genomic region (e.g., chr1:1000-2000) and applying CLI filters like min_mapq and min_baseq. The Skill outputs matched reads in JSON or BAM format for downstream analysis.

Can I detect insertions and deletions directly from alignment files?

Indel detection identifies insertions and deletions from reads in BAM/SAM/CRAM files. The Skill parses alignment records and outputs structured JSON containing indel positions, lengths, and read context for variant workflows.

What's the best way to compute coverage statistics for WGS/WES regions?

Compute per-region coverage statistics by submitting BAM alignment files and target regions. The Skill calculates coverage metrics and exports results as JSON, enabling integration into region-based analysis pipelines.

Does this work with SAM and CRAM formats, or only BAM?

Coverage analysis, read extraction, and indel detection work across BAM, SAM, and CRAM formats. The Skill uses pysam to handle all three alignment formats transparently with consistent JSON output.

Can I filter reads by mapping quality and base quality when extracting?

Filter reads during extraction using min_mapq and min_baseq parameters, plus options for proper-pairs and duplicate removal. These CLI filters refine results before JSON/BAM export for high-confidence downstream use.

What are the limitations when applying region-based processing to large WGS datasets?

Region-based processing scales to large WGS datasets by processing defined intervals independently. Performance depends on region size and BAM indexing; very large regions or unindexed files may require longer computation.