I am trying to use a custom size factors (computed using the Scran package) in edgeR when doing the workflow for differential expression and get the following error:
d2=estimateDisp(d2,design.mat,mixed.df=T,offset=sce$size_factor)
Error in estimateDisp.default(y = y$counts, design = design, group = group, :
formal argument "offset" matched by multiple actual arguments
Here d2 is the raw counts DGEList and sce$size_factor is the size factors computed by scran for my single cell data. Is this the correct way to use the Scran size factors?
If instead of the above method I load an already Scran normalized counts table and use the default offset and default size factors of 1 then calling the estimate dispersion function, it seems to work. I guess my real question is are these equivalent? My end goal is just to use edgeR differential expression on single cell data with the Scran normalization method.
Thank you very much!
I noticed also that if I change the order or the samples in the data frame and normalize via the quick cluster method that the size factors slightly change. Is there a random seed or something that is causing this?
There are no random seeds, and I don't think it's an issue with
quickCluster
. One other possibility is that you have some cells with the same library size, which means that the ordering of cells to be used for pooling will change upon reordering of the samples incomputeSumFactors
. This will affect the pools that are formed and the size factors that are calculated. The slight changes shouldn't be a major problem for downstream analyses, so I wouldn't worry about it.Yeah, I noticed that the change is very small. I went through the differential expression workflow in edgeR on the same dataset ordered differently and the results are almost identical. Thanks again for the help!