Question: How to get all possible comparisons in DiffBind
0
gravatar for bony.dekumar
11 months ago by
bony.dekumar0 wrote:

I was trying to analyze differential binding for four different set of experiments done in duplicate

SampleI Tissue  Factor  Condition   Replicate   bamReads    ControlID    bamControl Peaks    PeakCaller
NS_1    NS  Un  NS  1   15-011-001.sorted.bam           ns_s1_peaks.narrowPeak  narrowPeak
NS_2    NS  UN  NS  2   15-011-005.sorted.bam           ns_s2_peaks.narrowPeak  narrowPeak
HSF_1   HSF treated HSF 1   15-011-002.sorted.bam           hsf_s1_peaks.narrowPeak narrowPeak
HSF_2   HSF treated HSF 2   15-011-006.sorted.bam           hsf_s2_peaks.narrowPeak narrowPeak
LPS_1   LPS treated LPS 1   15-011-003.sorted.bam           lps_s1_peaks.narrowPeak narrowPeak
LPS_2   LPS treated LPS 2   15-011-007.sorted.bam           lps_s2_peaks.narrowPeak narrowPeak
LPS_HSF_1   HSF+LPS treated HSF+LPS 1   15-011-004.sorted.bam           hsf_lpf_s1_peaks.narrowPeak narrowPeak
LPS_HSF_1   HSF+LPS treated HSF+LPS 2   15-011-008.sorted.bam           hsf_lpf_s2_peaks.narrowPeak narrowPeak

hsf=dba(sampleSheet="samples_1.csv")
hsf = dba.count(hsf)
hsf<- dba.contrast(hsf, minMembers=2,categories=DBA_CONDITION)
hsf<- dba.analyze(hsf)
hsf.DB <- dba.report(hsf)
hsf.DB
GRanges object with 1297 ranges and 6 metadata columns:
        seqnames              ranges strand |      Conc   Conc_NS  Conc_HSF
           <Rle>           <IRanges>  <Rle> | <numeric> <numeric> <numeric>
   4525    chr10   19009922-19011726      * |      9.83      9.41     10.15
  34430     chr2 118112535-118114224      * |      9.29      9.64      8.83
  12272    chr12     3873249-3875190      * |      9.25      8.77      9.61
   4017     chr1 191266448-191269505      * |     10.02      9.64     10.32
  14287    chr12 108637001-108639115      * |     10.45     10.09     10.74
    ...      ...                 ...    ... .       ...       ...       ...
  18950    chr14   63125596-63125926      * |      8.57      8.33      8.77
  54141     chr7 139247666-139248397      * |      8.19      7.92      8.41
  32468     chr2   30441240-30441852      * |      7.87      7.57      8.12
  35762     chr2 156178342-156180177      * |      9.96      9.77     10.12
   9741    chr11   75463189-75463574      * |      7.46      7.13      7.72
             Fold   p-value       FDR
        <numeric> <numeric> <numeric>
   4525     -0.74  3.65e-11   3.3e-07
  34430      0.81  4.07e-11   3.3e-07
  12272     -0.84  5.27e-11   3.3e-07
   4017     -0.68  1.74e-10  8.15e-07
  14287     -0.66  4.78e-10   1.8e-06
    ...       ...       ...       ...
  18950     -0.44   0.00343    0.0499
  54141     -0.49   0.00344      0.05
  32468     -0.55   0.00345      0.05
  35762     -0.35   0.00345      0.05
   9741     -0.59   0.00345      0.05

It seems that i am getting only i comparison ( NS Vs HSF). How to get other comparisons also .

Thanks

diffbind • 322 views
ADD COMMENTlink modified 11 months ago by James W. MacDonald52k • written 11 months ago by bony.dekumar0
Answer: How to get all possible comparisons in DiffBind
1
gravatar for Rory Stark
11 months ago by
Rory Stark3.0k
CRUK, Cambridge, UK
Rory Stark3.0k wrote:

It looks like you have 4 conditions: NS, HSF, LPS, and HSF+LPS, is that right? And you'd like to see the 6 possible two-way contrasts?

If this is the case, you have actually computed them all already! To see them, you need to specify which contrasts you want in the call to dba.report() by setting the contrast parameter. In the code snippet you provided, you didn't specify this, so you got the default contrast (contrast=1).

You can see all the contrasts and their corresponding contrast numbers by printing out the DBA object:

> hsf

You can also retrieve the contrasts programmatically:

> contrasts <- dba.show(hsf, bContrasts=TRUE)

then cycle through the contrasts.

ADD COMMENTlink written 11 months ago by Rory Stark3.0k

Thanks . It helped to create other contrast.

ADD REPLYlink written 11 months ago by bony.dekumar0

Hi Rory, I am having similar situation. If we take the example above. Then, to get all possible comparisons, I have to write code chunks, as following?

#Lets assume "result=our DBA object having samples for multiple pairwise comparison"

dba.count(result) # for counting the reads for all conditions.

##for first pair
result1<- dba.contrast(result, for first pair)
result1<- dba.analyze(result1)
result1.db<- dba.report(result1)

##for second pair
result2<- dba.contrast(result, code for second pair)
result2<- dba.analyze(result2)
result2.db<- dba.report(result2)

#For 3rd, 4th..etc....

And so on...

Thanks again for this amazing package and all your help!

ADD REPLYlink modified 10 months ago • written 10 months ago by shikhtechai0

You can include all the contrasts in a single DBA object. You can call dba.contrast() multiple times, adding all the contrasts, then use a single call to dba.analyze() to run all the analyses (in parallel by default). Finally, to get the results, call dba.report() with contrast=n, changing the contrast number to get each specific contrast. Likewise for the plotting functions, set contrast=n to plot the results for each contrast.

ADD REPLYlink written 10 months ago by Rory Stark3.0k
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 16.09
Traffic: 226 users visited in the last hour