
Run Scanorama on Seurat's Assay5 object through IntegrateLayers
      Source: R/Scanorama.R
      ScanoramaIntegration.RdA wrapper to run Scanorama on multi-layered Seurat V5 object.
Requires a conda environment with scanorama and necessary dependencies
Usage
ScanoramaIntegration(
  object,
  orig,
  layers = NULL,
  features = NULL,
  scale.layer = "scale.data",
  conda_env = NULL,
  new.reduction = "integrated.scanorama",
  reduction.key = "scanorama_",
  reconstructed.assay = "scanorama.reconstructed",
  ncores = 1L,
  ndims.out = 100L,
  return_dense = TRUE,
  batch_size = 5000,
  approx = TRUE,
  sigma = 15L,
  alpha = 0.1,
  knn = 20L,
  hvg.scanorama = NULL,
  union.features = FALSE,
  sketch = FALSE,
  sketch_method = c("geosketch", "uniform"),
  sketch_max = 10000,
  seed.use = 42L,
  verbose = TRUE,
  ...
)Arguments
- object
- A - Seuratobject (or an- Assay5object if not called by- IntegrateLayers)
- orig
- DimReducobject. Not to be set directly when called with- IntegrateLayers, use- orig.reductionargument instead
- layers
- Name of the layers to use in the integration 
- features
- Vector of feature names to input to the integration method. When - features = NULL(default), the- VariableFeaturesare used. To pass all features, use the output of- Features()
- scale.layer
- Name of the scaled layer in - Assay
- conda_env
- Path to conda environment to run scanorama (should also contain the scipy python module). By default, uses the conda environment registered for scanorama in the conda environment manager 
- new.reduction
- Name to store resulting dimensional reduction object. - NULLor- FALSEdisables the dimension reduction computation
- reduction.key
- Key for resulting dimensional reduction object. Ignored if - reduction.keyis- NULLor- FALSE
- reconstructed.assay
- Name for the - assaycontaining the corrected expression matrix of dimension #- featuresx #cells.- NULLor- FALSEdisables the corrected expression matrix computation
- ncores
- Number of parallel threads to create through blas_set_num_threads. Pointless if BLAS is not supporting multithreaded 
- ndims.out
- Number of dimensions for - new.reductionoutput. Scanorama specific argument
- return_dense
- Whether scanorama returns - numpy.ndarraymatrices instead of- scipy.sparse.csr_matrix. Scanorama specific argument
- batch_size
- Used in the alignment vector computation. Higer values increase memory burden.Scanorama specific argument 
- approx
- Whether scanorama approximates nearest neighbors computation. Scanorama specific argument 
- sigma
- Correction smoothing parameter on gaussian kernel. Scanorama specific argument 
- alpha
- Minimum alignment score. Scanorama specific argument 
- knn
- Number of nearest neighbours used for matching. Scanorama specific argument 
- hvg.scanorama
- A positive integer to turn scanorama's internal HVG selection on. Disabled by default. Scanorama specific argument 
- union.features
- By default, scanorama uses the intersection of features to perform integration. Set this parameter to - TRUEto use the union. Discouraged. Scanorama specific argument
- sketch
- Turns on sketching-based acceleration by first downsampling the datasets. See Hie et al., Cell Systems (2019). Disabled by default. Ignored when - reconstructed.assayis enabled. Scanorama specific argument
- sketch_method
- A skething method to apply to the data. Either 'geosketch' (default) or 'uniform'. Ignored when - reconstructed.assayis enabled or when- sketchis FALSE. Scanorama specific argument
- sketch_max
- Downsampling cutoff. Ignored when sketching disabled. Scanorama specific argument 
- seed.use
- An integer to generate reproducible outputs. Set - seed.use = NULLto disable
- verbose
- Print messages. Set to - FALSEto disable
- ...
- Ignored 
Value
A list containing at least one of:
- a new DimReduc of name - reduction.name(key set to- reduction.key) with corrected embeddings matrix of- ndims.out.
- a new Assay of name - reconstructed.assaywith corrected counts for each- features(or less if- hvgis set to a lower integer).
When called via IntegrateLayers, a Seurat object with
the new reduction and/or assay is returned
Note
This function requires the Scanorama package to be installed (along with scipy)
References
Hie, B., Bryson, B. & Berger, B. Efficient integration of heterogeneous single-cell transcriptomes using Scanorama. Nat Biotechnol 37, 685–691 (2019). DOI
Examples
if (FALSE) { # \dontrun{
# Preprocessing
obj <- SeuratData::LoadData("pbmcsca")
obj[["RNA"]] <- split(obj[["RNA"]], f = obj$Method)
obj <- NormalizeData(obj)
obj <- FindVariableFeatures(obj)
obj <- ScaleData(obj)
obj <- RunPCA(obj)
# After preprocessing, we integrate layers:
obj <- IntegrateLayers(object = obj, method = ScanoramaIntegration)
# To disable feature expression matrix correction:
obj <- IntegrateLayers(object = obj, method = ScanoramaIntegration,
                       reconstructed.assay = NULL)
} # }