GreenleafLab / ArchR

ArchR : Analysis of Regulatory Chromatin in R (www.ArchRProject.com)
MIT License
384 stars 137 forks source link

Error filtering doublets #478

Closed ccruizm closed 3 years ago

ccruizm commented 3 years ago

Good day,

I am having issues filtering the doublets after the score. Once addDoubletScores complete the scoring successfully, then I want to filterDoublets but get the next error:

Registered S3 method overwritten by 'cli':
  method     from    
  print.boxx spatstat

Error in value[[3L]](cond): select Not Found in Colnames of cellColData:
Error: Problem with `mutate()` input `tmpNewCol123`.
✖ object 'DoubletEnrichment' not found
ℹ Input `tmpNewCol123` is `eval(parse(text = select[x]))`.

Traceback:

1. filterDoublets(projdipg1)
2. getCellColData(ArchRProj, c("Sample", "DoubletEnrichment", "DoubletScore"))
3. lapply(seq_along(select), function(x) {
 .     tryCatch({
 .         data.frame(dplyr::mutate(ccd, tmpNewCol123 = eval(parse(text = select[x])))[, 
 .             "tmpNewCol123"], stringsAsFactors = FALSE)
 .     }, error = function(x) {
 .         stop("select Not Found in Colnames of cellColData:\n", 
 .             x)
 .     })
 . }) %>% Reduce("cbind", .) %>% {
 .     data.frame(., stringsAsFactors = FALSE)
 . }
4. Reduce("cbind", .)
5. lapply(seq_along(select), function(x) {
 .     tryCatch({
 .         data.frame(dplyr::mutate(ccd, tmpNewCol123 = eval(parse(text = select[x])))[, 
 .             "tmpNewCol123"], stringsAsFactors = FALSE)
 .     }, error = function(x) {
 .         stop("select Not Found in Colnames of cellColData:\n", 
 .             x)
 .     })
 . })
6. FUN(X[[i]], ...)
7. tryCatch({
 .     data.frame(dplyr::mutate(ccd, tmpNewCol123 = eval(parse(text = select[x])))[, 
 .         "tmpNewCol123"], stringsAsFactors = FALSE)
 . }, error = function(x) {
 .     stop("select Not Found in Colnames of cellColData:\n", x)
 . })
8. tryCatchList(expr, classes, parentenv, handlers)
9. tryCatchOne(expr, names, parentenv, handlers[[1L]])
10. value[[3L]](cond)
11. stop("select Not Found in Colnames of cellColData:\n", x)

Do not understand what the problem might be. Attached the log file. Thanks in advance!

ArchR-addDoubletScores-a2ddfe24a3-Date-2020-12-27_Time-18-23-55.log

jgranja24 commented 3 years ago

Hi @ccruizm, this seems like addDoubletScores may have not been used properly. This error is saying there is no column for "DoubletEnrichment". Please show the code you are using prior to this for us to help you out.

ccruizm commented 3 years ago

Hello @jgranja24 , after creating the arrow file, I used

doubScores <- addDoubletScores(
    input = ArrowFiles,
    k = 10, 
    knnMethod = "UMAP", 
    LSIMethod = 1
)

and it ran with no problems. However, when using filterDoublets immediately after, I got that error. I tried several times and did not work. However, it did work in another env with R v4.0 and an older version or ArchR (v.0.9.3). So it seems that might be something related with the newer versions.

jgranja24 commented 3 years ago

Hi @ccruizm, please list out what you are doing in full. Using filterDoublets without an ArchRProject doesnt make sense. Please list everything that is in your console input.

ccruizm commented 3 years ago

Hello @jgranja24. I am puzzled by the issue. Sometimes works fine and others show the error. I am not able to reproduce it everytime, so I will close this up. Thanks!

mirifax commented 3 years ago

Hi, I also get the same error after using doubScores <- addDoubletScores( input = ArchProj, k = 10, knnMethod = "UMAP", LSIMethod = 1 ) and then filterDoublets()

is there another attempt at solving than using an older ArchR version @ccruizm ?

it looks like the addDoubletScores() runs through normally

ArchR-addDoubletScores-1bef829834210-Date-2021-04-19_Time-10-47-34.log

rcorces commented 3 years ago

@mirifax - if you would like us to re-open this issue:

  1. Please specify whether you encounter this issue using the tutorial data and tutorial code
  2. If you cannot reproduce this issue with the tutorial data and tutorial code, please provide a reproducible example.
mirifax commented 3 years ago

Hi I solved it by reinstalling it. It looked like the doubletScore was not properly attached to the ArchRproject.