DGEList error in EdgeR - Warning: Error in $: $ operator is invalid for atomic vectors
1
0
Entering edit mode
9 months ago
shasabhi1 • 0

Hello everyone,

I am developing a simple Shiny app where users can upload a counts file (here called 'counts') and this can be analyzed later on using edgeR and Limma. This is a reactive object and I've used a reactive container called 'reactives'.

After reading the csv file as a dataframe, I tried to convert it to a numeric matrix using data.matrix. I've also made the gene ID's as the rownames and sample names as the colnames. I've also confirmed that the object was a matrix using class(reactives$counts) and this outputs as [1] "matrix" "array". The gene ID's are in the first column.

rownames(reactives$counts) <- reactives$counts[, c(1)]

reactives$counts <- reactives$counts[, -c(1)]

reactives$counts <- data.matrix(reactives$counts)

However, when I input this matrix into DGEList, I'm given the error: Warning: Error in $: $ operator is invalid for atomic vectors. I've also tried to change the class of the matrix to numeric using:

class(reactives$counts) <- "numeric"

DGEList(counts=reactives$counts)

Could someone help me understand why I'm receiving this error? The matrix is not empty as I outputted it as a table successfully and it appeared normal. Please advise!

Limma • 601 views
ADD COMMENT
1
Entering edit mode
9 months ago
Gordon Smyth ★ 7.0k

I suspect the error occurs before the data gets into the edgeR function.

None of this preprocessing should be necessary. You can just put the data.frame directly into edgeR by:

MyDataFrame <- read.csv( ... )
y <- DGEList(MyDataFrame, annotation.columns=1)
ADD COMMENT
0
Entering edit mode

Thank you Gordon Smyth , I found out that defining gene, count, and group (i.e. DGEList(count=..., gene=..., group=...) resolved this issue.

ADD REPLY

Login before adding your answer.

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