Agent skill

bio-sam-bam-basics

View, convert, and understand SAM/BAM/CRAM alignment files using samtools and pysam. Use when inspecting alignments, converting between formats, or understanding alignment file structure.

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

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

Facts
Files in the skill folder: 4
SKILL.md size: 14 KB
Bundled scripts: yes
Path: skills/bioskills/sam-bam-basics/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. # SAM/BAM/CRAM Basics **"Read a BAM file"** → Open a binary alignment file and iterate over aligned reads with their mapping coordinates, flags, and quality scores. - Python: `pysam.AlignmentFile()` (pysam) - CLI: `samtools view` (samtools) - R: `scanBam()` (Rsamtools) View and convert alignment files using samtools and pysam. ## Format Overview | Format | Description | Use Case | |--------|-------------|----------| | SAM | Text format, human-readable | Debugging, small files | | BAM | Binary compressed SAM | Standard storage format | | CRAM | Reference-based compression | Long-term archival, smaller than BAM | ## SAM Format Structure ``` @HD VN:1.6 SO:coordinate @SQ SN:chr1 LN:248956422 @RG ID:sample1 SM:sample1 @PG ID:b

What's inside
Steps it walks through
  1. Version Compatibility
  2. Format Overview
  3. SAM Format Structure
  4. samtools view
  5. View BAM as SAM
  6. View with Header
  7. View Header Only
  8. View Specific Region
  9. Count Alignments
  10. Format Conversion
  11. BAM to SAM
  12. SAM to BAM
  13. BAM to CRAM
  14. CRAM to BAM
Ships with 3 files
  • examples/convert_formats.sh
  • examples/view_bam.py
  • usage-guide.md
Commands it runs
samtools view input.bam | head
samtools view -h input.bam | head -100
samtools view -H input.bam
samtools view input.bam chr1:1000-2000
samtools view -c input.bam
samtools view -h -o output.sam input.bam
samtools view -b -o output.bam input.sam
samtools view -C -T reference.fa -o output.cram input.bam
samtools view -b -T reference.fa -o output.bam input.cram
samtools view -b input.sam > output.bam
More from awesome-bio-agent-skills
All skills →
About this skill
What does the bio-sam-bam-basics skill do?

View, convert, and understand SAM/BAM/CRAM alignment files using samtools and pysam. Use when inspecting alignments, converting between formats, or understanding alignment file structure.

How do I install it?

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