Converting narrowPeak to bed
2
2
Entering edit mode
7.2 years ago
Spacebio ▴ 200

Hi all,

I am trying to convert a regular narrowPeak file into a BED file for use with diffBind... any ideas?

Thanks.

narrowPeak BED • 13k views
ADD COMMENT
0
Entering edit mode

I know this is an old ticket however I am not able to create a DBA object with a narrowPeak file as it complains about the first line in the narrow peak file not having 10 columns which is true because it has a header like this:

track type=narrowPeak visibility=3 db=hg19 name="nPk" description="ENCODE narrowPeak Example"
browser position chr1:9356000-9365000
chr1    9356548 9356648 .       0       .       182     5.0945  -1  50
chr1    9358722 9358822 .       0       .       91      4.6052  -1  40
chr1    9361082 9361182 .       0       .       182     9.2103  -1  75

Only after removing the header, I was able to load it. Is this okay or something is off about my peak calling? Here's the code snippet

allsamples <- read.csv('meta/allsamples.csv')
gpparestTestbeta <- dba(sampleSheet=allsamples)
ADD REPLY
0
Entering edit mode

Please do not add an answer unless you're answering the top level question. You have a related question, which is best posted as either a comment on the top level question or as a new question referencing the existing question.

Also, please use the formatting bar (especially the code option) to present your post better. You can use backticks for inline code (`text` becomes text), or select a chunk of text and use the highlighted button to format it as a code block. I've done it for you this time.
code_formatting

ADD REPLY
5
Entering edit mode
7.2 years ago
h.mon 35k

Do you really need to convert? narrowPeak already is in bed 6+4 format, see here, here and here.

edit: in case DiffBind if very strict, use this solution:

cut -f 1-6 macs_output.narrowPeak > macs_output.bed
ADD COMMENT
0
Entering edit mode

I tried but it is not working, any other suggestion? Thanks for your help!

ADD REPLY
0
Entering edit mode

Yes, describe how it is not working. What have you been trying? Errors you got?

ADD REPLY
0
Entering edit mode

the sample sheet is the more likely problem....the narrowPeak file doesnt need any editing.

ADD REPLY
0
Entering edit mode

But then how can I obtain the count matrix? For that reason I wanted to convert the narrowPeak to bed because i already established the pipeline in that way. Any suggestion is very appreciated.

ADD REPLY
0
Entering edit mode

It worked for me, thank you very much

ADD REPLY
3
Entering edit mode
7.2 years ago
Rory Stark ★ 2.1k

DiffBind supports narrowPeak format directly, Just specify "narrow" as the value for PeakCaller in your samplesheet.

-Rory

ADD COMMENT
0
Entering edit mode

I have the narrowPeak files, I want to extract the counts to use the matrix with DESeq or EdgeR. That is why I was trying to convert the narrowPeak files into bed files. Any suggestion?

ADD REPLY

Login before adding your answer.

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