Question: convert bedgraph to bed
0
gravatar for praasu
7 months ago by
praasu30
Prague, Czech republic
praasu30 wrote:

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 • 385 views
ADD COMMENTlink modified 7 months ago • written 7 months ago by praasu30

Something like this should work (not tested)

cat bedgraph.bg | grep -v 'track' | bedtools merge -i - -d 1 > bedgraph.bed
ADD REPLYlink written 7 months ago by venu6.7k

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 REPLYlink modified 7 months ago • written 7 months ago by praasu30

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 REPLYlink modified 7 months ago • written 7 months ago by venu6.7k

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 REPLYlink written 7 months ago by praasu30
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: 2268 users visited in the last hour