Hi, I'm trying to use DeSeq2 to calculate gene expression levels.
My count table (all_counts) looks like this
gene cell1 cell2
1 ENSMUST00000000001 712 1613
2 ENSMUST00000000003 0 0
3 ENSMUST00000000010 2 3
4 ENSMUST00000000028 0 0
5 ENSMUST00000000033 0 0
I'm call DESeqDataSetFromMatrix
dds <- DESeqDataSetFromMatrix(countData = all_counts,
colData = data.frame(c('gene', 'cell1', 'cell2')))
But I'm always getting this error
Error in DESeqDataSet(se, design = design, ignoreRank) :
some values in assay are negative
But there are no negative values. I verified this by
> any (!is.integer(all_counts[,2]))
[1] FALSE
> any (!is.integer(all_counts[,3]))
[1] FALSE
> any (all_counts[,2] < 0)
[1] FALSE
> any (all_counts[,3] < 0)
[1] FALSE
Any ideas what I'm doing wrong?
Thx for your reply. I tried changing the call to
But I'm still getting the same error message.
Try dropping the first column:
countData = as.matrix(all_counts[ , -1]
Thank you very much, this works. So do I have to store the gene ids by my self in an extra vector or is there a better way how to keep the gene ids associated with the rows?
In this example they don't have to drop the gene ids but I don't know why it's not working in my case: https://informatics.fas.harvard.edu/differential-expression-with-deseq2.html
Set the gene IDs to be the row names of the matrix.