I have a large tiledb database with 144000 fragments. At some point, I need to select that database by multi-range indexes. With python, it works well, Let’s say I need to select indexes 3 and 6, I can do the following which executes in less than a second:
matrix_tdb.df[[3,6], :]
However, in R, it is generally much slower to load the db. But I also can’t select by specific indexes like I can in python. For instance, I can load the database with this instruction:
matrix_tdb = tiledb_array(matrix_tdb_uri, "READ", keep_open=FALSE, return_as="data.frame")
Then, say I’d like to extract indexes 3 and 6, I do the following (which takes many seconds to execute, in contrast with python):
tmp = matrix_tdb[c(3,6),]
But I always get a range returned:
> unique(tmp$cell_index)
[1] 3 4 5 6
I have tried to use the solution described here: https://docs.tiledb.com/main/how-to/arrays/reading-arrays/multi-range-subarrays
tiledb_query_add_range(qry, sch, "rows", 3L, 4L)
tiledb_query_add_range(qry, sch, "rows", 7L, 9L)
But whenever I do that I always get returned the last specified range excluding the previous one. In that example, I would get indexes 7 to 9 only, not 3 to 4.
Any hint would be appreciated.
Cheers,