Pysam sam bam summary starter
Skill ma-compbio-lab/SkillFoundry/skills/genomics/pysam-sam-bam-summary-starter
A framework for discovering, compiling, and validating reusable skills for scientific agents.From the repository description
npx -y skills add ma-compbio-lab/SkillFoundry --skill pysam-sam-bam-summary-starterAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
SKILL.md
1.2 KB, 309 tokens by cl100k_base, as published. Nobody here has run it
pysam SAM BAM Summary Starter
Use this skill to read a small SAM, BAM, or CRAM file with pysam, summarize core alignment statistics, and optionally emit an indexed BAM artifact for downstream debugging or demos.
What it does
- Opens a local alignment file with
pysam.AlignmentFile. - Reports header references, mapped and unmapped counts, pairing flags, and per-reference mapped counts.
- Optionally writes a BAM copy and builds a
.baiindex.
When to use it
- You need a deterministic starter for
SAM/BAM/CRAMhandling in Python. - You want a tiny verified example of format conversion plus indexing.
- You need a compact JSON summary before building larger alignment-processing skills.
Example
slurm/envs/genomics/bin/python skills/genomics/pysam-sam-bam-summary-starter/scripts/run_pysam_sam_bam_summary.py \
--input skills/genomics/pysam-sam-bam-summary-starter/examples/toy_reads.sam \
--out scratch/genomics/pysam_summary.json \
--bam-out scratch/genomics/toy_reads.bam
Verification
- Skill-local tests:
python3 -m unittest discover -s skills/genomics/pysam-sam-bam-summary-starter/tests -p 'test_*.py' - Expected summary:
record_count == 4,mapped_count == 3, andreference_mapped_counts.chr1 == 2
What ships with it: 7 files
8.6 KB alongside SKILL.md, 2 of them executable
assets/
- README.md150 B
examples/
- README.md255 B
- toy_reads.sam248 B
scripts/
- run_pysam_sam_bam_summary.pyruns4.1 KB
tests/
- test_run_pysam_sam_bam_summary.pyruns2.3 KB
- metadata.yaml1.2 KB
- refs.md362 B