Question: How Do I Convert An Illumina Export File To Bed?
gravatar for Andrew
10.7 years ago by
Andrew10 wrote:

I have some illumina data generated from the latest version of the illumina pipeline (1.6.0) I need to convert my data into BED to view in ucsc genome browser.

This seems like it should be a fairly common task, however, I am unable to find any scripts to convert my data.

bed conversion format • 1.1k views
ADD COMMENTlink modified 10.7 years ago by User 82260 • written 10.7 years ago by Andrew10
gravatar for Question Bot
10.7 years ago by
Question Bot90
Question Bot90 wrote:

I found a script on another site, Uses perl but I have not checked for correctness:


use strict;
use warnings;
use IO::File;

my $filename = shift @ARGV;
die "Usage\n\tperl s_X_sorted.txt > s_X_sorted.bed\n" unless $filename;
chomp $filename;

my $fh = new IO::File;
$fh->open("< $filename") or die "Can't open file $filename for reading: $!";

my $count = 1;
while(my $line = <$fh>){
   warn "Line $count\n" if $count%1000 == 0;
   my @line = split "\t", $line;
   my $chr = $line[10];
   $chr =~ s/(.+)\.fa/$1/;
   #Illumina is 1-based, BED is 0-based
   my $start = $line[12]-1;
   my $read = $line[8];
   my $end = $start + length $read;
   my $strand = $line[13] eq 'F' ? '+': '-';
   my $score = $line[15];
   my $bedline = "$chr\t$start\t$end\t$read\t$score\t$strand\n";
   print $bedline;

warn "Done";
ADD COMMENTlink written 10.7 years ago by Question Bot90
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 1 users visited in the last hour