estimateDisp() error
2
0
Entering edit mode
ASNbioinf • 0
@51be3fd9
Last seen 9 months ago
Italy

The obj$counts is numeric. When I run the following code seems that it is not true because return an error that explains the opposite. Is there one alternative estimateDisp() function?

#DISPERSION ESTIMATION 
obj <- estimateDisp(obj, design, robust=TRUE)
#plotBCV(obj)
head(obj)

Error in colSums(y): 'x' must be numeric
Traceback:

1. estimateDisp(obj, design, robust = TRUE)
2. estimateDisp.default(obj, design, robust = TRUE)
3. colSums(y)
edgeR • 845 views
ADD COMMENT
0
Entering edit mode
@james-w-macdonald-5106
Last seen 8 hours ago
United States

The error doesn't come from estimateDisp, but instead from colSums. Given the choice between accepting what colSums says about your data, and what you say about your data, I am going with colSums every time. You for sure have non-numeric values in the counts list item of your DGEList.

0
Entering edit mode

How can I set numeric value in the counts list?

Currently obj$counts is this:

                                      P1    P2    P3    P4
    ENSG00000223972.5   0   0   0   0
    ENSG00000227232.5   0   1   1   0
    ENSG00000278267.1   0   0   0   0
    ENSG00000243485.5   0   0   0   0
    ENSG00000284332.1   0   0   0   0
    ENSG00000237613.2   0   0   0   0
ADD REPLY
0
Entering edit mode

What does

apply(obj$counts, 2, class)

return?

ADD REPLY
0
Entering edit mode

It returns:

ADD REPLY
0
Entering edit mode

P1, P2, P3 and P4 equals to integer

ADD REPLY
0
Entering edit mode

I'm sorry, obj$counts is this:

                                P1        P2         P3       P4 
ENSG00000279457.4           9     9      7        11
ENSG00000225630.1           510   432        212      406
ENSG00000237973.1           19    18         23       14
ENSG00000248527.1           2246      1561       1380     2103
ENSG00000198744.5           11    6      1        4
ENSG00000237491.10          13    9      8        7

and

> apply(obj$counts, 2, class)

returs: P1, P2, P3 and P4 equals to integer

ADD REPLY
0
Entering edit mode

What do you get for

colSums(obj$counts)
ADD REPLY
0
Entering edit mode

Also, don't run code and then tell me what it returned. You can copy/paste the output just as easily as you can copy/paste the code you ran.

ADD REPLY
0
Entering edit mode
@gordon-smyth
Last seen 43 minutes ago
WEHI, Melbourne, Australia

My guess is that your obj is not a DGEList object, in which case the identity of obj$counts is irrelevant because it will never be accessed. To illustrate an incorrect code sequence leading to the same error:

> counts <- matrix(0,2,2)
> obj <- list(counts=counts)
> y <- as.matrix(obj)
> colSums(y)
Error in colSums(y) : 'x' must be numeric

You can check whether obj is a DGEList by typing class(obj).

ADD COMMENT

Login before adding your answer.

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