Agent skill · Testing & QA

bio-bam-statistics

Generate alignment statistics using samtools flagstat, stats, depth, coverage, and mosdepth. Use when assessing alignment quality, calculating coverage, or generating QC reports.

BioTender-maxgithub.com/BioTender-maxGitHub ↗
claude-codeships scriptsNOASSERTION
Install
npx skills add BioTender-max/awesome-bio-agent-skills --skill bam-statistics --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 3
SKILL.md size: 15 KB
Bundled scripts: yes
Path: skills/bioskills/bam-statistics/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 135
Language: Python

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

## Version Compatibility Reference examples tested with: pysam 0.22+, samtools 1.19+ Before using code patterns, verify installed versions match. If versions differ: - Python: `pip show <package>` then `help(module.function)` to check signatures - CLI: `<tool> --version` then `<tool> --help` to confirm flags If code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying. # BAM Statistics **"Get alignment statistics and coverage from my BAM file"** → Generate read counts, mapping rates, per-chromosome statistics, depth profiles, and coverage summaries. - CLI: `samtools flagstat`, `samtools stats`, `samtools depth`, `samtools coverage` (samtools) - Python: `pysam.AlignmentFile` with `pileup()` and `get_index_statistics()` (pysam) Generate alignment statistics using samtools and pysam. ## Quick Summary Commands | Question | Best tool | Why | |----------|-----------|-----| | Quick read counts by FLAG category | `samtools flagstat` | Fast; counts secondary+supp in totals | | Per-chromosome counts | `samtools idxstats` | Fast (needs index); **counts secondary+supp** | | Insert size, MAPQ, error

What's inside
Steps it walks through
  1. Version Compatibility
  2. Quick Summary Commands
  3. What Each Tool Counts (and Doesn't)
  4. samtools flagstat
  5. Multi-threaded
  6. Output to File
  7. samtools idxstats
  8. Parse idxstats
  9. samtools stats
  10. View Summary Numbers
  11. Generate Plots (with plot-bamstats)
  12. Stats for Specific Region
  13. samtools depth
  14. Basic Depth
Ships with 2 files
  • examples/qc_report.py
  • usage-guide.md
Commands it runs
samtools flagstat input.bam
samtools flagstat -@ 4 input.bam
samtools flagstat input.bam > flagstat.txt
samtools idxstats input.bam
Total mapped reads
samtools idxstats input.bam | awk '{sum += $3} END {print sum}'
Mitochondrial percentage
samtools idxstats input.bam | awk '
END {print mt/total*100 "% mitochondrial"}'
samtools stats input.bam > stats.txt
More from awesome-bio-agent-skills
All skills →
About this skill
What does the bio-bam-statistics skill do?

Generate alignment statistics using samtools flagstat, stats, depth, coverage, and mosdepth. Use when assessing alignment quality, calculating coverage, or generating QC reports.

How do I install it?

Run `npx skills add BioTender-max/awesome-bio-agent-skills --skill bam-statistics --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From BioTender-max/awesome-bio-agent-skills, a repository with 135 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going