---
author: einar
categories:
- Linux
- Science
comments: true
date: "2007-03-13T20:00:17Z"
header:
  image_fullwidth: banner_other.jpg
slug: a-bed-file-builder
title: A BED file builder
omit_header_text: true
disable_share: true
wordpress_id: 196
---

As I anticipated, I can finally release this small script. Its purpose is to build [BED files](http://http//genome.ucsc.edu/goldenPath/help/customTrack.html#BED) out of tab-delimited text files. I made this because I had several files to make and moving columns left and right (not to mention writing a heading line for the [Genome Browser](http://genome.ucsc.edu)) was becoming annoying. Its use is fairly straightforward, as the help itself says:

<!--more-->

`usage: make_bed_file.py [options] [destination]`

`options:
-h, --help            show this help message and exit
-i FILE, --input=FILE
Use ranges from FILE
-n NAME, --name=NAME  Use NAME as BED track name
-t TYPE, --tracks=TYPE
Format other annotation tracks according to TYPE
(default: pack)
-v TYPE, --visibility=TYPE
Set visibility of the BED track to TYPE
(default: full)
-d DISPLAY, --display=DISPLAY
Select specific annotation tracks
(comma-delimited list; default: all)`

The input file format is rather simple as well:

Chromosome | Identifier | Start Position | End position | Score

The score column is optional. The file must be tab-delimited. If you want to change the format of the file, have a look at the ncbi class inside the source. The result is a BED file with chromosome, position, name and score.

[Get the script]({{ site.url }}/files/make_bed_file.py) and make it executable. If you have any problems, please report.
