Bedgraph to bed file conversion
1
1
Entering edit mode
10.0 years ago

Hi I am using a GEO dataset with Chip Seq experiments and it has an uploaded bedgraph file and since I need to use bed files for my analysis, is there a way to convert a bedgrpah to bed , also I don't quite understand the difference between both.

bedgraph bed • 6.1k views
ADD COMMENT
4
Entering edit mode
10.0 years ago

Bedgraph is BED-like, but puts the score data into the fourth column and often contains headers.

To convert to BED, strip out the headers with grep and put in a dummy ID value with awk:

$ grep -Ev '^(browser|track|#)' myData.bedgraph \
    | awk ' \
​          BEGIN { OFS = "\t"; } \
          { \
              print $1, $2, $3, "id-"NR, $4; \ 
          } \
    ' - \
    > myData.bed

The five-column BED data now follow the convention of putting the ID into the fourth column, and the score value into the fifth column.

ADD COMMENT

Login before adding your answer.

Traffic: 3209 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