Skip to main content
Source Link
SmallChess
  • 2.7k
  • 4
  • 20
  • 35

How to convert FASTA to BED

I have a FASTA file:

> Sequence_1
GCAATGCAAGGAAGTGATGGCGGAAATAGCGTTAGATGTATGTGTAGCGGTCCC...
> Sequence_2
GCAATGCAAGGAAGTGATGGCGGAAATAGCGTTAGATGTATGTGTAGCGGTCCC....
....

I want to generate a BED file for each sequence like:

Sequence_1 0 1500
Sequence_2 0 1700

The BED regions will simply be the size of the sequences.

Q: I did that before with a one-line command. I don't remember what that is, it was on Biostars. I can't find the post now. What's the simplest way to do the conversion?