Mainly related to https://github.com/welch-lab/liger/blob/master/R/preprocess.R#L264
This implementation captures the number of value entries per cell from a sparse representation (CSC format, mat@x). When it happens that there are explicit zero in mat@x, the nGene calculated gets wrong. Although this is never expected in regular use, it happens that an ambient RNA subtraction tool, such as SoupX, keeps all value entries there even if some values have already been subtracted to zero (i.e. Matrix::drop0() not called after subtraction).
Planned fix: modify the line referred to at the beginning of this issue to calculate based on explicit values. Or, do drop0() at object creation to avoid the situation. I'd prefer the latter because it's more memory efficient, and the current nGene calculation is way faster than looking at explicit values.
Mainly related to https://github.com/welch-lab/liger/blob/master/R/preprocess.R#L264
This implementation captures the number of value entries per cell from a sparse representation (CSC format,
mat@x). When it happens that there are explicit zero inmat@x, thenGenecalculated gets wrong. Although this is never expected in regular use, it happens that an ambient RNA subtraction tool, such as SoupX, keeps all value entries there even if some values have already been subtracted to zero (i.e.Matrix::drop0()not called after subtraction).Planned fix: modify the line referred to at the beginning of this issue to calculate based on explicit values. Or, do
drop0()at object creation to avoid the situation. I'd prefer the latter because it's more memory efficient, and the currentnGenecalculation is way faster than looking at explicit values.