Title: | beachmat bindings for TileDB-backed matrices |
---|---|
Description: | Extends beachmat to initialize tatami matrices from TileDB-backed arrays. This allows C++ code in downstream packages to directly call the TileDB C/C++ library to access array data, without the need for block processing via DelayedArray. Developers only need to import this package to automatically extend the capabilities of beachmat::initializeCpp to TileDBArray instances. |
Authors: | Aaron Lun [aut, cre] |
Maintainer: | Aaron Lun <[email protected]> |
License: | GPL-3 |
Version: | 0.99.1 |
Built: | 2025-01-05 03:29:41 UTC |
Source: | https://github.com/bioc/beachmat.tiledb |
Initialize C++ representations of TileDB-backed matrices based on their TileDBArray representations.
## S4 method for signature 'TileDBArraySeed' initializeCpp( x, tiledb.cache.size = getAutoBlockSize(), tiledb.realize = initializeOptions("realize"), tiledb.realize.num.threads = initializeOptions("realize.num.threads"), tiledb.concurrency.level = initializeOptions("concurrency.level"), ... )
## S4 method for signature 'TileDBArraySeed' initializeCpp( x, tiledb.cache.size = getAutoBlockSize(), tiledb.realize = initializeOptions("realize"), tiledb.realize.num.threads = initializeOptions("realize.num.threads"), tiledb.concurrency.level = initializeOptions("concurrency.level"), ... )
x |
A TileDBArray seed object. |
tiledb.cache.size |
Integer scalar specifying the size of the cache in bytes during data extraction from a TileDB matrix. Larger values reduce disk I/O during random access to the matrix, at the cost of increased memory usage. |
tiledb.realize |
See the |
tiledb.realize.num.threads |
See the |
tiledb.concurrency.level |
See the |
... |
Further arguments, ignored. |
An external pointer that can be used in any tatami-compatible function.
Aaron Lun
library(TileDBArray) y <- matrix(runif(1000), ncol=20, nrow=50) z <- as(y, "TileDBArray") ptr <- initializeCpp(z)
library(TileDBArray) y <- matrix(runif(1000), ncol=20, nrow=50) z <- as(y, "TileDBArray") ptr <- initializeCpp(z)
Options for initializing TileDB matrices in initializeCpp
.
initializeOptions(option, value)
initializeOptions(option, value)
option |
String specifying the name of the option. |
value |
Value of the option. |
The following options are supported:
realize
, a logical scalar specifying whether to load the matrix data from TileDB into memory with loadIntoMemory
,
and then cache it for future calls with checkMemoryCache
.
This avoids time-consuming disk I/O when performing multiple passes through the matrix, at the expense of increased memory usage.
realize.num.threads
, an integer scalar specifying the number of threads that can be used by loadIntoMemory
outside of TileDB calls.
This is only relevant when realize=TRUE
.
concurrency.level
, an integer scalar specifying the number of threads that can be used by the TileDB library.
Alternatively NULL
, in which case TileDB's default (i.e., all available cores on the machine) are used.
Greater performance may be achieved when the product of realize.num.threads
and concurrency.level
does not exceed the number of available cores.
If value
is missing, the current setting of option
is returned.
If value
is supplied, it is used to set the option, and the previous value of the option is invisibly returned.
Aaron Lun
initializeOptions("realize") old <- initializeOptions("realize", TRUE) # setting to a new value initializeOptions("realize") # new option takes affect initializeOptions("realize", old) # setting it back
initializeOptions("realize") old <- initializeOptions("realize", TRUE) # setting to a new value initializeOptions("realize") # new option takes affect initializeOptions("realize", old) # setting it back
Load a TileDB-backed matrix into memory as an external pointer to a tatami-compatible representation.
This differs from the (default) behavior of initializeCpp
, which only loads slices of the matrix on request.
loadIntoMemory( x, cache.size = getAutoBlockSize(), num.threads = 1, concurrency.level = NULL )
loadIntoMemory( x, cache.size = getAutoBlockSize(), num.threads = 1, concurrency.level = NULL )
x |
A TileDBArray-derived matrix or seed object. |
cache.size |
Integer scalar specifying the size of the cache in bytes during data extraction from a TileDB matrix. |
num.threads |
Integer scalar specifying the number of threads to use outside of the TileDB library. |
concurrency.level |
Integer scalar specifying the number of threads that can be used by the TileDB library.
See the option of the same name in |
An external pointer that can be used in tatami-based functions.
Aaron Lun
library(TileDBArray) y <- matrix(runif(1000), ncol=20, nrow=50) z <- as(y, "TileDBArray") ptr <- loadIntoMemory(z)
library(TileDBArray) y <- matrix(runif(1000), ncol=20, nrow=50) z <- as(y, "TileDBArray") ptr <- loadIntoMemory(z)