fasta-from-bed
Quick Start
- Command:
fastaFromBed -fi reference.fa -bed intervals.bed [options] - Local executable:
/home/vimalinx/miniforge3/envs/bio/bin/fastaFromBed - Alias form:
bedtools getfasta - Full reference: See
references/help.md
When To Use This Tool
- Extract sequence from a reference FASTA using interval coordinates.
- Retrieve exon, peak, promoter, or variant-adjacent sequences.
- Reverse-complement antisense features with
-s. - Concatenate BED12 blocks with
-split. - Emit FASTA, tabular, or BED-like sequence output depending on downstream needs.
Common Patterns
# 1) Basic sequence extraction to FASTA
fastaFromBed \
-fi reference.fa \
-bed peaks.bed \
-fo peaks.fa
# 2) Strand-aware transcript sequence extraction
fastaFromBed \
-fi reference.fa \
-bed transcripts.bed \
-s \
-fo transcripts.fa
# 3) Extract concatenated BED12 block sequence in tabular form
fastaFromBed \
-fi reference.fa \
-bed transcripts.bed12 \
-split \
-tab > transcripts.tsv
Recommended Workflow
- Make sure FASTA headers and interval chromosome names refer to the same assembly.
- Choose the output mode deliberately: FASTA (
default),-tab, or-bedOut. - Add
-sfor strand-aware extraction and-rnaif the reference sequence alphabet is RNA. - Use
-splitonly when BED12 block concatenation is the intended biology.
Guardrails
-fiand-bedare required.- Without
-fo, output goes to stdout. -name+is deprecated; prefer-nameor-nameOnly.-splitis for BED12 block extraction and changes the extracted sequence substantially.- By default, strand is ignored; antisense features are only reverse-complemented when
-sis set.