This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Error while executing "estimateSizeFactors" from DESeq2

Hi all,

I am using DESeq2 for DE analysis and I want to normalize my read counts on the basis of two calibrator set (their counts) that were used. I am using estimateSizeFactors to give the read counts of calibrators as "controlGenes" so that I can run DESeq2 but when I execute my codes (which are as follows-)

calidata<-read.csv("/Users/pg2597/Desktop/combined/caliisocounts_xyz.csv", header=TRUE, row.names = 1)

mat_data <- data.matrix(calidata)
calibrators <- grepl('cali', rownames(mat_data))
cal <- calibrators
dds_norm <- estimateSizeFactors(mat_data,controlGenes=cal)

I get following error:

Error in (function (classes, fdef, mtable)  : 
  unable to find an inherited method for function ‘estimateSizeFactors’ for signature ‘"matrix"’

Can someone help me with this?

Thanks in advance!

deseq2 software error r

Please use the formatting bar (especially the code option) to present your post better. I've done it for you this time.
code_formatting

Thank you!

Point noted ! Sorry for this time. Thanks

No problem. Formatting code makes it easy to read.

1 answer

The estimateSizeFactors() function expects a DESeq data object, not a data matrix.

You should do this:

calidata<-read.csv("/Users/pg2597/Desktop/combined/caliisocounts_xyz.csv", header=TRUE, row.names = 1)

mat_data <- data.matrix(calidata)

calibrators <- grepl('cali', rownames(mat_data))

cal <- calibrators

dds <- DESeqDataSetFromMatrix(countData = countData, colData = colData, design = ~ condition)

dds_norm <- estimateSizeFactors(dds, controlGenes=cal)

For further information on this, including what the contents of colData should be and how to set the design parameter, see Quick start and Count matrix input.

Note that people usually use the wrapper function, DESeq(dds), which will do the entire normalisation process for you, including calling estimateSizeFactors(). Your normalised counts could then be accessed with:

counts(dds, normalized=TRUE)

In this case, you are aiming to use control genes though.

Kevin

Thank you so much Kevin. It worked well. :)

If an answer was helpful you should upvote it, if the answer resolved your question you should mark it as accepted.
Upvote|Bookmark|Accept

Log in to answer this question.