bed-to-bam
Quick Start
- Command:
bedToBam -i intervals.bed -g genome.txt [options] > output.bam - Local executable:
/home/vimalinx/miniforge3/envs/bio/bin/bedToBam - Full reference: See
references/help.md
When To Use This Tool
- Convert interval-like features into BAM for browser display or BAM-based tooling.
- Emit BAM records with a chosen mapping quality.
- Preserve BED12 block structure as BAM CIGAR operations.
- Produce compressed or uncompressed BAM output for downstream integration.
Common Patterns
# 1) Convert BED to BAM
bedToBam \
-i peaks.bed \
-g genome.txt > peaks.bam
# 2) Set a custom mapping quality
bedToBam \
-i peaks.bed \
-g genome.txt \
-mapq 60 > peaks.mapq60.bam
# 3) Preserve BED12 blocks in CIGAR strings
bedToBam \
-i transcripts.bed12 \
-g genome.txt \
-bed12 > transcripts.bam
Recommended Workflow
- Build a correct genome file matching the interval coordinate system.
- Confirm BED inputs are at least BED4 if you expect robust BAM conversion.
- Add
-bed12only for true BED12 input where block-aware CIGAR is desired. - Validate the BAM with
samtools viewor a genome browser before relying on it downstream.
Guardrails
-iand-gare required.- BED input should be BED4 or higher because the BAM record needs a name field.
-bed12assumes BED12 semantics; using it on non-BED12 input gives misleading BAM structure.- Default mapping quality is
255, which is a placeholder-like value rather than an empirical alignment score. - Prefer
-hfor help; GNU-style--help/--versioncalls on these wrappers are noisy.