DiffBind normalisation factor retrieval
1
0
Entering edit mode
Nico • 0
@ce8f2229
Last seen 3.4 years ago
United Kingdom

Hi,

We use DiffBind for the differential binding analysis of our ChIP data. In this we use edgeR TMM for normalization. I would like to print out the normalization factors for this but it only ever gives me NULL. Any help would be really appreciated. Thank you.

``` indiff <- dba(sampleSheet="//smb.cluster/080719ATACseq/Diffbind/SampleSheets/AAG57_0v2_SampleSheet_desktop.csv") indiff indiff_count <- dba.count(indiff, minOverlap=2) indiff_count

info <- dba.show(indiff_count) libsizes <- cbind("LibReads"=info$Reads, "FRiP"=info$FRiP, "PeakReads"=round(info$Reads * info$FRiP))

info

rownames(libsizes) <- info$ID libsizes

plot(indiff_count)

indiff_norm <- dba.normalize(indiff_count) norm <- dba.normalize(indiff_count, bRetrieve=TRUE) norm

normlibs <- cbind(FullLibSize=norm$lib.sizes, NormFacs=norm$norm.factors,NormLibSize=round(norm$lib.sizes/norm$norm.factors)) rownames(normlibs) <- info$ID normlibs

Continue with DiffBind to obtain differential peaks

indiff = dba.contrast(indiff_count, categories=DBA_CONDITION, minMembers=2) indiff

indiff_edgeR = dba.analyze(indiff, method=DBA_EDGER) indiff_edgeR indiff_edgeR.DB = dba.report(indiff_edgeR, method=DBA_EDGER, th=0.2) indiff_edgeR.DB

norm <- dba.normalize(indiff_count, method=DBA_EDGER, bRetrieve=TRUE) norm.factors <- norm$norm.factors

OUTPUT:

Design: [~Condition] | 1 Contrast: Factor Group Samples Group2 Samples2 1 Condition 2h 3 0h 3

indiff_edgeR = dba.analyze(indiff, method=DBA_EDGER) Applying Blacklist/Greylists... Genome detected: Mmusculus.UCSC.mm10 Applying blacklist... Removed: 3127 of 125028 intervals. Removed 3127 (of 125028) consensus peaks. Normalize edgeR with defaults... Forming default model design and contrast(s)... Computing results names... Analyzing... indiff_edgeR 6 Samples, 121901 sites in matrix: ID Condition Replicate Reads FRiP 1 AAG57-0h-1 0h 1 22448776 0.36 2 AAG57-0h-2 0h 2 24911237 0.35 3 AAG57-0h-3 0h 3 28896386 0.35 4 AAG57-2h-1 2h 1 24714679 0.29 5 AAG57-2h-2 2h 2 29507822 0.33 6 AAG57-2h-3 2h 3 33691154 0.33

Design: [~Condition] | 1 Contrast: Factor Group Samples Group2 Samples2 DB.edgeR 1 Condition 2h 3 0h 3 19426

indiff_edgeR.DB = dba.report(indiff_edgeR, method=DBA_EDGER, th=0.2) indiff_edgeR.DB GRanges object with 28978 ranges and 6 metadata columns: seqnames ranges strand | Conc Conc_2h Conc_0h Fold p-value <Rle> <IRanges> <Rle> | <numeric> <numeric> <numeric> <numeric> <numeric> 8799 chr10 17820527-17820927 | 6.82151 5.13235 7.57844 -2.64669 0.00000000000000000000000000000000000000000000000000000000179294 77042 chr4 22144897-22145297 | 7.26597 5.97037 7.93739 -2.16984 0.00000000000000000000000000000000000000000000000001864833315542 117003 chr9 88332487-88332887 | 7.62881 6.47146 8.26262 -1.99477 0.00000000000000000000000000000000000000000000000002912935067718 117174 chr9 94661722-94662122 | 6.32876 4.56202 7.09949 -2.73578 0.00000000000000000000000000000000000000000000001913996246609111 73471 chr3 94167319-94167719 | 6.60388 5.14560 7.31412 -2.36934 0.00000000000000000000000000000000000000000003416531189459000477 ... ... ... ... . ... ... ... ... ... 26443 chr12 80853857-80854257 | 4.52610 4.32601 4.70178 -0.577814 0.0474729 91455 chr5 135550916-135551316 | 5.00184 5.31136 4.60723 0.496892 0.0475155 10308 chr10 51235612-51236012 | 4.67882 4.49695 4.84032 -0.545928 0.0475184 112037 chr8 120732016-120732416 | 6.94716 6.90817 6.98513 -0.281904 0.0475370 111490 chr8 112034640-112035040 | 5.55249 5.44471 5.65278 -0.412201 0.0475415 FDR <numeric> 8799 0.000000000000000000000000000000000000000000000000000218561 77042 0.000000000000000000000000000000000000000000001136625229989 117003 0.000000000000000000000000000000000000000000001183632325633 117174 0.000000000000000000000000000000000000000000583295141144743 73471 0.000000000000000000000000000000000000000832957137052483327 ... ... 26443 0.199730 91455 0.199903 10308 0.199908 112037 0.199980

111490 0.199991

seqinfo: 28 sequences from an unspecified genome; no seqlengths

norm <- dba.normalize(indiff_count, method=DBA_EDGER, bRetrieve=TRUE) norm.factors <- norm$norm.factors

norm.factors NULL

```

edgeR Normalization DiffBind • 1.0k views
ADD COMMENT
1
Entering edit mode
Rory Stark ★ 5.2k
@rory-stark-5741
Last seen 5 weeks ago
Cambridge, UK

The formatting of your code makes this very difficult to interpret. You should enclose code blocks using the CODE button in the editor. Also, you should include the output of sessionInfo() so we can see what versions you are using.

I was able to reformat the code and see the issue.

You have a snippet that looks like this:

indiff_norm <- dba.normalize(indiff_count) 
norm <- dba.normalize(indiff_count, bRetrieve=TRUE) 
norm

You are assigning the result of normalizing to indiff_norm, but retrieving the factors from the (non-normalized) object indiff_count, which is why norm is NULL. So it should be:

indiff_norm <- dba.normalize(indiff_count) 
norm <- dba.normalize(indiff_norm, bRetrieve=TRUE) 
norm

Likewise, you are running dba.contrast() on the non-normalized indiff_count, and then running the analysis on that. As no normalization has been run, the default normalization is performed, and returned as part of the indiff_edgeR object. You could retrieve the normalization factors from this object, but again you attempt this on the non-normalized indiff_count, resulting in a NULL.

Hope this helps!

ADD COMMENT

Login before adding your answer.

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