Bedgraph to bed file conversion
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.
• 6,923 views
•
link
1 answer
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.
• 0 views
•
link
Log in to answer this question.