Regular Expression To Match Bed Format
0
0
Entering edit mode
13.2 years ago
Boboppie ▴ 550

I see a TAB delimited parser, but I have to be restrict on the first three columns (chr, start, end), and since the rest of the columns are optional, they might not be available in the data at all.

I came up with: [^\t]+\t\d+\t\d+\t?.|[^\t]+\t\d+\t\d+$

However I'm not really convinced by myself.

Any better suggestions?

bed • 2.4k views
ADD COMMENT
2
Entering edit mode

I think your regex is OK. You could insert a '^' as the first character to match the beginning of the line.

ADD REPLY
2
Entering edit mode

If it's perl you might just use something like ($chr, $start, $end) = split /t/;

ADD REPLY
0
Entering edit mode

@Pierre, good point, cheers.

ADD REPLY

Login before adding your answer.

Traffic: 1796 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6