Export10X: Reexport the data from a Seurat object in 10X format

View source: R/Export10X.R

Export10XR Documentation

Reexport the data from a Seurat object in 10X format

Description

Exports the counts matrix, features and barcodes from a Seurat object in a 10X-like format, with an additional metadata matrix in tsv format, that can be augmented with dimensionality reduction coordinates. The exported data is in standard mtx and tsv formats (sparse matrix matrix market format and tab separated values respectively), which facilitates sharing and reuse, and can be re-imported in a Seurat object with Import10X, or directly in matrices/data frames with e.g. Matrix::readMM and readr::read_tsv.

Usage

Export10X(
  object,
  dir,
  meta_columns = "all",
  append_reductions = "all",
  gzip = T,
  rows = "features.tsv",
  cols = "barcodes.tsv",
  counts = "matrix.mtx",
  meta = "metadata.tsv",
  layer = "counts",
  assay = "RNA"
)

Arguments

object

Seurat object.

dir

character(1). The directory in which the data should be exported. Created if non-existent.

meta_columns

character(n). Metadata columns that should be exported from the Seurat Object. Can also be "all", or empty vector c() for none. Default: "all".

append_reductions

character(n). Name of the dimensionality reductions that should be included with the metadata. Default: "all".

gzip

logical(1). Should the exported files be compressed. If compressed, the filenames are appended with the extension ".gz". Default: TRUE

rows

character(1). Name of the exported file that lists row names. Default: features.tsv

cols

character(1). Name of the exported file that lists column names. Default: barcodes.tsv

counts

character(1). Name of the exported file that contains the sparse raw count matrix. Default: matrix.mtx

meta

character(1). Name of the exported file that contains the metadata. Default: metadata.tsv

layer

character(1). Name of the layer in the Seurat object from which the count matrix is exported. Default: counts

assay

character(1). Name of the assay in the Seurat object from which the count matrix is exported. Default: RNA

Examples

# By default keeping all the metadata columns, and all dimensionality reductions.
Export10X(SeuratObject, "MyDir")
# Include only two custom metadata columns, two dimensionality reductions, and do not compress the matrices.
Export10X(SeuratObject, "MyDir", c("nFeature_RNA", "mito.content"), c("pca","umap"), gzip=FALSE)
# Export normalized CiteSeq data rather than raw RNA counts, and no metadata:
Export10X(SeuratObject, "MyDir", meta_columns = c(), layer="data", assay="CiteSeq")

nbroguiere/burgertools documentation built on Jan. 30, 2024, 3:48 a.m.