Does readDGE work with data frames?
Entering edit mode
11 months ago
a_bis ▴ 30

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 • 726 views
Entering edit mode

They probably want the gene IDs to be the rownames.

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


Login before adding your answer.

Traffic: 1186 users visited in the last hour
Help About
Access RSS

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6