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.
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.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
## 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
- Version Compatibility
- Index Types
- Which Index for Which Genome
- samtools index
- Create BAI Index
- Create CSI Index
- Specify Output Name
- Multi-threaded Indexing
- Index CRAM
- Index Requirements
- Using Indices for Region Access
- samtools view with Region
- Multiple Regions
- Regions from BED File
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
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.
