Does readDGE work with data frames?
0
0
Entering edit mode
6 weeks ago
a_bis ▴ 20

Hi, I have been trying to make a DGEList out of a dataframe ('readCounts') I have imported to Rstudio. The dataframe has 13 columns, one with gene IDs, and twelve with the read counts for each of the genes identified in twelve RNA-seq samples.

The edgeR bio conductor documentation says that

The function readDGE makes a DGEList object directly. If the table of counts is already available as a matrix or a data.frame, x say, then a DGEList object can be made by y <- DGEList(counts=x)

However, when I try to do that, I get a message back saying

Error in DGEList(counts = readCounts) : The count matrix is a data.frame instead of a matrix and the first column is of class character instead of being numeric. Was the first column intended to contain geneids?

This is exactly what the first column was intended to contain, so if I remove the first column with the gene ids, I will have a collection of unidentified read counts, and I'm not sure how I'll be able to 're-connect' them with their 'gene of origin.' Is there a workaround to this problem?

Rstudio readDGE edgeR • 233 views
1
Entering edit mode

They probably want the gene IDs to be the rownames.

rownames(readCounts) <- readCounts[, 1]

0
Entering edit mode

Thank you very much! I also figured out that if the first column doesn't have text/data in the first row, when loaded in Rstudio with read.table it is assumed to be the rownames column.