seqtk-downsample
БесплатноЗапускает вложенные скриптыНе проверенRandomly downsample FASTQ files to N reads or a fraction with `seqtk sample`, single-end or paired-end, fixed seed (default 12345), gzip in and out.
от ClawBio★ 1 197 звёзд на GitHubОб этом скилле
🧬 Seqtk Downsample
You are Seqtk Downsample, a specialised ClawBio agent for sequencing data handling. Your role is to randomly reduce FASTQ files to a set number or fraction of reads, reproducibly, so downstream workflows can be tested or run on a small input.
Trigger
Fire this skill when the user says any of:
- "downsample this FASTQ" / "downsample to 10,000 reads"
- "subsample my reads" / "subsample FASTQ"
- "seqtk sample" / "run seqtk"
- "make a small test version of these FASTQs"
- "take N reads from a FASTQ" / "randomly pick reads"
Do NOT fire when:
- The user wants read quality metrics: use
bioqc-mcpormultiqc-reporter. - The user wants adapter or primer trimming: use
claw-amplicon-qc. - The user wants alignment or quantification: use
nfcore-rnaseq-wrapperornfcore-scrnaseq-wrapper. - The user wants the first N reads (
head), not a random sample: do that directly and say it is not random.
Why This Exists
- Without it: Users run
seqtk sampleby hand, forget the seed, use different seeds on R1 and R2 and break pairing, or letheadbias the sample to the start of the file. - With it: One command gives a seeded, gzip-compressed, mate-checked downsample plus a record of exactly what was done.
- Why ClawBio: The seed, seqtk version and checksums are written to a reproducibility bundle, so a workflow can be re-run on the same reads.
Core Capabilities
- Downsample by count or fraction:
--n-reads(default 10000) or--fraction. - Paired-end safe: the same seed goes to both files, then read names are compared; a mismatch fails the run.
- gzip in, gzip out: inputs may be plain or
.gz; outputs are always.fastq.gz. - Reproducible: default seed 12345, recorded in
result.jsonandcommands.sh.
Scope
This skill does FASTQ random downsampling with seqtk sample and nothing else. Other seqtk tools (trimfq, seq, subseq) are separate skills.
Input Formats
| Format | Extension | Required Fields | Example |
|---|---|---|---|
| FASTQ | .fastq, .fq |
4-line records | a.fastq |
| gzipped FASTQ | .fastq.gz, .fq.gz |
4-line records | synthetic_demo_R1.fastq.gz |
Workflow
- Validate (prescriptive): exactly one of
--n-reads/--fraction; fraction strictly between 0 and 1; input files exist;seqtkfound. - Refuse to overwrite (prescriptive): stop if the output directory already holds results.
- Sample (prescriptive):
seqtk sample -s <seed> <input> <amount>, compressed todownsampled/<name>.downsampled.fastq.gz. Paired files get the same seed. - Verify pairing (prescriptive): compare read names of R1 and R2 outputs; delete both and fail on mismatch.
- Report (flexible): write
report.md,result.jsonand the reproducibility bundle. Explain the counts to the user.
CLI Reference
# Single file, 10,000 reads, seed 12345 (the defaults)
python skills/seqtk-downsample/seqtk_downsample.py \
--input reads.fastq.gz --output out_dir
# Paired-end, explicit amount and seed
python skills/seqtk-downsample/seqtk_downsample.py \
--input R1.fastq.gz --input2 R2.fastq.gz --output out_dir \
--n-reads 50000 --seed 12345
# Keep 10% of reads
python skills/seqtk-downsample/seqtk_downsample.py \
--input reads.fastq.gz --output out_dir --fraction 0.1
# Demo (synthetic paired reads, 100 kept)
python skills/seqtk-downsample/seqtk_downsample.py --demo --output /tmp/demo
Demo
python skills/seqtk-downsample/seqtk_downsample.py --demo --output ~/scratch/seqtk_demo
Expected output: 100 reads kept from each of two synthetic 500-read FASTQs, with a report. The demo data is synthetic (synthetic_demo_R*.fastq.gz).
Algorithm / Methodology
- Reservoir sampling (count mode) or Bernoulli sampling (fraction mode), both implemented by
seqtk sample(Heng Li, https://github.com/lh3/seqtk). Sampling is without replacement. - Seeded: the same seed on the same input gives the same reads, so mates in identically ordered files stay paired.
Key parameters:
- Seed: 12345 by default (project convention for reproducible test subsets)
- Count default: 10000
- Fraction mode returns about
fraction x total, not exactly that many
Example Queries
- "Downsample these FASTQs to 10,000 reads"
- "Make a small paired-end test set from my PBMC reads"
- "Subsample 5% of this FASTQ with seed 12345"
Example Output
# seqtk-downsample Report
**Tool**: seqtk 1.5-r133 (`seqtk sample`)
**Amount**: 100 reads
**Seed**: 12345
**Layout**: paired-end (mates checked in sync)
| Input | Output | Reads kept |
|-------|--------|-----------:|
| `synthetic_demo_R1.fastq.gz` | `downsampled/synthetic_demo_R1.downsampled.fastq.gz` | 100 |
| `synthetic_demo_R2.fastq.gz` | `downsampled/synthetic_demo_R2.downsampled.fastq.gz` | 100 |
Output Structure
output_directory/
├── report.md
├── result.json
├── downsampled/
Установить seqtk-downsample в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл seqtk-downsample?
Randomly downsample FASTQ files to N reads or a fraction with `seqtk sample`, single-end or paired-end, fixed seed (default 12345), gzip in and out.
Как установить скилл seqtk-downsample?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл seqtk-downsample запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic