BPCells
BPCells copied to clipboard
select_cells on RNA matrix
Hi Ben,
I saw that the function select_cells can be used to subset a list of cells from an IterableFragments object. Can the same be done on an IterableMatrix object?
I figured out that I can select cells from a cell_list by using obj[ , cell_list]. But when cell_list contains duplicates, I receive an error message Error: In function [: "j" must not have duplicated values. Is there a way of selecting duplicate cells? I am trying to sample cells with replacement.
pbmc[["RNA"]]$counts[,c(1,1)]
Error: In function [: "j" must not have duplicated values
▆
1. ├─IRkernel::main()
2. │ └─kernel$run()
3. │ └─IRkernel (local) handle_shell()
4. │ └─executor$execute(msg)
5. │ ├─base::tryCatch(...)
6. │ │ └─base (local) tryCatchList(expr, classes, parentenv, handlers)
7. │ │ ├─base (local) tryCatchOne(...)
8. │ │ │ └─base (local) doTryCatch(return(expr), name, parentenv, handler)
9. │ │ └─base (local) tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
10. │ │ └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
11. │ │ └─base (local) doTryCatch(return(expr), name, parentenv, handler)
12. │ └─evaluate::evaluate(...)
13. │ ├─base::withRestarts(...)
14. │ │ └─base (local) withRestartList(expr, restarts)
15. │ │ ├─base (local) withOneRestart(withRestartList(expr, restarts[-nr]), restarts[[nr]])
16. │ │ │ └─base (local) doWithOneRestart(return(expr), restart)
17. │ │ └─base (local) withRestartList(expr, restarts[-nr])
18. │ │ └─base (local) withOneRestart(expr, restarts[[1L]])
19. │ │ └─base (local) doWithOneRestart(return(expr), restart)
20. │ ├─evaluate:::with_handlers(...)
21. │ │ ├─base::eval(call)
22. │ │ │ └─base::eval(call)
23. │ │ └─base::withCallingHandlers(...)
24. │ ├─base::withVisible(eval(expr, envir))
25. │ └─base::eval(expr, envir)
26. │ └─base::eval(expr, envir)
27. ├─pbmc[["RNA"]]$counts[, c(1, 1)]
28. └─pbmc[["RNA"]]$counts[, c(1, 1)]
29. └─BPCells:::selection_index(j, ncol(x), colnames(x))
Hi @yxsee , just noticed I didn't reply to this. We don't support this but this isn't fundamentally hard to implement. I'll add it on the backburner!