DiffBind: Report differential sites by fold > & < 0
4
0
Entering edit mode
@sergioespeso-gil-6997
Last seen 4.8 years ago
New York

I would like to save separately differential binding sites fold>0 and fold<0 reported by 

sum(myDBA.DB$Fold<0)

sum(myDBA.DB$Fold>0) 

I am trying to use the fold option in db.report but it doesn't allow to add > or < . How I can do then this? 

Thanks a lot

diffbind • 1.6k views
ADD COMMENT
0
Entering edit mode
Rory Stark ★ 5.2k
@rory-stark-5741
Last seen 27 days ago
Cambridge, UK

Hi Sergio,

You can subset the report to get only the "gain" or "loss" DB sites:

​> myDBA.DB <- dba.report(myDBA.DB)
> myDBA.DB.Gain <- myDBA.DB[myDBA.DB$Fold>0,]
> length(myDBA.DB.Gain)
> myDBA.DB.Loss <- myDBA.DB[myDBA.DB$Fold<0,]
> length(myDBA.DB.Loss)

You can also retrieve the Gain and Loss sites as peaksets in a new "report-based" DBA object using the bDB=TRUE option in dba.report() and setting bGain=TRUE and/or bLoss=TRUE.

Cheers-

Rory

ADD COMMENT
0
Entering edit mode
@sergioespeso-gil-6997
Last seen 4.8 years ago
New York

Oh thanks a lot !! 

ADD COMMENT
0
Entering edit mode
@sergioespeso-gil-6997
Last seen 4.8 years ago
New York

 

Sorry Rory, for whatever reason it doesn't save the report in a csv file. I am doing:

myDBA <- dba.contrast(myDBA, group1=myDBA$masks$T1 & myDBA$masks$WT, group2=myDBA$masks$T1 & myDBA$masks$Transgenic, name1="WT:T1", name2="Transgenic:T1")
myDBA.DB <- dba.analyze(myDBA)

myDBA.DB=dba.report(myDBA, bDB=TRUE, bGain=FALSE, bLoss=TRUE, file="myDBA_loss")

When I am writing bDB=TRUE is not saving myDBA_loss.csv , calling myDBA:
2 Samples, 351 sites in matrix (837 total):

If I remove bDB=TRUE is saving myDBA_loss.csv , calling myDBA:

GRanges with 837 ranges and 6 metadata columns:

But this is wrong as it is the whole DB matrix. 

Should include other parameter? Excuse me for being so annoying

Thanks a lot

ADD COMMENT
0
Entering edit mode
Rory Stark ★ 5.2k
@rory-stark-5741
Last seen 27 days ago
Cambridge, UK

Hi Sergio-

Indeed if you set bDB=TRUE, dba.report() will create the new DBA object and not save the report file, so you have to call it separately and you are doing. Also, as you say, it will then write out the whole report. You can take the csv report and separate it into two (gain and loss) based on the sign of the Fold column. Alternatively, you can have the report returned, divide it into two as in the example above, and write it out yourself:

​> myDBA.DB <- dba.report(myDBA.DB,DataType=DBA_DATA_FRAME)
> myDBA.DB.Gain <- myDBA.DB[myDBA.DB$Fold>0,]
> write.csv(myDBA.DB.Gain,file=myDBA_gain.csv",row.names=FALSE,quote=FALSE)
> myDBA.DB.Loss <- myDBA.DB[myDBA.DB$Fold<0,]
> write.csv(myDBA.DB.Loss,file=myDBA_loss.csv",row.names=FALSE,quote=FALSE)

Cheers-

Rory

 
ADD COMMENT

Login before adding your answer.

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