from_seurat#

@staticmethodSingleCell.from_seurat(seurat_object_name, *, assay=None, layer='counts', num_threads=-1)[source]#

Create a SingleCell dataset from a Seurat object that has already been loaded into memory via the ryp Python-R bridge. To load a Seurat object from disk, use e.g. SingleCell(‘filename.rds’). Both version 3 and version 5 Seurat objects are supported.

Parameters:
  • seurat_object_name: str

    the name of the Seurat object in the ryp R workspace

  • assay: str | None

    the name of the assay within the Seurat object to load data from; if None, defaults to the Seurat object’s active.assay attribute (usually ‘RNA’)

  • layer: str

    the layer within the active assay (or the assay specified by the assay argument, if not None) to use as X. Defaults to ‘counts’. Set to ‘data’ to load the normalized counts, or ‘scale.data’ to load the normalized and scaled counts, if available. If dense, will be automatically converted to a sparse array.

  • num_threads: int

    the default number of threads to use for all subsequent operations on this SingleCell dataset. Also sets the number of threads for this SingleCell dataset’s count matrix, if present. Does not affect the number of threads used for data loading; this will always be single-threaded for Seurat objects.

Returns:

The corresponding SingleCell dataset.

Return type:

SingleCell