Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/satijalab/seurat-wrappers/llms.txt

Use this file to discover all available pages before exploring further.

ExportToCellbrowser() exports a Seurat object as a UCSC Cell Browser dataset. It creates all required files (expression matrix, metadata, cell embeddings, marker genes) in the specified directory and optionally launches a local Cell Browser server.

Syntax

ExportToCellbrowser(
  object,
  dir,
  dataset.name = Project(object = object),
  reductions = NULL,
  markers.file = NULL,
  cluster.field = NULL,
  cb.dir = NULL,
  port = NULL,
  use.mtx = FALSE,
  meta.fields = NULL,
  meta.fields.names = NULL,
  matrix.slot = "counts",
  markers.n = 100,
  skip.markers = FALSE,
  skip.expr.matrix = FALSE,
  skip.metadata = FALSE,
  skip.reductions = FALSE
)

Parameters

object
Seurat
required
A Seurat object to export.
dir
character
required
Output directory where Cell Browser files will be written.
dataset.name
character
Name of the Cell Browser dataset. Defaults to Project(object).
reductions
character vector
default:"NULL"
Names of dimensional reductions to export. If NULL, exports all available reductions.
markers.file
character
default:"NULL"
Path to a pre-computed markers file. If NULL and skip.markers = FALSE, markers are computed automatically.
cluster.field
character
default:"NULL"
Metadata column to use as cell cluster labels.
cb.dir
character
default:"NULL"
If provided, also builds the Cell Browser HTML in this directory for direct serving.
port
integer
default:"NULL"
If provided, launches a local Cell Browser server on this port after export.
use.mtx
logical
default:"FALSE"
Export the expression matrix in .mtx.gz format (sparse). Automatically enabled for very large matrices.
meta.fields
character vector
default:"NULL"
Metadata columns to include. If NULL, all metadata columns are exported.
meta.fields.names
character vector
default:"NULL"
Display names for the metadata fields specified in meta.fields.
matrix.slot
character
default:"counts"
Which expression matrix to export. One of "counts", "data", or "scale.data".
markers.n
integer
default:"100"
Number of top markers per cluster to include in the exported markers file.
skip.markers
logical
default:"FALSE"
Skip marker gene computation and export.
skip.expr.matrix
logical
default:"FALSE"
Skip expression matrix export (for incremental updates).
skip.metadata
logical
default:"FALSE"
Skip metadata export.
skip.reductions
logical
default:"FALSE"
Skip dimensional reduction export.

Returns

Invisibly returns NULL. Creates the following files in dir:
  • exprMatrix.tsv.gz (or matrix.mtx.gz) — expression matrix
  • meta.tsv — cell metadata
  • <reduction>.coords.tsv.gz — cell coordinates for each reduction
  • markers.tsv — marker genes per cluster
  • cellbrowser.conf — Cell Browser configuration file

StopCellbrowser()

Stops a running Cell Browser server started by ExportToCellbrowser().
StopCellbrowser()

Examples

library(SeuratWrappers)

# Export only
ExportToCellbrowser(
  object = seurat_obj,
  dir = "cellbrowser_output",
  dataset.name = "PBMC_3k"
)

# Export and launch local server on port 8080
ExportToCellbrowser(
  object = seurat_obj,
  dir = "cellbrowser_output",
  dataset.name = "PBMC_3k",
  cb.dir = "cellbrowser_html",
  port = 8080
)

# Stop the server when done
StopCellbrowser()

See Also

Build docs developers (and LLMs) love