bio-sam-bam-basics
Installation
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>thenhelp(module.function)to check signatures - CLI:
<tool> --versionthen<tool> --helpto 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.