Question: Raw Count Matrix from DiffBind
0
3.7 years ago by
Italy
barbara.mariotti0 wrote:

Hi,

I know that those are very stupid question but is there a way to obtain an "exportable" data frame (something like a txt file) containing the raw count for each peak in each sample obtained with dba.count without performing all the differential analysis? Is there the possibility to obtained data frame containing the consensus peak set generated in my analysis?

Thank you so much

Barbara

diffbind • 2.0k views
modified 3.7 years ago by Rory Stark2.8k • written 3.7 years ago by barbara.mariotti0
Answer: Raw Count Matrix from DiffBind
1
3.7 years ago by
Rory Stark2.8k
CRUK, Cambridge, UK
Rory Stark2.8k wrote:

Hi Barbara-

Yes, you can do this using the dba.peakset() function with the parameter bRetrieve=TRUE.

For example, if you have a DBA object called myDBA:

> myDBA <- dba.count(myDBA)
> counts <- dba.peakset(myDBA, bRetrieve=TRUE)

This will return a GRanges object with the count scores. The default count score is TMM normalised using the edgeR package. If you want raw read counts, you can change the score first:

> myDBA <- dba.count(myDBA, peaks=NULL, score=DBA_SCORE_READS)
> counts <- dba.peakset(myDBA, bRetrieve=TRUE)

If you would prefer a data frame to a GRanges object:

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

And if you want to write out the counts to a text file:

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

Cheers-

Rory