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

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

library(edgeR)
data = read.table("MYFILE-counts.txt", header=T, row.names=1, com='')
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) :
 data set ‘rnbinom(40, size = 1/bcv^2, mu = 10)’ not found
2: In data(rnbinom(40, size = 1/bcv^2, mu = 10), 20, 2) :
 data set ‘20’ not found
3: In data(rnbinom(40, size = 1/bcv^2, mu = 10), 20, 2) :
 data set ‘2’ not found

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.9k views
ADD COMMENT
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?

ADD REPLY
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.

ADD REPLY
0
Entering edit mode

Why are you using data instead of matrix?

ADD REPLY
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

ADD REPLY
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.

ADD REPLY
0
Entering edit mode

Hi 1234anjalianjali1234, I removed my comment, sorry I did not read your question properly, my bad.

ADD REPLY
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?

ADD REPLY

Login before adding your answer.

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