vimalinx/bio-agent / .claude/skills/bam-to-fastq
bam-to-fastq
VerifiedUse when converting BAM alignment files to FASTQ format, including paired-end data requiring separate or interleaved output.
bam-to-fastq
Quick Start
- Command:
bamToFastq -i input.bam -fq reads.fq [options] - Local executable:
/home/vimalinx/miniforge3/envs/bio/bin/bamToFastq - Full reference: See
references/help.md
When To Use This Tool
- Recover FASTQ from BAM alignments for remapping, QC, or archival export.
- Split paired-end BAM into
R1andR2FASTQ files with-fqand-fq2. - Emit a single interleaved FASTQ stream by directing both mates to stdout.
- Reconstruct reads from mate tags with
-tagswhen the BAM carriesR2/Q2tags.
Common Patterns
# 1) Single-end BAM to FASTQ
bamToFastq \
-i reads.bam \
-fq reads.fq
# 2) Paired-end BAM to two FASTQ files
bamToFastq \
-i reads.qname.bam \
-fq reads_R1.fq \
-fq2 reads_R2.fq
# 3) Interleaved paired-end FASTQ
bamToFastq \
-i reads.qname.bam \
-fq /dev/stdout \
-fq2 /dev/stdout > reads.interleaved.fq
Recommended Workflow
- Decide whether the BAM is single-end, paired-end, or tag-based (
-tags) before selecting output mode. - For paired-end export, query-name sort or collate the BAM first so mates stay synchronized.
- Write to fresh FASTQ files and validate mate counts if the output will feed a new aligner.
- If you need more filtering and flag control, compare against
samtools fastqbefore standardizing the pipeline.
Guardrails
-iand-fqare required.- Paired-end export with
-fq2assumes the BAM is grouped or sorted by query name. -tagsis specialized behavior for BAMs that carry mate sequence / quality inR2andQ2; it is not a generic paired-end fix.- The interleaved
/dev/stdoutpattern is convenient but easy to misuse in shells and pipelines, so redirect carefully. - Prefer
-hfor help; the wrapper does not support clean GNU-style--help/--version.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |