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

PercentAbove includes NA's as if above threshold #8412

Closed
molecules opened this issue Feb 2, 2024 · 2 comments
Closed

PercentAbove includes NA's as if above threshold #8412

molecules opened this issue Feb 2, 2024 · 2 comments
Assignees

Comments

@molecules
Copy link

Heads up, I found out that if NAs are included, then they are counted as above the threshold.

For example, I would expect that given one value at the threshold and some NAs, that the "PercentAbove" would return 0. However, as you can see, the following code counts all NAs as being above the threshold.

> a <- c(1, NA, NA)
> PercentAbove(a, threshold = 1)
[1] 0.6666667

seurat/R/utilities.R

Lines 1129 to 1131 in 41d19a8

PercentAbove <- function(x, threshold) {
return(length(x = x[x > threshold]) / length(x = x))
}

@longmanz
Copy link
Contributor

longmanz commented Feb 2, 2024

Hi,
Thank you for pointing this out. This is indeed a bug, and it could potentially affect DotPlot(). We will fix it.

@longmanz longmanz self-assigned this Feb 2, 2024
@Gesmira
Copy link
Contributor

Gesmira commented Jun 24, 2024

Hi,
This is now resolved in the most recent version of Seurat. Please feel free to reopen if you continue to run into any problems. Thanks!

@Gesmira Gesmira closed this as completed Jun 24, 2024
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

3 participants