How to get DiffBind affinity scores for each consensus peak
1
0
Entering edit mode
Gary ▴ 20
@gary-7967
Last seen 5.1 years ago

Hi,

DiffBind is great and a heat map of counting reads is very helpful (e.g. the attached figure). However, I would like to run a hierarchical clustering using other graphical tools that I can swap different groups. Therefore, I need each sample's affinity scores for each consensus peak. The best way is that (1) every row is a sample; (2) every column is a consensus peak with affinity scores. Could you tell me how to get this kind of data? Many thanks.

Best,

Gary    

 

Count_PlotHeatmap

DiffBind • 1.5k views
ADD COMMENT
0
Entering edit mode
Rory Stark ★ 5.1k
@rory-stark-5741
Last seen 6 days ago
Cambridge, UK

Hi Gary-

Use dba.peakset() with bRetrieve=TRUE:

> scores <- dba.peakset(myDBA, bRetrieve=TRUE, DataType=DBA_DATA_FRAME)

This will return a data frame with a row for each consensus peak, the first three columns being chromosome, start, and end; and columns for each sample. (If you don't set DataType=DBA_DATA_FRAME, the data will be returned as a GRanges object). So to get what you're after you would want to strip the first three columns and transpose:

> scores <- t(scores[,-(1:3)])

Remember that you can easily change the scoring method without re-counting by setting peaks=NULL in dba.count():

> myDBA <- dba.count(myDBA, peaks=NULL, score=DBA_SCORE_READS)
> scores <- dba.peakset(myDBA, bRetrieve=TRUE, DataType=DBA_DATA_FRAME)
> scores <- t(scores[,-(1:3)])

Cheers-

Rory

ADD COMMENT
0
Entering edit mode

Hi Rory,

Thank you so much. May I have a stupid question? After getting the scores as the attached figure, how can I save it as a .txt file on a directory I want? Many thanks.

Best,

Gary

 

 

ADD REPLY
0
Entering edit mode

You can use the write.table() function in R to write out the transposed data frame, or you can write the original data frame out directly:

> scores <- dba.peakset(myDBA, bRetrieve=TRUE, writeFile="scores.txt")

-R

ADD REPLY

Login before adding your answer.

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