sciagent-skill-creator
Scaffold a new SciAgent-Skills entry. Picks pipeline/toolkit/database/guide template, creates skills/{category}/{name}/SKILL.md…
CLI toolkit for SAM/BAM/CRAM: sort, index, convert, filter, QC alignments. Core commands: view, sort, index, flagstat, stats, depth, markdup, merge. Required between alignment and variant/peak calling. Use pysam for Python-native BAM access; deeptools for normalized coverage
Claude Code
$ npx -y skills add jaechang-hits/SciAgent-Skills --skill samtools-bam-processing --agent claude-code
Codex
$ npx skills add jaechang-hits/SciAgent-Skills --skill samtools-bam-processing -a codex -y
Cursor
$ npx skills add jaechang-hits/SciAgent-Skills --skill samtools-bam-processing -a cursor -y
Gemini CLI
$ npx skills add jaechang-hits/SciAgent-Skills --skill samtools-bam-processing -a gemini-cli -y
GitHub Copilot
$ npx skills add jaechang-hits/SciAgent-Skills --skill samtools-bam-processing -a github-copilot -y
OpenCode
$ npx skills add jaechang-hits/SciAgent-Skills --skill samtools-bam-processing -a opencode -y
Windsurf
$ npx skills add jaechang-hits/SciAgent-Skills --skill samtools-bam-processing -a windsurf -y
name: "samtools-bam-processing" description: "CLI toolkit for SAM/BAM/CRAM: sort, index, convert, filter, QC alignments. Core commands: view, sort, index, flagstat, stats, depth, markdup, merge. Required between alignment and variant/peak calling. Use pysam for Python-native BAM access; deeptools for normalized coverage tracks." license: "MIT"
samtools is the standard command-line toolkit for processing sequence alignment files in SAM, BAM, and CRAM formats. It handles the complete alignment file lifecycle: format conversion, coordinate sorting, index creation, quality control statistics, read filtering, duplicate marking, and multi-file merging. samtools is a near-universal component of NGS pipelines between alignment (STAR, BWA) and downstream analysis (variant calling, peak calling, coverage).
> **Check before installing**: The tool may already be available in the current environment (e.g., inside a `pixi` / `conda` env). Run `command -v samtools` first and skip the install commands below if it returns a path. When running inside a pixi project, invoke the tool via `pixi run samtools` rather than bare `samtools`.
# Bioconda (recommended) conda install -c bioconda samtools # Homebrew (macOS) brew install samtools # Verify samtools --version | head -1
Settle these with the user before writing any analysis code.
decisions:
- id: D1
param: mappingQualityFloor
kind: required
source: user
ask: "Below what mapping confidence should reads be dropped? Everything counted downstream inherits this cut."
default: "0 - keep every alignment, including ambiguously placed ones"
- id: D2
param: flagFilter
kind: required
source: user
ask: "Which read classes should be excluded - unmapped, secondary, supplementary, failed-QC, duplicates?"
default: "keep all classes"
- id: D3
param: duplicateHandling
kind: required
source: user
ask: "Should duplicates be marked and left in place, or physically removed from the file?"
default: "marked, not removed - downstream tools can then choose"
- id: D4
param: sortOrder
kind: derived
source: upstream
ask: "Does the next step need coordinate order, or name order for mate pairing?"
default: "coordinate"
- id: D5
param: outputFormat
kind: optional
source: user
ask: "Write BAM, or CRAM against a reference to save space?"
default: "BAM"
- id: D6
param: opticalDuplicateDistance
kind: optional_conditional
source: data
ask: "Should optical duplicates be distinguished from PCR duplicates, using this platform's pixel distance?"
default: "not distinguished"
- id: D7
param: threadsAndMemory
kind: never_ask
source: data
reason: "Compression threads and per-thread sort memory affect runtime and peak RAM, not the records"
default: "available cores, 768M per thread"D1 and D2 look like plumbing and are not. A MAPQ floor silently removes multi-mapping regions - paralogs, recent duplications, repeat-adjacent genes - from everything computed afterwards, and a run that keeps secondary alignments counts the same fragment several times. Neither is visible in the output file.
# Typical post-alignment workflow: sort → index → QC samtools sort -@ 8 -o sorted.bam input.bam samtools index sorted.bam samtools flagstat sorted.bam
Convert between SAM/BAM/CRAM formats and extract subsets.
# SAM → BAM (saves ~75% disk space) samtools view -b -h input.sam -o output.bam # BAM → CRAM (saves additional 40-50%) samtools view -C -T reference.fa input.bam -o output.cram # Filter: mapping quality ≥20, exclude unmapped (-F 4) samtools view -q 20 -F 4 input.bam -o filtered.bam # Extract specific region (requires index) samtools view -h sorted.bam "chr1:1000000-2000000" -o region.bam # Count reads matching filter samtools view -c -F 4 input.bam # Output: 45231923 (number of mapped reads)
# Extract reads as FASTQ (for realignment or de novo assembly) samtools fastq -@ 4 -1 R1.fastq.gz -2 R2.fastq.gz -0 unpaired.fastq.gz input.bam # Extract reads as FASTA samtools fasta input.bam > reads.fasta # Filter by read group samtools view -r SAMPLE_001 multi_rg.bam -o sample001.bam
Organize BAM files for efficient random access.
# Sort by coordinate (required before indexing) samtools sort -@ 8 -m 2G input.bam -o sorted.bam # Sort by read name (required for fixmate/markdup) samtools sort -n -@ 8 input.bam -o namesorted.bam # Index sorted BAM (creates sorted.bam.bai) samtools index sorted.bam # For chromosomes > 512 Mbp: use CSI index instead samtools index -c sorted.bam # Group reads by name (fast, for fixmate — no full sort needed) samtools col
Turn your AI coding agent into a life sciences expert — 199 bioinformatics skills for Claude Code covering RNA-seq, single-cell analysis, genomics, proteomics, drug discovery, and more. Boosted BixBench from 65% to 92%. Open source.
Scaffold a new SciAgent-Skills entry. Picks pipeline/toolkit/database/guide template, creates skills/{category}/{name}/SKILL.md…
Bayesian modeling with PyMC 5: priors, likelihood, NUTS/ADVI sampling, diagnostics (R-hat, ESS), LOO/WAIC comparison, prediction.…
Time-to-event modeling with scikit-survival: Cox PH (elastic net), Random Survival Forests, Boosting, SVMs for censored data.…
Guided statistical analysis: test choice, assumption checks, effect sizes, power, APA reporting. Pick tests, verify assumptions,…
Python statistical modeling: regression (OLS, WLS, GLM), discrete (Logit, Poisson, NegBin), time series (ARIMA, SARIMAX, VAR),…
DL cell/nucleus segmentation for fluorescence and brightfield microscopy. Pre-trained models (cyto3, nuclei, tissuenet) and a…
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…
Ask which skill or flow fits your situation. A router over the skills in this repo.