readSubset: Sample data for plotting

View source: R/rliger.R

readSubsetR Documentation

Sample data for plotting

Description

This function samples raw/normalized/scaled data from on-disk HDF5 files for plotting. This function assumes that the cell barcodes are unique across all datasets.

Usage

readSubset(
  object,
  slot.use = "norm.data",
  balance = NULL,
  max.cells = 1000,
  chunk = 1000,
  datasets.use = NULL,
  genes.use = NULL,
  rand.seed = 1,
  verbose = TRUE
)

Arguments

object

liger object. Should call normalize and selectGenes before calling.

slot.use

Type of data for sampling (raw.data, norm.data(default), scale.data).

balance

Type of sampling. NULL means that max_cells are sampled from among all cells; balance="dataset" samples up to max_cells from each dataset; balance="cluster" samples up to max_cells from each cluster.

max.cells

Total number of cell to sample (default 5000).

chunk

is the max number of cells at a time to read from disk (default 1000).

datasets.use

uses only the specified datasets for sampling. Default is NULL (all datasets)

genes.use

samples from only the specified genes. Default is NULL (all genes)

rand.seed

for reproducibility (default 1).

verbose

Print progress bar/messages (TRUE by default)

Value

liger object with sample.data slot set.

Examples

ligerex <- createLiger(list(ctrl = ctrl, stim = stim))
if (length(ligerex@H) > 0) {
    # Downsampling is calculated basing on factorization result
    ligerex <- readSubset(ligerex, slot.use = "norm.data", max.cells = 100)
}

rliger documentation built on Nov. 9, 2023, 1:07 a.m.