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

Error in bcRanks #120

Closed
mj-jimenez opened this issue Mar 30, 2023 · 4 comments
Closed

Error in bcRanks #120

mj-jimenez opened this issue Mar 30, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@mj-jimenez
Copy link
Collaborator

bcRanks returns the following error:

Error in quantile.default(as.numeric(out$residuals.mean), prob = seq(from = 0,  : 
  missing values and NaN's not allowed if 'na.rm' is FALSE

I think it is due to bad cell subsetting.

@mj-jimenez
Copy link
Collaborator Author

Actually, it is due to all cells in a cluster having NaN values for a signature. To solve this there are several approaches:

  • Imputation of missing values after bcScore. Right now, it has to be done as part of regression. We should separate these two functions.
  • Convert NaNs to 0 within bcRanks (to compute the residuals).
  • Probably the best one: Assign NaN to 0s (related to Add no.missing argument to bcScore #113).

@mj-jimenez mj-jimenez added the bug Something isn't working label Mar 31, 2023
@SGMartin
Copy link
Contributor

Any news on this front @mj-jimenez ?

@mj-jimenez
Copy link
Collaborator Author

This error appears in bcRanks but it is caused by the NaN values introduced when creating the beyondcell object. As said in #113, the best practice right now is this work-around until we update the bcScore function:

# Beyondcell object with a lot of NaN values
bcobj <- bcScore(sc, SSc, expr.thres = 0.1)

# Filter out spots with a high percentage of NAs                                                                                                                                                                                       
bcobj.filtered <- bcSubset(bcobj, nan.cells = 0.95)                                                                                                                                                                                    
                                                                                                                                                                                                                                       
# Replace NAs by 0s                                                                                                                                                                                                                    
bcobj.filtered@normalized[is.na(bcobj.filtered@normalized)] <- 0                                                                                                                                                                       
bcobj.recomputed <- bcRecompute(bcobj.filtered, slot = "normalized") 

@mj-jimenez
Copy link
Collaborator Author

Also, this problem is signature related (i.e. most of the genes in the signatures are not found in the expression matrix). This happened in beyondcell v2.0, which contained a high proportion of non-coding genes. Since beyondcell v2.1, the signatures only contain coding genes, thus this error is unlikely to happen with a standard single-cell experiment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants