Agent skill

bio-alignment-indexing

Create and use BAI/CSI indices for BAM/CRAM files using samtools and pysam. Use when enabling random access to alignment files or fetching specific genomic regions.

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

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

Facts
Files in the skill folder: 3
SKILL.md size: 9 KB
Bundled scripts: yes
Path: skills/bioskills/alignment-indexing/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. # Alignment Indexing Create indices for random access to alignment files using samtools and pysam. **"Index a BAM file"** → Create a .bai/.csi index enabling random access to genomic regions. - CLI: `samtools index file.bam` - Python: `pysam.index('file.bam')` ## Index Types | Index | Extension | Max contig | Bin shift | When required | |-------|-----------|-----------|-----------|---------------| | BAI | `.bai` / `.bam.bai` | 2^29-1 = ~536 Mbp | fixed (16 kb) | Default for human, mouse, fly, fish | | CSI | `.csi` / `.bam.csi` | 2^(min_shift + depth*3) | configurable via `-m` | **Required** for any contig >536 Mbp | | CRAI | `.crai` / `.cram.crai` | chunk-based | n/a | CRAM only | | TBI | `.tbi` | 2^29-1 | fixed | tabix V

What's inside
Steps it walks through
  1. Version Compatibility
  2. Index Types
  3. Which Index for Which Genome
  4. samtools index
  5. Create BAI Index
  6. Create CSI Index
  7. Specify Output Name
  8. Multi-threaded Indexing
  9. Index CRAM
  10. Index Requirements
  11. Using Indices for Region Access
  12. samtools view with Region
  13. Multiple Regions
  14. Regions from BED File
Ships with 2 files
  • examples/fetch_regions.py
  • usage-guide.md
Commands it runs
Default CSI matches BAI bin layout: 2^(14 + 5*3) = 2^29 ≈ 512 Mbp per contig
samtools index -c file.bam
Larger min_shift for contigs >512 Mbp (wheat, axolotl, sugar pine)
samtools index -c -m 18 file.bam   # 2^(18+15) = 2^33 = ~8.5 Gbp per contig
samtools index input.bam
Creates input.bam.bai
samtools index -c input.bam
Creates input.bam.csi
samtools index input.bam output.bai
samtools index -@ 4 input.bam
More from awesome-bio-agent-skills
All skills →
About this skill
What does the bio-alignment-indexing skill do?

Create and use BAI/CSI indices for BAM/CRAM files using samtools and pysam. Use when enabling random access to alignment files or fetching specific genomic regions.

How do I install it?

Run `npx skills add BioTender-max/awesome-bio-agent-skills --skill alignment-indexing --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