# The MEME Suite

## Motif-based sequence analysis tools

# BED2FASTA

### Extract regions specified in a BED file from a genome

### Usage:

`bed2fasta [options] <BED file> <genome file>`

### Description

### Input

<BED file>

The name of a file containing genomic sequence regions BED format.

<genome file>

The name of a file containing the genomic sequences for the genome corresponding to the BED file in FASTA format.
Note: This program assumes the existence of a file named '`<genome file>.fai`' created by the program fasta-file-indexer. This file is always present for genome files installed using update-sequence-db.

### Output

BED2FASTA writes a sequence region in FASTA format for each (legal) BED record in the input BED file. By default, BED2FASTA writes the sequence regions to standard output. You can cause BED2FASTA to write its output to a file instead by using the -o option (below).

### Options

Option | Parameter | Description | Default Behavior
--- | --- | --- | ---
-o | file name | Output the sequence regions to the named file. | BED2FASTA outputs the sequence regions to standard output.
-s |  | Output the reverse complement of the sequence region if the strand given in its BED record is '-' (BED field 6). | Output the sequence region without reverse complementing.
-name |  | Use just the name field from the BED record (BED field 4) as the sequence identifier in the FASTA sequence identifier for the genomic region. | Use the chromosome coordinates (<chr>:<start>-<end>) as the sequence identifier in the FASTA header.
-both |  | Include the name field from the BED record (BED field 4) as a comment after the chromosome coordinates in the FASTA sequence identifier for the genomic region. | Use the chromosome coordinates (<chr>:<start>-<end>) as the sequence identifier in the FASTA header.

### Citing