edgeR negative bionomial error in without replicate data?
1
0
Entering edit mode
4.6 years ago

I am doing DEG analysis between two sample (Normal vs Treated) without replicates using edgeR:

library(edgeR)
bcv <- 0.2
counts <- matrix( rnbinom(40,size=1/bcv^2,mu=10), 20,2)


it is giving error:

## Warning messages:
1: In data(rnbinom(40, size = 1/bcv^2, mu = 10), 20, 2) :
2: In data(rnbinom(40, size = 1/bcv^2, mu = 10), 20, 2) :
3: In data(rnbinom(40, size = 1/bcv^2, mu = 10), 20, 2) :


I am not able to understand this error and need help to solve this. I know there is no significance of analysis without replicates, but i have no other choice.

Then i proceeded with:

counts <- data
y <- DGEList(counts=counts, group=1:2)
et <- exactTest(y, dispersion=bcv^2)


looking into the variable:

>y

An object of class "DGEList"
$counts Normal.bam Treated.bam Cluster-0.0 0 50 Cluster-1.0 0 25 Cluster-2.0 0 16 Cluster-2.1 0 8 Cluster-3.0 0 15 202654 more rows ...$samples         group     lib.size      norm.factors
Normal.bam      1          3.22e+07              1
Treated.bam     2          1.05e+08              1


why there is norm.factor of 1 in both sample?

>et

An object of class "DGEExact"
$table logFC logCPM PValue Cluster-0.0 8.03 -1.58 4.06e-05 Cluster-1.0 7.04 -2.39 2.13e-03 Cluster-2.0 6.40 -2.89 3.49e-02 Cluster-2.1 5.42 -3.58 7.51e-02 Cluster-3.0 6.31 -2.95 3.49e-02 202654 more rows ...$comparison
[1] "1" "2"

$genes NULL  Why there are NULL in$genes?

RNA-Seq no-replicate R edgeR • 1.6k views
1
Entering edit mode

This works fine for me (no errors, no warnings):

bcv <- 0.2
counts <- matrix( rnbinom(40,size=1/bcv^2,mu=10), 20,2)


Check the size of matrix:

dim(counts)
# [1] 20  2


I am guessing you have some hidden characters in the code, try to retype the commands, instead of copy-pasting from some document/website?

0
Entering edit mode

I have tried typing it myself, but again giving same error. as suggested by you, i have checked my counts dimention:

> dim(counts)
[1] 202659      2


i have tried this also but nothing worked:

counts <- data(rnbinom(40,size=1/bcv^2,mu=10), 202659,2)


i have modified my question.

0
Entering edit mode

Why are you using data instead of matrix?

0
Entering edit mode

sorry it was by mistake. Even if i am using matrix instead of data, there is error:

counts <- matrix(rnbinom(40,size=1/bcv^2,mu=10), 202659,2)

Warning message:
In matrix(rnbinom(40, size = 1/bcv^2, mu = 10), 202659, 2) :
data length [40] is not a sub-multiple or multiple of the number of rows [202659]


Could you please explain the code, i think i am not able to set the parameters according to my dataset.

i tried:

 counts <- matrix(rnbinom(405318,size=1/bcv^2,mu=10), 202659,2)


this gives no error, but i need to understand, what this code is doing to my data and what parameter should be used like which value of mu should be taken.

Thankyou

1
Entering edit mode

To avoid first warning, we need to supply correct dimensions, try this code, and adapt numbers for nRows, nCols as needed:

nRows <- 4
nCols <- 2
counts <- matrix(rnbinom(nRows * nCols, size = 1/bcv^2, mu = 10), nrow = nRows, ncol = nCols)


Regarding mu, read the manuals, tutorials.

0
Entering edit mode

0
Entering edit mode

Actually i need some more answers related to this question. Should i post a new question or modify this one only?