ingest_data: Import and standardize scRNAseq data across different formats

View source: R/ingest_data.R

ingest_dataR Documentation

Import and standardize scRNAseq data across different formats

Description

Automatically infers data format of scRNAseq object, or a path to that object. It then uses the appropriate functions to import that data and convert it to a SingleCellExperiment, which is recognized by other EWCE functions.

Usage

ingest_data(
  obj,
  input_type = "guess",
  output_class = c("SingleCellExperiment", "Seurat", "CellDataSet", "list"),
  custom_reader = NULL,
  save_path = NULL,
  overwrite = FALSE,
  return_save_path = FALSE,
  verbose = TRUE,
  ...
)

Arguments

obj

A single-cell data object, or a path to saved single-cell data.

input_type

Format of obj. By default, the type will be inferred.

output_class

Format to convert obj to.

custom_reader

Custom function to read obj into R.

save_path

Path to save the converted obj.

overwrite

If a file of the same name exists, overwrite it.

return_save_path

If TRUE, a list with both the converted object and the saved file path will be returned (instead of just the converted object).

verbose

Print messages.

...

Arguments passed on to read_data

path

Path to saved single-cell data file, or a directory containing the data files. If path is already an R object, it will be returned directly.

filetype

The type of file trying to be read in, made explicit by the user. "guess" (default) will simply infer the most likely file type.

as_sparse

Convert to a sparseMatrix.

Value

Converted single-cell object.

Source

SeuratDisk anndata (R) anndata (python) loomR SingleCellExperiment DelayedArray workshop zellkonverter

Examples

## Not run: 
#### Input: Seurat object ####
seurat <- example_obj("seurat")
sce1 <- ingest_data(obj=seurat)

#### Input: Matrix object ####
sce2 <- ingest_data(obj=seurat@assays$RNA@counts)

#### Input hdf5se object ####
hdf5se <- example_obj("hdf5se")
sce3 <- ingest_data(obj=hdf5se)

#### Input anndata object ####
ad <- example_obj("anndata")
sce4 <- ingest_data(obj=ad)

#### Input anndata path ####
sce5 <- ingest_data(obj = ad$filename)

#### Input: h5Seurat object ####
h5seurat <- example_obj("h5seurat")
sce6 <- ingest_data(obj=h5seurat)

#### Input: h5Seurat path ####
sce7 <- ingest_data(obj=h5seurat$path)

#### Input: loom object ####
library(Seurat)
loom <- example_obj("loom")
sce8 <- ingest_data(obj=loom)

#### Input: EWCE object ####
\dontrun{
ewce <- ewceData::cortex_mrna()
sce10 <- ingest_data(obj=ewce)
}

## End(Not run)

bschilder/scKirby documentation built on April 22, 2024, 12:13 a.m.