DESeq2 contrast cleaning problem
1
0
Entering edit mode
john.hu • 0
@johnhu-9654
Last seen 8.2 years ago

I am testing DESeq2 1.10.1 version and find some issue with cleanContrast function.

I use a standard 2x2  A*B design with interaction terms. 

DESeqDataSetFromMatrix(countData = round(datacounts), colData = designtable, design = ~ Gender*Site)

dds<- DESeq(dds, modelMatrixType="standard")

output <- results(dds, independentFiltering=T, contrast=c(0, 0, 1, 0))

 

When I extract the contrast results to get the site M vs site K when gender is Female with the contrast vector, I found that some of the all zero contrasts are not properly filtered.  I debug the code using RStudio and find that in CleanContrast function , when a numeric contrast vector is used, contrastAllZero <- contrastAllZeroNumeric(object, contrast) is called. If I get the logic right, this function is used to detect genes whose counts for samples used in contrasts are all zero. However, after checking the source code of contrastAllZeroNumeric, it will do nothing for my contrast vector above. 

### in contrastAllZeroNumeric function ###

if (all(contrast >= 0) | all(contrast <= 0)) {
        return(rep(FALSE, nrow(object)))
    }

I kind of feel this is a bug.

 

software error bugs deseq2 • 1.6k views
ADD COMMENT
0
Entering edit mode
@mikelove
Last seen 14 hours ago
United States

hi John,

Thanks for the report. The extra leg work in DESeq2 to zero out the log2FoldChange, lfcSE, and set the p-value to 1 only is implemented for simple multi-factor designs and not for designs with interactions. This was a feature request from a user a year or so ago, who had an experiment with size factors differing by more than an order of magnitude and confounded with group (this is problematic for many reasons). Here, comparing a group with all zeros against another group with all zeros gives a paradoxical non-zero LFC. You can observe the same with glm() and providing a non-zero offset. So it's not really a bug, but I knowingly only implemented this for the simpler designs. I will add some comments in the code to state this explicitly.

ADD COMMENT
0
Entering edit mode

I should add, it works under the default DESeq() use of expanded model matrices, but not for standard model matrices.

ADD REPLY
0
Entering edit mode

Yeah, I think this function is written for expanded matrix only. For standard matrix, the filter works file when a contrast is specified in text as contrast=c("Term", "A", "B") 

It makes biological sense to reset the log2fc and p-values for RNA-Seq data when all samples in the contrast have zero counts. Probably should extend this to complex models as well.

Thanks.

ADD REPLY
0
Entering edit mode
Thanks again for your report and suggestion. For standard design matrices and numeric contrasts, I think we will continue to provide the standard LFC, not zeroed out. You can use the character vector to enable the zeroing feature.
ADD REPLY

Login before adding your answer.

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