as.Seurat.extras: Extra conversions to Seurat objects

as.SeuratR Documentation

Extra conversions to Seurat objects

Description

Extra conversions to Seurat objects

Usage

## S3 method for class 'Conos'
as.Seurat(
  x,
  method = "mnn",
  reduction = "largeVis",
  idents = names(x = x$clusters)[1],
  verbose = TRUE,
  ...
)

## S3 method for class 'cell_data_set'
as.Seurat(
  x,
  counts = "counts",
  data = NULL,
  assay = "RNA",
  project = "cell_data_set",
  loadings = NULL,
  clusters = NULL,
  ...
)

## S3 method for class 'list'
as.Seurat(
  x,
  default.assay = 1,
  slot = "counts",
  min.cells = 0,
  min.features = 0,
  verbose = TRUE,
  ...
)

Arguments

method

Name of matching method graph was built using

reduction

Name of graph embedding, if calculated

idents

Name of clutering method to set as identity class

loadings

Name of dimensional reduction to save loadings to, if present; defaults to first dimensional reduction present (eg. SingleCellExperiment::reducedDimNames(x)[1]); pass NA to suppress transfer of loadings

clusters

Name of clustering method to use for setting identity classes

default.assay

Name or index of matrix to use as default assay; defaults to name of first matrix in list

slot

Name of slot to store matrix in; choose from 'counts' or 'data'

Details

The Conos method for as.Seurat only works if all samples are Seurat objects. The object is initially constructed by merging all samples together using merge, any sample-level dimensional reductions and graphs will be lost during the merge. Extra information is added to the resulting Seurat object as follows:

  • Pairwise alignments will be stored in miscellaneous data, as will any other miscellaneous information

  • If a graph is present in the graph field, it will be stored as a Graph object, reordered to match cell order in the new Seurat object. It will be named "DefaultAssay(SeuratObject)_method"

  • If an embedding is present in the embedding field as a matrix, it will be stored as a DimReduc object with the name reduction and a key value of "toupper(reduction)_"

  • If the length of the clusters field is greater than zero, clustering information (groups field) will be added to object metadata. Extra information (result field) will be added to miscellaneous data with the name "conos.clustering.result"

  • If present, the first clustering entry in the clusters field will be set as object identity classes

The cell_data_set method for as.Seurat utilizes the SingleCellExperiment method of as.Seurat to handle moving over expression data, cell embeddings, and cell-level metadata. The following additional information will also be transfered over:

  • Feature loadings from cds@reduce_dim_aux$gene_loadings will be added to the dimensional reduction specified by loadings or the name of the first dimensional reduction that contains "pca" (case-insensitive) if loadings is not set

  • Monocle 3 clustering will be set as the default identity class. In addition, the Monocle 3 clustering will be added to cell-level metadata as “monocle3_clusters”, if present

  • Monocle 3 partitions will be added to cell-level metadata as “monocle3_partitions”, if present

  • Monocle 3 pseudotime calculations will be added to “monocle3_pseudotime”, if present

  • The nearest-neighbor graph, if present, will be converted to a Graph object, and stored as “assay_monocle3_graph”

The list method for as.Seurat takes a named list of matrices (dense or sparse) and creates a single Seurat object where each matrix is its own assay. The names of the list are taken to be the names of the assays. If not present, assays will be named as "Assay#" where "#" is the index number in the list of matrices. Objects will be constructed as follows:

  • By default, all matrices are assumed to be raw counts and will be stored in the counts slot. This can be changed to store in the matrix in the data slot instead. The slot parameter is vectorized, so different matrices can be stored in either counts or data

  • For any and all matrices designated as counts, the min.cells and min.features filtering will be applied. These parameters are vectorized, so different filterings can be applied to different matrices

  • No extra information (eg. project) can be provided to CreateSeuratObject

See Also

as.Seurat

as.Seurat.SingleCellExperiment


satijalab/seurat-wrappers documentation built on April 10, 2024, 3:25 p.m.