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!

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 <a href="http://bioconductor.org/packages/devel/bioc/vignettes/DESeq2/inst/doc/DESeq2.html#quick-start">Quick start</a> and <a href="http://bioconductor.org/packages/devel/bioc/vignettes/DESeq2/inst/doc/DESeq2.html#countmat">Count matrix input</a>.

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
