So I've been trying to learn some Seurat recently and while working on some data I noticed that there's a discrepancy between the library size for a given cell in my raw count matrix (i.e. unnormalized and including only those genes not filtered out by Seurat when creating the Seurat object) and the library size for the same cell in the seurat_object[['RNA']@counts object, i.e. the cell in the counts object always seems to have a bigger library size for some reason. I couldn't find anything in the documentation that describes this and I don't know how to view the source-code since printing out the function in the R console just gives me UseMethod(generic = "NormalizeData", object = object) Any of you guys know what might be happening?
The library size differences are probably due to filtering. Genes and cells with few values are removed by default in
I find it easiest to trace the function code in their GitHub. For example: https://github.com/satijalab/seurat/search?q=NormalizeData&unscoped_q=NormalizeData
In this case, there are multiple versions of
NormalizeData() based on your object type.