This is a test version of Biostars. For the public version, visit https://www.biostars.org.
edgeR negative bionomial error in without replicate data?

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

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?

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.

Why are you using data instead of matrix?

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

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.

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

1 answer

It is pointless what you do without replicates. See here (among many threads) why that is.

C: How to run the Deseq2 tool without replicates.

In my second approach I have used my actual count data, as described in the question. Could you please look into that. I know there is no point of the analysis without the replicates, but I have no other choice.

Log in to answer this question.