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, 12-17-2024, 10:28 AM
|
0 responses
27 views
0 likes
|
Last Post
by seqadmin
12-17-2024, 10:28 AM
|
||
Started by seqadmin, 12-13-2024, 08:24 AM
|
0 responses
43 views
0 likes
|
Last Post
by seqadmin
12-13-2024, 08:24 AM
|
||
Started by seqadmin, 12-12-2024, 07:41 AM
|
0 responses
29 views
0 likes
|
Last Post
by seqadmin
12-12-2024, 07:41 AM
|
||
Started by seqadmin, 12-11-2024, 07:45 AM
|
0 responses
42 views
0 likes
|
Last Post
by seqadmin
12-11-2024, 07:45 AM
|
Comment