Wrapper function to

Read_Velocity(
  loom_file = NULL,
  data_dir = NULL,
  multi_dir = TRUE,
  gene_symbol = TRUE,
  sort_type = FALSE,
  sample_list = NULL,
  sample_names = NULL,
  shared_suffix = NULL,
  parallel = FALSE,
  num_cores = NULL
)

Arguments

loom_file

path and name of loom file to read

data_dir

path to data directory containing all loom files to read

multi_dir

logical, whether or not files are contained in sub-directories or in single folder, default is NULL

gene_symbol

logical, should row names of returned matrices have gene symbols or accession ID #s, default is TRUE (symbols).

sort_type

logical, default is FALSE and will return list with 1 sample per entry. Each sample entry will contain 3 matrices (spliced, unspliced, ambiguous). If TRUE will return list of 3 matrix types (spliced, unspliced, ambiguous) with one entry per sample

sample_list

A vector of file prefixes/names if specific samples are desired. Default is NULL and will load all samples in given directory.

sample_names

a set of sample names to use for each sample entry in returned list. If NULL will set names to the file name of each sample.

shared_suffix

a suffix and file extension shared by all samples.

parallel

logical (default FALSE). Whether to use multiple cores when reading in data. Only possible on Linux based systems.

num_cores

if parallel = TRUE indicates the number of cores to use for multi-core processing.

Value

list of sparse matrices containing spliced, unspliced, and ambiguous counts

References

Function is updated from SeuratWrappers::ReadVelocity https://github.com/satijalab/seurat-wrappers/blob/master/R/velocity.R (License: GPL-3). Function included in scCustomize to avoid installation issues related to other aspects of velocyto.R package which SeuratWrappers::ReadVelocity requires. scCustomize version also adds multi-file and multi-directory support, ability to return Ensembl IDs, and multi-core parallel file reading.

Examples

if (FALSE) {
# Read single velocity loom file
velo_res <- Read_Velocity(loom_file = "PATH/sample01.loom")

# Read single velocity loom file with ensembl IDs
velo_res <- Read_Velocity(loom_file = "PATH/sample01.loom", gene_symbol = FALSE)

# Read multiple files from a parent directory with many subdirectories & return 1 list entry per
sample
# Each entry will contain 3 matrices (spliced, unspliced, ambiguous)
velo_res_list <- Read_Velocity(loom_file = "PATH/", secondary_path = "SEC_PATH/")

# Sort returned list by read type instead of by sample
# list will contain 3 entries (spliced, unspliced, ambiguous)
# each entry will contain 1 matrix per sample
velo_res_list <- Read_Velocity(loom_file = "PATH/", secondary_path = "SEC_PATH/",
sort_type = TRUE)

# Read multiple files from a single directory
velo_res_list <- Read_Velocity(loom_file = "PATH/", multi_dir = FALSE)
}