Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

size factors should be positive in computeDoubletDensity #55

Closed
Close-your-eyes opened this issue Apr 21, 2022 · 1 comment
Closed

size factors should be positive in computeDoubletDensity #55

Close-your-eyes opened this issue Apr 21, 2022 · 1 comment

Comments

@Close-your-eyes
Copy link

Close-your-eyes commented Apr 21, 2022

Dear all,

with arbitrary samples (until recently I did not know which property was decisive) I got 'Error in .local(x, ...) : size factors should be positive' as error from computeDoubletDensity.

In some cases increasing subset.row was helpful (e.g. selecting the top 5000 highly variable features, instead of 2000). Sometimes though this could not resolve the issue.

I saw the other, similar, issue raised here (#32): My data set though was cleaned for cells with very low total read counts. The error persisted.

Solution:

One has to exclude cells which have zero total reads for features provided in subset.row:

factors <- scuttle::librarySizeFactors(expr_mat[subset.row,])
which(factors == 0)

Would it be acceptable to add a more meaningful error message? E.g. inform the user about cell names which have zero as library size?

I expect handling such error inside your function is not in your interest. If it is though:
(i) What would happen of library sizes are increased by a common value to avoid zeros? I mean adding 1 or 0.0001 or so, similar to log1p.
(ii) If such cells are excluded, an NA could be returned as doublet score. Or a -1 or so? Or they could be excluded complete from the return, which would cause other problems though.

Thanks.

@plger
Copy link
Owner

plger commented May 24, 2022

thanks and sorry for the delay. The solutions you suggest could have unintended downstream consequences, but I agree that it could help users to have a better idea of what's going on, so I simply added a more specific error message.

@plger plger closed this as completed May 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants