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?

Many thanks in advance!

Rstudio readDGE edgeR • 238 views
ADD COMMENT
1
Entering edit mode

They probably want the gene IDs to be the rownames.

rownames(readCounts) <- readCounts[, 1]
readCounts[, 1] <- NULL
ADD REPLY
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.

ADD REPLY

Login before adding your answer.

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