convert bedgraph to bed
0
0
Entering edit mode
4.7 years ago
praasu ▴ 40

I am looking for program to convert bedgraph file to bed file. Thanks a lot for you any help or suggestion in advance.

Bedgraph example input :

track type=bedGraph name="peaks_id76673" description="peaks in group_4271" db=mm9 color="120,101,172" priority="20" maxHeightPixels="100:50:0" altColor="200,120,59" visibility="full"

    chr1    3016963    3016964    1
    chr1    3016964    3016965    3
    chr1    3204552    3204553    -2
    chr1    3204659    3204660    -1

Output example: bed file with strand and score separated:

    chr1    3016963    3016964  .  +    1
    chr1    3016964    3016965  .  +    3
    chr1    3204552    3204553  .  -    2
    chr1    3204659    3204660  .  -    1
RNA-Seq ChIP-Seq R • 2.9k views
ADD COMMENT
0
Entering edit mode

Something like this should work (not tested)

cat bedgraph.bg | grep -v 'track' | bedtools merge -i - -d 1 > bedgraph.bed
ADD REPLY
0
Entering edit mode

Thank you, It is just giving first 3 column. I want to information from 4th column as well. It contains score and strand. I want to them to be separate.

ADD REPLY
0
Entering edit mode

Your output example was different in the original thread, I though you wanted to merge side-by-side regions. Also, what's the point of making score signs (+/-) as a new column? You are converting a quantitative information into strand information.

cat bedgraph.bg | grep -v 'track' | awk '{print $0 ".\t" $4}'
ADD REPLY
0
Entering edit mode

I thought it was confusing, So I changed it. The input file consists of both strand information (+/-) and score (coverage value). I want to put strand (+/-) into a separate column and score into a separate column.

ADD REPLY

Login before adding your answer.

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