Hi - Can any one please suggest a method to convert Bowtie output to BED format? Is there a bioperl script or any software for that?
thanks in advance.
thanks in advance.
You are currently viewing the SEQanswers forums as a guest, which limits your access. Click here to register now, and join the discussion
#!/usr/bin/perl use strict; use warnings; # get file names from the command line my ($input, $output) = @ARGV; # exceptions and usage if (!defined $input or !defined $output) { die "Usage: bedFromBowtie.pl <input> <output>\n"; } # open the input/output file open my $out, ">", "$output" or die "Cannot open $output: $!\n"; open my $in, "<", "$input" or die "Cannot open $input: $!\n"; while ( <$in> ) { chomp; my (undef, $strand, $chr, $start, $sequence) = split "\t"; # assumes standard bowtie output my @sequence = split '', $sequence; # extra work, but allows for variable-length sequences my $length = @sequence; my $end; if ($strand eq '+') { $end = $start + $length - 1; } elsif ($strand eq '-') { $end = $start; $start = $end - $length + 1; } else { die "We have a formatting problem: strand is set to $strand\n"; } print $out "$chr\t$start\t$end\tU0\t0\t$strand\n"; } print "Done!\n"; close $in; close $out; exit;
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by seqadmin, Today, 06:55 AM
|
0 responses
8 views
0 likes
|
Last Post
by seqadmin
Today, 06:55 AM
|
||
Started by seqadmin, 10-02-2024, 04:51 AM
|
0 responses
105 views
0 likes
|
Last Post
by seqadmin
10-02-2024, 04:51 AM
|
||
Started by seqadmin, 10-01-2024, 07:10 AM
|
0 responses
113 views
0 likes
|
Last Post
by seqadmin
10-01-2024, 07:10 AM
|
||
Started by seqadmin, 09-30-2024, 08:33 AM
|
1 response
117 views
0 likes
|
Last Post
by EmiTom
10-07-2024, 06:46 AM
|
Comment