cor.HDF5Matrix

cor.HDF5Matrix

OTHER

1 Usage

cor.HDF5Matrix(...)

2 Arguments

Parameter Description
x An object.
y An for cross-correlation, or (default) to compute .
use Character string. Only (default) and are currently supported.
method (default) or .
trans_x Logical. If , correlate rows of instead of columns (useful for sample-sample correlations in omics data). Default .
trans_y Logical. Same for . Default .
compute_pvalues Logical. Also compute and store p-values on disk. Default .
block_size Integer or NULL. Block size for HDF5 reads (NULL = auto).
threads Integer or NULL. Number of OpenMP threads (NULL = auto).
result_path Output location: (default) writes to in the same file as . A character string specifies a custom output group in the same file. A named list writes to a different file.
compression Integer (0-9) or NULL. gzip compression level for the result datasets. NULL uses the global option set by (default 6). Use to disable compression (faster for benchmarks).

3 Value

An pointing to the correlation matrix on disk. Attributes attached to the result:

4 Examples

\donttest{
tmp <- tempfile(fileext = ".h5")
X   <- hdf5_create_matrix(tmp, "data/X",
                           data = matrix(rnorm(500), 50, 10))

# Auto-correlation: cor(X) — 10 x 10 matrix
C <- cor(X)
dim(C)
cat("method:", attr(C, "cor.method"), "\n")

# Spearman
Cs <- cor(X, method = "spearman")
dim(Cs)

# Sample-sample correlation (rows)
Sr <- cor(X, trans_x = TRUE)   # 50 x 50
dim(Sr)

X$close(); C$close(); Cs$close(); Sr$close()
unlink(tmp)
}