Question: Bedgraph to bed file conversion
0
gravatar for Aishwarya.Kulkarni
4.0 years ago by
United States
Aishwarya.Kulkarni20 wrote:

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.

bed bedgraph • 3.0k views
ADD COMMENTlink modified 4.0 years ago by Alex Reynolds24k • written 4.0 years ago by Aishwarya.Kulkarni20
3
gravatar for Alex Reynolds
4.0 years ago by
Alex Reynolds24k
Seattle, WA USA
Alex Reynolds24k wrote:

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 COMMENTlink modified 4.0 years ago • written 4.0 years ago by Alex Reynolds24k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 933 users visited in the last hour