H5Apply: Apply function to chunks of H5 data in ligerDataset object

View source: R/h5Utility.R

H5ApplyR Documentation

Apply function to chunks of H5 data in ligerDataset object

Description

h5 calculation wrapper, that runs specified calculation with on-disk matrix in chunks

Usage

H5Apply(
  object,
  FUN,
  init = NULL,
  useData = c("rawData", "normData"),
  chunkSize = 1000,
  verbose = getOption("ligerVerbose"),
  ...
)

Arguments

object

A ligerDataset object.

FUN

A function that is applied to each chunk. See detail for restrictions.

init

Initialized result if it need to be updated iteratively. Default NULL.

useData

The slot name of the data to be processed. Choose from "rawData", "normData", "scaleData". Default "rawData".

chunkSize

Number if columns to be included in each chunk. Default 1000.

verbose

Logical. Whether to show information of the progress. Default getOption("ligerVerbose") which is TRUE if users have not set.

...

Other arguments to be passed to FUN.

Details

The FUN function has to have the first four arguments ordered by:

  1. chunk data: A sparse matrix (dgCMatrix-class) containing maximum chunkSize columns.

  2. x-vector index: The index that subscribes the vector of x slot of a dgCMatrix, which points to the values in each chunk. Mostly used when need to write a new sparse matrix to H5 file.

  3. cell index: The column index of each chunk out of the whole original matrix

  4. Initialized result: A customized object, the value passed to H5Apply(init) argument will be passed here in the first iteration. And the returned value of FUN will be iteratively passed here in next chunk iterations. So it is important to keep the object structure of the returned value consistent with init.

No default value to these four arguments should be pre-defined because H5Apply will automatically generate the input.


rliger documentation built on Oct. 30, 2024, 1:07 a.m.