H5matref {BiocSklearn} | 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"
fn = system.file("ban_6_17/assays.h5", package="BiocSklearn") ban = H5matref(fn) ban np = import("numpy", convert=FALSE) # ensure ban$shape np$take(ban, 0:3, 0L) fullpca = skPCA(ban) dim(getTransformed(fullpca)) ta = np$take # project samples ta(ban, 0:20, 0L)$shape st = skPartialPCA_step(ta(ban, 0:20, 0L)) st = skPartialPCA_step(ta(ban, 21:40, 0L), obj=st) st = skPartialPCA_step(ta(ban, 41:63, 0L), obj=st) oo = st$transform(ban) dim(oo) cor(oo[,1:4], getTransformed(fullpca)[,1:4])