H5matref | R Documentation |
obtain an HDF5 dataset reference suitable for handling as numpy matrix
H5matref(filename, dsname = "assay001")
filename |
a pathname to an HDF5 file |
dsname |
internal name of HDF5 matrix to use, defaults to 'assay001' |
instance of (S3) "h5py._hl.dataset.Dataset"
This should only be used with persistent environment discipline of basilisk. Additional support is planned in Bioc 3.12.
fn = system.file("ban_6_17/assays.h5", package="BiocSklearn")
ban = H5matref(fn)
ban
proc = basilisk::basiliskStart(BiocSklearn:::bsklenv)
fullpca = basilisk::basiliskRun(proc, function() {
np = import("numpy", convert=FALSE) # ensure
print(ban$shape)
print(np$take(ban, 0:3, 0L))
fullpca = skPCA(ban)
tx = getTransformed(fullpca)
print(dim(tx))
fullpca
})
basilisk::basiliskStop(proc)
# project samples
np = reticulate::import("numpy", convert=FALSE, delay_load=TRUE)
np$take(ban, 0:20, 0L)$shape
st = skPartialPCA_step(np$take(ban, 0:20, 0L), n_comp=4L)
st = skPartialPCA_step(np$take(ban, 21:40, 0L), n_comp=4L, obj=st)
st = skPartialPCA_step(np$take(ban, 41:63, 0L), n_comp=4L, obj=st)
oo = st$transform(ban)
dim(oo)
cor(oo[,1:4], getTransformed(fullpca)[,1:4])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.