Question: Bedgraph to bed file conversion
0
Entering edit mode

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 quiet understand the difference between both.

ADD COMMENTlinkeditmoderate 5.7 years ago Aishwarya.Kulkarni • 20 • updated 5.7 years ago Alex Reynolds 28k
3
Entering edit mode

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 COMMENTlinkeditmoderate 5.7 years ago Alex Reynolds 28k

Login before adding your answer.

Powered by the version 2.0